commit 6358d0754b0f011c1dd625877016cef72381a5a0 Author: astravexton Date: Fri Oct 22 15:24:12 2021 +0100 initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2be5f85 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +/.tdlib +/.cmd diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0750d48 --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2018-2019 Aleksandr Zelenin + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..419729c --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +TAG := v1.7.0 + +schema-update: + curl https://raw.githubusercontent.com/tdlib/td/${TAG}/td/generate/scheme/td_api.tl 2>/dev/null > ./data/td_api.tl + +generate-json: + go run ./cmd/generate-json.go \ + -version "${TAG}" \ + -output "./data/td_api.json" + +generate-code: + go run ./cmd/generate-code.go \ + -version "${TAG}" \ + -outputDir "./client" \ + -package client \ + -functionFile function.go \ + -typeFile type.go \ + -unmarshalerFile unmarshaler.go + go fmt ./... diff --git a/README.md b/README.md new file mode 100644 index 0000000..de9f9e3 --- /dev/null +++ b/README.md @@ -0,0 +1,127 @@ +# go-tdlib + +Go wrapper for [TDLib (Telegram Database Library)](https://github.com/tdlib/td) with full support of TDLib v1.7.0 + +## TDLib installation + +Use [TDLib build instructions](https://tdlib.github.io/td/build.html) + +## Usage + +### Client + +[Register an application](https://my.telegram.org/apps) to obtain an api_id and api_hash + +```go +package main + +import ( + "log" + "path/filepath" + + "github.com/zelenin/go-tdlib/client" +) + +func main() { + // client authorizer + authorizer := client.ClientAuthorizer() + go client.CliInteractor(authorizer) + + // or bot authorizer + // botToken := "000000000:gsVCGG5YbikxYHC7bP5vRvmBqJ7Xz6vG6td" + // authorizer := client.BotAuthorizer(botToken) + + const ( + apiId = 00000 + apiHash = "8pu9yg32qkuukj83ozaqo5zzjwhkxhnk" + ) + + authorizer.TdlibParameters <- &client.TdlibParameters{ + UseTestDc: false, + DatabaseDirectory: filepath.Join(".tdlib", "database"), + FilesDirectory: filepath.Join(".tdlib", "files"), + UseFileDatabase: true, + UseChatInfoDatabase: true, + UseMessageDatabase: true, + UseSecretChats: false, + ApiId: apiId, + ApiHash: apiHash, + SystemLanguageCode: "en", + DeviceModel: "Server", + SystemVersion: "1.0.0", + ApplicationVersion: "1.0.0", + EnableStorageOptimizer: true, + IgnoreFileNames: false, + } + + logVerbosity := client.WithLogVerbosity(&client.SetLogVerbosityLevelRequest{ + NewVerbosityLevel: 0, + }) + + tdlibClient, err := client.NewClient(authorizer, logVerbosity) + if err != nil { + log.Fatalf("NewClient error: %s", err) + } + + optionValue, err := tdlibClient.GetOption(&client.GetOptionRequest{ + Name: "version", + }) + if err != nil { + log.Fatalf("GetOption error: %s", err) + } + + log.Printf("TDLib version: %s", optionValue.(*client.OptionValueString).Value) + + me, err := tdlibClient.GetMe() + if err != nil { + log.Fatalf("GetMe error: %s", err) + } + + log.Printf("Me: %s %s [%s]", me.FirstName, me.LastName, me.Username) +} + +``` + +### Receive updates + +```go +tdlibClient, err := client.NewClient(authorizer) +if err != nil { + log.Fatalf("NewClient error: %s", err) +} + +listener := tdlibClient.GetListener() +defer listener.Close() + +for update := range listener.Updates { + if update.GetClass() == client.ClassUpdate { + log.Printf("%#v", update) + } +} +``` + +### Proxy support + +```go +proxy := client.WithProxy(&client.AddProxyRequest{ + Server: "1.1.1.1", + Port: 1080, + Enable: true, + Type: &client.ProxyTypeSocks5{ + Username: "username", + Password: "password", + }, +}) + +tdlibClient, err := client.NewClient(authorizer, proxy) + +``` + +## Notes + +* WIP. Library API can be changed in the future +* The package includes a .tl-parser and generated [json-schema](https://github.com/zelenin/go-tdlib/tree/master/data) for creating libraries in other languages + +## Author + +[Aleksandr Zelenin](https://github.com/zelenin/), e-mail: [aleksandr@zelenin.me](mailto:aleksandr@zelenin.me) diff --git a/client/authorization.go b/client/authorization.go new file mode 100644 index 0000000..c4ccb32 --- /dev/null +++ b/client/authorization.go @@ -0,0 +1,233 @@ +package client + +import ( + "errors" + "fmt" + "time" + + "golang.org/x/crypto/ssh/terminal" +) + +var ErrNotSupportedAuthorizationState = errors.New("not supported state") + +type AuthorizationStateHandler interface { + Handle(client *Client, state AuthorizationState) error + Close() +} + +func Authorize(client *Client, authorizationStateHandler AuthorizationStateHandler) error { + defer authorizationStateHandler.Close() + + var authorizationError error + + for { + state, err := client.GetAuthorizationState() + if err != nil { + return err + } + + if state.AuthorizationStateType() == TypeAuthorizationStateClosed { + return authorizationError + } + + if state.AuthorizationStateType() == TypeAuthorizationStateReady { + // dirty hack for db flush after authorization + time.Sleep(1 * time.Second) + return nil + } + + err = authorizationStateHandler.Handle(client, state) + if err != nil { + authorizationError = err + client.Close() + } + } +} + +type clientAuthorizer struct { + TdlibParameters chan *TdlibParameters + PhoneNumber chan string + Code chan string + State chan AuthorizationState + Password chan string +} + +func ClientAuthorizer() *clientAuthorizer { + return &clientAuthorizer{ + TdlibParameters: make(chan *TdlibParameters, 1), + PhoneNumber: make(chan string, 1), + Code: make(chan string, 1), + State: make(chan AuthorizationState, 10), + Password: make(chan string, 1), + } +} + +func (stateHandler *clientAuthorizer) Handle(client *Client, state AuthorizationState) error { + stateHandler.State <- state + + switch state.AuthorizationStateType() { + case TypeAuthorizationStateWaitTdlibParameters: + _, err := client.SetTdlibParameters(&SetTdlibParametersRequest{ + Parameters: <-stateHandler.TdlibParameters, + }) + return err + + case TypeAuthorizationStateWaitEncryptionKey: + _, err := client.CheckDatabaseEncryptionKey(&CheckDatabaseEncryptionKeyRequest{}) + return err + + case TypeAuthorizationStateWaitPhoneNumber: + _, err := client.SetAuthenticationPhoneNumber(&SetAuthenticationPhoneNumberRequest{ + PhoneNumber: <-stateHandler.PhoneNumber, + Settings: &PhoneNumberAuthenticationSettings{ + AllowFlashCall: false, + IsCurrentPhoneNumber: false, + AllowSmsRetrieverApi: false, + }, + }) + return err + + case TypeAuthorizationStateWaitCode: + _, err := client.CheckAuthenticationCode(&CheckAuthenticationCodeRequest{ + Code: <-stateHandler.Code, + }) + return err + + case TypeAuthorizationStateWaitRegistration: + return ErrNotSupportedAuthorizationState + + case TypeAuthorizationStateWaitPassword: + _, err := client.CheckAuthenticationPassword(&CheckAuthenticationPasswordRequest{ + Password: <-stateHandler.Password, + }) + return err + + case TypeAuthorizationStateReady: + return nil + + case TypeAuthorizationStateLoggingOut: + return ErrNotSupportedAuthorizationState + + case TypeAuthorizationStateClosing: + return nil + + case TypeAuthorizationStateClosed: + return nil + } + + return ErrNotSupportedAuthorizationState +} + +func (stateHandler *clientAuthorizer) Close() { + close(stateHandler.TdlibParameters) + close(stateHandler.PhoneNumber) + close(stateHandler.Code) + close(stateHandler.State) + close(stateHandler.Password) +} + +func CliInteractor(clientAuthorizer *clientAuthorizer) { + for { + select { + case state, ok := <-clientAuthorizer.State: + if !ok { + return + } + + switch state.AuthorizationStateType() { + case TypeAuthorizationStateWaitPhoneNumber: + fmt.Println("Enter phone number: ") + var phoneNumber string + fmt.Scanln(&phoneNumber) + + clientAuthorizer.PhoneNumber <- phoneNumber + + case TypeAuthorizationStateWaitCode: + var code string + + fmt.Println("Enter code: ") + fmt.Scanln(&code) + + clientAuthorizer.Code <- code + + case TypeAuthorizationStateWaitPassword: + fmt.Println("Enter password: ") + // var password string + // fmt.Scanln(&password) + bytePassword, _ := terminal.ReadPassword(0) + clientAuthorizer.Password <- string(bytePassword) + + // clientAuthorizer.Password <- password + + case TypeAuthorizationStateReady: + return + } + } + } +} + +type botAuthorizer struct { + TdlibParameters chan *TdlibParameters + Token chan string + State chan AuthorizationState +} + +func BotAuthorizer(token string) *botAuthorizer { + botAuthorizer := &botAuthorizer{ + TdlibParameters: make(chan *TdlibParameters, 1), + Token: make(chan string, 1), + State: make(chan AuthorizationState, 10), + } + + botAuthorizer.Token <- token + + return botAuthorizer +} + +func (stateHandler *botAuthorizer) Handle(client *Client, state AuthorizationState) error { + stateHandler.State <- state + + switch state.AuthorizationStateType() { + case TypeAuthorizationStateWaitTdlibParameters: + _, err := client.SetTdlibParameters(&SetTdlibParametersRequest{ + Parameters: <-stateHandler.TdlibParameters, + }) + return err + + case TypeAuthorizationStateWaitEncryptionKey: + _, err := client.CheckDatabaseEncryptionKey(&CheckDatabaseEncryptionKeyRequest{}) + return err + + case TypeAuthorizationStateWaitPhoneNumber: + _, err := client.CheckAuthenticationBotToken(&CheckAuthenticationBotTokenRequest{ + Token: <-stateHandler.Token, + }) + return err + + case TypeAuthorizationStateWaitCode: + return ErrNotSupportedAuthorizationState + + case TypeAuthorizationStateWaitPassword: + return ErrNotSupportedAuthorizationState + + case TypeAuthorizationStateReady: + return nil + + case TypeAuthorizationStateLoggingOut: + return ErrNotSupportedAuthorizationState + + case TypeAuthorizationStateClosing: + return ErrNotSupportedAuthorizationState + + case TypeAuthorizationStateClosed: + return ErrNotSupportedAuthorizationState + } + + return ErrNotSupportedAuthorizationState +} + +func (stateHandler *botAuthorizer) Close() { + close(stateHandler.TdlibParameters) + close(stateHandler.Token) + close(stateHandler.State) +} diff --git a/client/client.go b/client/client.go new file mode 100644 index 0000000..5ef18a7 --- /dev/null +++ b/client/client.go @@ -0,0 +1,154 @@ +package client + +import ( + "errors" + "sync" + "time" +) + +type Client struct { + jsonClient *JsonClient + extraGenerator ExtraGenerator + catcher chan *Response + listenerStore *listenerStore + catchersStore *sync.Map + updatesTimeout time.Duration + catchTimeout time.Duration +} + +type Option func(*Client) + +func WithExtraGenerator(extraGenerator ExtraGenerator) Option { + return func(client *Client) { + client.extraGenerator = extraGenerator + } +} + +func WithCatchTimeout(timeout time.Duration) Option { + return func(client *Client) { + client.catchTimeout = timeout + } +} + +func WithUpdatesTimeout(timeout time.Duration) Option { + return func(client *Client) { + client.updatesTimeout = timeout + } +} + +func WithProxy(req *AddProxyRequest) Option { + return func(client *Client) { + client.AddProxy(req) + } +} + +func WithLogVerbosity(req *SetLogVerbosityLevelRequest) Option { + return func(client *Client) { + client.SetLogVerbosityLevel(req) + } +} + +func NewClient(authorizationStateHandler AuthorizationStateHandler, options ...Option) (*Client, error) { + catchersListener := make(chan *Response, 1000) + + client := &Client{ + jsonClient: NewJsonClient(), + catcher: catchersListener, + listenerStore: newListenerStore(), + catchersStore: &sync.Map{}, + } + + client.extraGenerator = UuidV4Generator() + client.catchTimeout = 60 * time.Second + client.updatesTimeout = 60 * time.Second + + for _, option := range options { + option(client) + } + + go client.receive() + go client.catch(catchersListener) + + err := Authorize(client, authorizationStateHandler) + if err != nil { + return nil, err + } + + return client, nil +} + +func (client *Client) receive() { + for { + resp, err := client.jsonClient.Receive(client.updatesTimeout) + if err != nil { + continue + } + client.catcher <- resp + + typ, err := UnmarshalType(resp.Data) + if err != nil { + continue + } + + needGc := false + for _, listener := range client.listenerStore.Listeners() { + if listener.IsActive() { + listener.Updates <- typ + } else { + needGc = true + } + } + if needGc { + client.listenerStore.gc() + } + } +} + +func (client *Client) catch(updates chan *Response) { + for update := range updates { + if update.Extra != "" { + value, ok := client.catchersStore.Load(update.Extra) + if ok { + value.(chan *Response) <- update + } + } + } +} + +func (client *Client) Send(req Request) (*Response, error) { + req.Extra = client.extraGenerator() + + catcher := make(chan *Response, 1) + + client.catchersStore.Store(req.Extra, catcher) + + defer func() { + close(catcher) + client.catchersStore.Delete(req.Extra) + }() + + client.jsonClient.Send(req) + + select { + case response := <-catcher: + return response, nil + + case <-time.After(client.catchTimeout): + return nil, errors.New("response catching timeout") + } +} + +func (client *Client) GetListener() *Listener { + listener := &Listener{ + isActive: true, + Updates: make(chan Type, 1000), + } + client.listenerStore.Add(listener) + + return listener +} + +func (client *Client) Stop() { + client.Destroy() + client.jsonClient.Destroy() +} diff --git a/client/extra.go b/client/extra.go new file mode 100644 index 0000000..bccd2c8 --- /dev/null +++ b/client/extra.go @@ -0,0 +1,20 @@ +package client + +import ( + "fmt" + "math/rand" +) + +type ExtraGenerator func() string + +func UuidV4Generator() ExtraGenerator { + return func() string { + var uuid [16]byte + rand.Read(uuid[:]) + + uuid[6] = (uuid[6] & 0x0f) | 0x40 + uuid[8] = (uuid[8] & 0x3f) | 0x80 + + return fmt.Sprintf("%08x-%04x-%04x-%04x-%012x", uuid[:4], uuid[4:6], uuid[6:8], uuid[8:10], uuid[10:]) + } +} diff --git a/client/function.go b/client/function.go new file mode 100755 index 0000000..050253a --- /dev/null +++ b/client/function.go @@ -0,0 +1,11390 @@ +// AUTOGENERATED + +package client + +import ( + "errors" +) + +// Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization +func (client *Client) GetAuthorizationState() (AuthorizationState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAuthorizationState", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeAuthorizationStateWaitTdlibParameters: + return UnmarshalAuthorizationStateWaitTdlibParameters(result.Data) + + case TypeAuthorizationStateWaitEncryptionKey: + return UnmarshalAuthorizationStateWaitEncryptionKey(result.Data) + + case TypeAuthorizationStateWaitPhoneNumber: + return UnmarshalAuthorizationStateWaitPhoneNumber(result.Data) + + case TypeAuthorizationStateWaitCode: + return UnmarshalAuthorizationStateWaitCode(result.Data) + + case TypeAuthorizationStateWaitOtherDeviceConfirmation: + return UnmarshalAuthorizationStateWaitOtherDeviceConfirmation(result.Data) + + case TypeAuthorizationStateWaitRegistration: + return UnmarshalAuthorizationStateWaitRegistration(result.Data) + + case TypeAuthorizationStateWaitPassword: + return UnmarshalAuthorizationStateWaitPassword(result.Data) + + case TypeAuthorizationStateReady: + return UnmarshalAuthorizationStateReady(result.Data) + + case TypeAuthorizationStateLoggingOut: + return UnmarshalAuthorizationStateLoggingOut(result.Data) + + case TypeAuthorizationStateClosing: + return UnmarshalAuthorizationStateClosing(result.Data) + + case TypeAuthorizationStateClosed: + return UnmarshalAuthorizationStateClosed(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type SetTdlibParametersRequest struct { + // Parameters + Parameters *TdlibParameters `json:"parameters"` +} + +// Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters +func (client *Client) SetTdlibParameters(req *SetTdlibParametersRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setTdlibParameters", + }, + Data: map[string]interface{}{ + "parameters": req.Parameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CheckDatabaseEncryptionKeyRequest struct { + // Encryption key to check or set up + EncryptionKey []byte `json:"encryption_key"` +} + +// Checks the database encryption key for correctness. Works only when the current authorization state is authorizationStateWaitEncryptionKey +func (client *Client) CheckDatabaseEncryptionKey(req *CheckDatabaseEncryptionKeyRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkDatabaseEncryptionKey", + }, + Data: map[string]interface{}{ + "encryption_key": req.EncryptionKey, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetAuthenticationPhoneNumberRequest struct { + // The phone number of the user, in international format + PhoneNumber string `json:"phone_number"` + // Settings for the authentication of the user's phone number + Settings *PhoneNumberAuthenticationSettings `json:"settings"` +} + +// Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +func (client *Client) SetAuthenticationPhoneNumber(req *SetAuthenticationPhoneNumberRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setAuthenticationPhoneNumber", + }, + Data: map[string]interface{}{ + "phone_number": req.PhoneNumber, + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Re-sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode and the next_code_type of the result is not null +func (client *Client) ResendAuthenticationCode() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendAuthenticationCode", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CheckAuthenticationCodeRequest struct { + // The verification code received via SMS, Telegram message, phone call, or flash call + Code string `json:"code"` +} + +// Checks the authentication code. Works only when the current authorization state is authorizationStateWaitCode +func (client *Client) CheckAuthenticationCode(req *CheckAuthenticationCodeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkAuthenticationCode", + }, + Data: map[string]interface{}{ + "code": req.Code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RequestQrCodeAuthenticationRequest struct { + // List of user identifiers of other users currently using the application + OtherUserIds []int32 `json:"other_user_ids"` +} + +// Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +func (client *Client) RequestQrCodeAuthentication(req *RequestQrCodeAuthenticationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "requestQrCodeAuthentication", + }, + Data: map[string]interface{}{ + "other_user_ids": req.OtherUserIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RegisterUserRequest struct { + // The first name of the user; 1-64 characters + FirstName string `json:"first_name"` + // The last name of the user; 0-64 characters + LastName string `json:"last_name"` +} + +// Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration +func (client *Client) RegisterUser(req *RegisterUserRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "registerUser", + }, + Data: map[string]interface{}{ + "first_name": req.FirstName, + "last_name": req.LastName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CheckAuthenticationPasswordRequest struct { + // The password to check + Password string `json:"password"` +} + +// Checks the authentication password for correctness. Works only when the current authorization state is authorizationStateWaitPassword +func (client *Client) CheckAuthenticationPassword(req *CheckAuthenticationPasswordRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkAuthenticationPassword", + }, + Data: map[string]interface{}{ + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Requests to send a password recovery code to an email address that was previously set up. Works only when the current authorization state is authorizationStateWaitPassword +func (client *Client) RequestAuthenticationPasswordRecovery() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "requestAuthenticationPasswordRecovery", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RecoverAuthenticationPasswordRequest struct { + // Recovery code to check + RecoveryCode string `json:"recovery_code"` +} + +// Recovers the password with a password recovery code sent to an email address that was previously set up. Works only when the current authorization state is authorizationStateWaitPassword +func (client *Client) RecoverAuthenticationPassword(req *RecoverAuthenticationPasswordRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "recoverAuthenticationPassword", + }, + Data: map[string]interface{}{ + "recovery_code": req.RecoveryCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CheckAuthenticationBotTokenRequest struct { + // The bot token + Token string `json:"token"` +} + +// Checks the authentication token of a bot; to log in as a bot. Works only when the current authorization state is authorizationStateWaitPhoneNumber. Can be used instead of setAuthenticationPhoneNumber and checkAuthenticationCode to log in +func (client *Client) CheckAuthenticationBotToken(req *CheckAuthenticationBotTokenRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkAuthenticationBotToken", + }, + Data: map[string]interface{}{ + "token": req.Token, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Closes the TDLib instance after a proper logout. Requires an available network connection. All local data will be destroyed. After the logout completes, updateAuthorizationState with authorizationStateClosed will be sent +func (client *Client) LogOut() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "logOut", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Closes the TDLib instance. All databases will be flushed to disk and properly closed. After the close completes, updateAuthorizationState with authorizationStateClosed will be sent. Can be called before initialization +func (client *Client) Close() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "close", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Closes the TDLib instance, destroying all local data without a proper logout. The current user session will remain in the list of all active sessions. All local data will be destroyed. After the destruction completes updateAuthorizationState with authorizationStateClosed will be sent. Can be called before authorization +func (client *Client) Destroy() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "destroy", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ConfirmQrCodeAuthenticationRequest struct { + // A link from a QR code. The link must be scanned by the in-app camera + Link string `json:"link"` +} + +// Confirms QR code authentication on another device. Returns created session on success +func (client *Client) ConfirmQrCodeAuthentication(req *ConfirmQrCodeAuthenticationRequest) (*Session, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "confirmQrCodeAuthentication", + }, + Data: map[string]interface{}{ + "link": req.Link, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSession(result.Data) +} + +// Returns all updates needed to restore current TDLib state, i.e. all actual UpdateAuthorizationState/UpdateUser/UpdateNewChat and others. This is especially useful if TDLib is run in a separate process. Can be called before initialization +func (client *Client) GetCurrentState() (*Updates, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getCurrentState", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUpdates(result.Data) +} + +type SetDatabaseEncryptionKeyRequest struct { + // New encryption key + NewEncryptionKey []byte `json:"new_encryption_key"` +} + +// Changes the database encryption key. Usually the encryption key is never changed and is stored in some OS keychain +func (client *Client) SetDatabaseEncryptionKey(req *SetDatabaseEncryptionKeyRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setDatabaseEncryptionKey", + }, + Data: map[string]interface{}{ + "new_encryption_key": req.NewEncryptionKey, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns the current state of 2-step verification +func (client *Client) GetPasswordState() (*PasswordState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPasswordState", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPasswordState(result.Data) +} + +type SetPasswordRequest struct { + // Previous password of the user + OldPassword string `json:"old_password"` + // New password of the user; may be empty to remove the password + NewPassword string `json:"new_password"` + // New password hint; may be empty + NewHint string `json:"new_hint"` + // Pass true if the recovery email address should be changed + SetRecoveryEmailAddress bool `json:"set_recovery_email_address"` + // New recovery email address; may be empty + NewRecoveryEmailAddress string `json:"new_recovery_email_address"` +} + +// Changes the password for the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed +func (client *Client) SetPassword(req *SetPasswordRequest) (*PasswordState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPassword", + }, + Data: map[string]interface{}{ + "old_password": req.OldPassword, + "new_password": req.NewPassword, + "new_hint": req.NewHint, + "set_recovery_email_address": req.SetRecoveryEmailAddress, + "new_recovery_email_address": req.NewRecoveryEmailAddress, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPasswordState(result.Data) +} + +type GetRecoveryEmailAddressRequest struct { + // The password for the current user + Password string `json:"password"` +} + +// Returns a 2-step verification recovery email address that was previously set up. This method can be used to verify a password provided by the user +func (client *Client) GetRecoveryEmailAddress(req *GetRecoveryEmailAddressRequest) (*RecoveryEmailAddress, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getRecoveryEmailAddress", + }, + Data: map[string]interface{}{ + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalRecoveryEmailAddress(result.Data) +} + +type SetRecoveryEmailAddressRequest struct { + // Password of the current user + Password string `json:"password"` + // New recovery email address + NewRecoveryEmailAddress string `json:"new_recovery_email_address"` +} + +// Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed. If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation +func (client *Client) SetRecoveryEmailAddress(req *SetRecoveryEmailAddressRequest) (*PasswordState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setRecoveryEmailAddress", + }, + Data: map[string]interface{}{ + "password": req.Password, + "new_recovery_email_address": req.NewRecoveryEmailAddress, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPasswordState(result.Data) +} + +type CheckRecoveryEmailAddressCodeRequest struct { + // Verification code + Code string `json:"code"` +} + +// Checks the 2-step verification recovery email address verification code +func (client *Client) CheckRecoveryEmailAddressCode(req *CheckRecoveryEmailAddressCodeRequest) (*PasswordState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkRecoveryEmailAddressCode", + }, + Data: map[string]interface{}{ + "code": req.Code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPasswordState(result.Data) +} + +// Resends the 2-step verification recovery email address verification code +func (client *Client) ResendRecoveryEmailAddressCode() (*PasswordState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendRecoveryEmailAddressCode", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPasswordState(result.Data) +} + +// Requests to send a password recovery code to an email address that was previously set up +func (client *Client) RequestPasswordRecovery() (*EmailAddressAuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "requestPasswordRecovery", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmailAddressAuthenticationCodeInfo(result.Data) +} + +type RecoverPasswordRequest struct { + // Recovery code to check + RecoveryCode string `json:"recovery_code"` +} + +// Recovers the password using a recovery code sent to an email address that was previously set up +func (client *Client) RecoverPassword(req *RecoverPasswordRequest) (*PasswordState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "recoverPassword", + }, + Data: map[string]interface{}{ + "recovery_code": req.RecoveryCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPasswordState(result.Data) +} + +type CreateTemporaryPasswordRequest struct { + // Persistent user password + Password string `json:"password"` + // Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 + ValidFor int32 `json:"valid_for"` +} + +// Creates a new temporary password for processing payments +func (client *Client) CreateTemporaryPassword(req *CreateTemporaryPasswordRequest) (*TemporaryPasswordState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createTemporaryPassword", + }, + Data: map[string]interface{}{ + "password": req.Password, + "valid_for": req.ValidFor, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTemporaryPasswordState(result.Data) +} + +// Returns information about the current temporary password +func (client *Client) GetTemporaryPasswordState() (*TemporaryPasswordState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTemporaryPasswordState", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTemporaryPasswordState(result.Data) +} + +// Returns the current user +func (client *Client) GetMe() (*User, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMe", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUser(result.Data) +} + +type GetUserRequest struct { + // User identifier + UserId int32 `json:"user_id"` +} + +// Returns information about a user by their identifier. This is an offline request if the current user is not a bot +func (client *Client) GetUser(req *GetUserRequest) (*User, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUser", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUser(result.Data) +} + +type GetUserFullInfoRequest struct { + // User identifier + UserId int32 `json:"user_id"` +} + +// Returns full information about a user by their identifier +func (client *Client) GetUserFullInfo(req *GetUserFullInfoRequest) (*UserFullInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUserFullInfo", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUserFullInfo(result.Data) +} + +type GetBasicGroupRequest struct { + // Basic group identifier + BasicGroupId int32 `json:"basic_group_id"` +} + +// Returns information about a basic group by its identifier. This is an offline request if the current user is not a bot +func (client *Client) GetBasicGroup(req *GetBasicGroupRequest) (*BasicGroup, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBasicGroup", + }, + Data: map[string]interface{}{ + "basic_group_id": req.BasicGroupId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBasicGroup(result.Data) +} + +type GetBasicGroupFullInfoRequest struct { + // Basic group identifier + BasicGroupId int32 `json:"basic_group_id"` +} + +// Returns full information about a basic group by its identifier +func (client *Client) GetBasicGroupFullInfo(req *GetBasicGroupFullInfoRequest) (*BasicGroupFullInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBasicGroupFullInfo", + }, + Data: map[string]interface{}{ + "basic_group_id": req.BasicGroupId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBasicGroupFullInfo(result.Data) +} + +type GetSupergroupRequest struct { + // Supergroup or channel identifier + SupergroupId int32 `json:"supergroup_id"` +} + +// Returns information about a supergroup or a channel by its identifier. This is an offline request if the current user is not a bot +func (client *Client) GetSupergroup(req *GetSupergroupRequest) (*Supergroup, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSupergroup", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSupergroup(result.Data) +} + +type GetSupergroupFullInfoRequest struct { + // Supergroup or channel identifier + SupergroupId int32 `json:"supergroup_id"` +} + +// Returns full information about a supergroup or a channel by its identifier, cached for up to 1 minute +func (client *Client) GetSupergroupFullInfo(req *GetSupergroupFullInfoRequest) (*SupergroupFullInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSupergroupFullInfo", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSupergroupFullInfo(result.Data) +} + +type GetSecretChatRequest struct { + // Secret chat identifier + SecretChatId int32 `json:"secret_chat_id"` +} + +// Returns information about a secret chat by its identifier. This is an offline request +func (client *Client) GetSecretChat(req *GetSecretChatRequest) (*SecretChat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSecretChat", + }, + Data: map[string]interface{}{ + "secret_chat_id": req.SecretChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSecretChat(result.Data) +} + +type GetChatRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns information about a chat by its identifier, this is an offline request if the current user is not a bot +func (client *Client) GetChat(req *GetChatRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type GetMessageRequest struct { + // Identifier of the chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message to get + MessageId int64 `json:"message_id"` +} + +// Returns information about a message +func (client *Client) GetMessage(req *GetMessageRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type GetMessageLocallyRequest struct { + // Identifier of the chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message to get + MessageId int64 `json:"message_id"` +} + +// Returns information about a message, if it is available locally without sending network request. This is an offline request +func (client *Client) GetMessageLocally(req *GetMessageLocallyRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageLocally", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type GetRepliedMessageRequest struct { + // Identifier of the chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message reply to which to get + MessageId int64 `json:"message_id"` +} + +// Returns information about a message that is replied by a given message. Also returns the pinned message, the game message, and the invoice message for messages of the types messagePinMessage, messageGameScore, and messagePaymentSuccessful respectively +func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getRepliedMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type GetChatPinnedMessageRequest struct { + // Identifier of the chat the message belongs to + ChatId int64 `json:"chat_id"` +} + +// Returns information about a newest pinned message in the chat +func (client *Client) GetChatPinnedMessage(req *GetChatPinnedMessageRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatPinnedMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type GetCallbackQueryMessageRequest struct { + // Identifier of the chat the message belongs to + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // Identifier of the callback query + CallbackQueryId JsonInt64 `json:"callback_query_id"` +} + +// Returns information about a message with the callback button that originated a callback query; for bots only +func (client *Client) GetCallbackQueryMessage(req *GetCallbackQueryMessageRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getCallbackQueryMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "callback_query_id": req.CallbackQueryId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type GetMessagesRequest struct { + // Identifier of the chat the messages belong to + ChatId int64 `json:"chat_id"` + // Identifiers of the messages to get + MessageIds []int64 `json:"message_ids"` +} + +// Returns information about messages. If a message is not found, returns null on the corresponding position of the result +func (client *Client) GetMessages(req *GetMessagesRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_ids": req.MessageIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type GetMessageThreadRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns information about a message thread. Can be used only if message.can_get_message_thread == true +func (client *Client) GetMessageThread(req *GetMessageThreadRequest) (*MessageThreadInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageThread", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageThreadInfo(result.Data) +} + +type GetFileRequest struct { + // Identifier of the file to get + FileId int32 `json:"file_id"` +} + +// Returns information about a file; this is an offline request +func (client *Client) GetFile(req *GetFileRequest) (*File, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getFile", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFile(result.Data) +} + +type GetRemoteFileRequest struct { + // Remote identifier of the file to get + RemoteFileId string `json:"remote_file_id"` + // File type, if known + FileType FileType `json:"file_type"` +} + +// Returns information about a file by its remote ID; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application +func (client *Client) GetRemoteFile(req *GetRemoteFileRequest) (*File, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getRemoteFile", + }, + Data: map[string]interface{}{ + "remote_file_id": req.RemoteFileId, + "file_type": req.FileType, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFile(result.Data) +} + +type GetChatsRequest struct { + // The chat list in which to return chats + ChatList ChatList `json:"chat_list"` + // Chat order to return chats from + OffsetOrder JsonInt64 `json:"offset_order"` + // Chat identifier to return chats from + OffsetChatId int64 `json:"offset_chat_id"` + // The maximum number of chats to be returned. It is possible that fewer chats than the limit are returned even if the end of the list is not reached + Limit int32 `json:"limit"` +} + +// Returns an ordered list of chats in a chat list. Chats are sorted by the pair (chat.position.order, chat.id) in descending order. (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed 64-bit number 9223372036854775807 == 2^63 - 1). For optimal performance the number of returned chats is chosen by the library +func (client *Client) GetChats(req *GetChatsRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChats", + }, + Data: map[string]interface{}{ + "chat_list": req.ChatList, + "offset_order": req.OffsetOrder, + "offset_chat_id": req.OffsetChatId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type SearchPublicChatRequest struct { + // Username to be resolved + Username string `json:"username"` +} + +// Searches a public chat by its username. Currently only private chats, supergroups and channels can be public. Returns the chat if found; otherwise an error is returned +func (client *Client) SearchPublicChat(req *SearchPublicChatRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicChat", + }, + Data: map[string]interface{}{ + "username": req.Username, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type SearchPublicChatsRequest struct { + // Query to search for + Query string `json:"query"` +} + +// Searches public chats by looking for specified query in their username and title. Currently only private chats, supergroups and channels can be public. Returns a meaningful number of results. Returns nothing if the length of the searched username prefix is less than 5. Excludes private chats with contacts and chats from the chat list from the results +func (client *Client) SearchPublicChats(req *SearchPublicChatsRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicChats", + }, + Data: map[string]interface{}{ + "query": req.Query, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type SearchChatsRequest struct { + // Query to search for. If the query is empty, returns up to 20 recently found chats + Query string `json:"query"` + // The maximum number of chats to be returned + Limit int32 `json:"limit"` +} + +// Searches for the specified query in the title and username of already known chats, this is an offline request. Returns chats in the order seen in the main chat list +func (client *Client) SearchChats(req *SearchChatsRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchChats", + }, + Data: map[string]interface{}{ + "query": req.Query, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type SearchChatsOnServerRequest struct { + // Query to search for + Query string `json:"query"` + // The maximum number of chats to be returned + Limit int32 `json:"limit"` +} + +// Searches for the specified query in the title and username of already known chats via request to the server. Returns chats in the order seen in the main chat list +func (client *Client) SearchChatsOnServer(req *SearchChatsOnServerRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchChatsOnServer", + }, + Data: map[string]interface{}{ + "query": req.Query, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type SearchChatsNearbyRequest struct { + // Current user location + Location *Location `json:"location"` +} + +// Returns a list of users and location-based supergroups nearby. The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby. The request should be sent again every 25 seconds with adjusted location to not miss new chats +func (client *Client) SearchChatsNearby(req *SearchChatsNearbyRequest) (*ChatsNearby, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchChatsNearby", + }, + Data: map[string]interface{}{ + "location": req.Location, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatsNearby(result.Data) +} + +type GetTopChatsRequest struct { + // Category of chats to be returned + Category TopChatCategory `json:"category"` + // The maximum number of chats to be returned; up to 30 + Limit int32 `json:"limit"` +} + +// Returns a list of frequently used chats. Supported only if the chat info database is enabled +func (client *Client) GetTopChats(req *GetTopChatsRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTopChats", + }, + Data: map[string]interface{}{ + "category": req.Category, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type RemoveTopChatRequest struct { + // Category of frequently used chats + Category TopChatCategory `json:"category"` + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Removes a chat from the list of frequently used chats. Supported only if the chat info database is enabled +func (client *Client) RemoveTopChat(req *RemoveTopChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeTopChat", + }, + Data: map[string]interface{}{ + "category": req.Category, + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddRecentlyFoundChatRequest struct { + // Identifier of the chat to add + ChatId int64 `json:"chat_id"` +} + +// Adds a chat to the list of recently found chats. The chat is added to the beginning of the list. If the chat is already in the list, it will be removed from the list first +func (client *Client) AddRecentlyFoundChat(req *AddRecentlyFoundChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addRecentlyFoundChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveRecentlyFoundChatRequest struct { + // Identifier of the chat to be removed + ChatId int64 `json:"chat_id"` +} + +// Removes a chat from the list of recently found chats +func (client *Client) RemoveRecentlyFoundChat(req *RemoveRecentlyFoundChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeRecentlyFoundChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Clears the list of recently found chats +func (client *Client) ClearRecentlyFoundChats() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clearRecentlyFoundChats", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CheckChatUsernameRequest struct { + // Chat identifier; should be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if chat is being created + ChatId int64 `json:"chat_id"` + // Username to be checked + Username string `json:"username"` +} + +// Checks whether a username can be set for a chat +func (client *Client) CheckChatUsername(req *CheckChatUsernameRequest) (CheckChatUsernameResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkChatUsername", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "username": req.Username, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeCheckChatUsernameResultOk: + return UnmarshalCheckChatUsernameResultOk(result.Data) + + case TypeCheckChatUsernameResultUsernameInvalid: + return UnmarshalCheckChatUsernameResultUsernameInvalid(result.Data) + + case TypeCheckChatUsernameResultUsernameOccupied: + return UnmarshalCheckChatUsernameResultUsernameOccupied(result.Data) + + case TypeCheckChatUsernameResultPublicChatsTooMuch: + return UnmarshalCheckChatUsernameResultPublicChatsTooMuch(result.Data) + + case TypeCheckChatUsernameResultPublicGroupsUnavailable: + return UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type GetCreatedPublicChatsRequest struct { + // Type of the public chats to return + Type PublicChatType `json:"type"` +} + +// Returns a list of public chats of the specified type, owned by the user +func (client *Client) GetCreatedPublicChats(req *GetCreatedPublicChatsRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getCreatedPublicChats", + }, + Data: map[string]interface{}{ + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type CheckCreatedPublicChatsLimitRequest struct { + // Type of the public chats, for which to check the limit + Type PublicChatType `json:"type"` +} + +// Checks whether the maximum number of owned public chats has been reached. Returns corresponding error if the limit was reached +func (client *Client) CheckCreatedPublicChatsLimit(req *CheckCreatedPublicChatsLimitRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkCreatedPublicChatsLimit", + }, + Data: map[string]interface{}{ + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns a list of basic group and supergroup chats, which can be used as a discussion group for a channel. Returned basic group chats must be first upgraded to supergroups before they can be set as a discussion group. To set a returned supergroup as a discussion group, access to its old messages must be enabled using toggleSupergroupIsAllHistoryAvailable first +func (client *Client) GetSuitableDiscussionChats() (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSuitableDiscussionChats", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +// Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error +func (client *Client) GetInactiveSupergroupChats() (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getInactiveSupergroupChats", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type GetGroupsInCommonRequest struct { + // User identifier + UserId int32 `json:"user_id"` + // Chat identifier starting from which to return chats; use 0 for the first request + OffsetChatId int64 `json:"offset_chat_id"` + // The maximum number of chats to be returned; up to 100 + Limit int32 `json:"limit"` +} + +// Returns a list of common group chats with a given user. Chats are sorted by their type and creation date +func (client *Client) GetGroupsInCommon(req *GetGroupsInCommonRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGroupsInCommon", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "offset_chat_id": req.OffsetChatId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type GetChatHistoryRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages + Offset int32 `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached + Limit int32 `json:"limit"` + // If true, returns only messages that are available locally without sending network requests + OnlyLocal bool `json:"only_local"` +} + +// Returns messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library. This is an offline request if only_local is true +func (client *Client) GetChatHistory(req *GetChatHistoryRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + "only_local": req.OnlyLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type GetMessageThreadHistoryRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier, which thread history needs to be returned + MessageId int64 `json:"message_id"` + // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages + Offset int32 `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. Fewer messages may be returned than specified by the limit, even if the end of the message thread history has not been reached + Limit int32 `json:"limit"` +} + +// Returns messages in a message thread of a message. Can be used only if message.can_get_message_thread == true. Message thread of a channel message is in the channel's linked supergroup. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library +func (client *Client) GetMessageThreadHistory(req *GetMessageThreadHistoryRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageThreadHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type DeleteChatHistoryRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Pass true if the chat should be removed from the chat list + RemoveFromChatList bool `json:"remove_from_chat_list"` + // Pass true to try to delete chat history for all users + Revoke bool `json:"revoke"` +} + +// Deletes all messages in the chat. Use Chat.can_be_deleted_only_for_self and Chat.can_be_deleted_for_all_users fields to find whether and how the method can be applied to the chat +func (client *Client) DeleteChatHistory(req *DeleteChatHistoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteChatHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "remove_from_chat_list": req.RemoveFromChatList, + "revoke": req.Revoke, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SearchChatMessagesRequest struct { + // Identifier of the chat in which to search messages + ChatId int64 `json:"chat_id"` + // Query to search for + Query string `json:"query"` + // If not null, only messages sent by the specified sender will be returned. Not supported in secret chats + Sender MessageSender `json:"sender"` + // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages + Offset int32 `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached + Limit int32 `json:"limit"` + // Filter for message content in the search results + Filter SearchMessagesFilter `json:"filter"` + // If not 0, only messages in the specified thread will be returned; supergroups only + MessageThreadId int64 `json:"message_thread_id"` +} + +// Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages should be used instead), or without an enabled message database. For optimal performance the number of returned messages is chosen by the library +func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchChatMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "query": req.Query, + "sender": req.Sender, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + "filter": req.Filter, + "message_thread_id": req.MessageThreadId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type SearchMessagesRequest struct { + // Chat list in which to search messages; pass null to search in all chats regardless of their chat list + ChatList ChatList `json:"chat_list"` + // Query to search for + Query string `json:"query"` + // The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the last message + OffsetDate int32 `json:"offset_date"` + // The chat identifier of the last found message, or 0 for the first request + OffsetChatId int64 `json:"offset_chat_id"` + // The message identifier of the last found message, or 0 for the first request + OffsetMessageId int64 `json:"offset_message_id"` + // The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached + Limit int32 `json:"limit"` + // Filter for message content in the search results; searchMessagesFilterCall, searchMessagesFilterMissedCall, searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterFailedToSend and searchMessagesFilterPinned are unsupported in this function + Filter SearchMessagesFilter `json:"filter"` + // If not 0, the minimum date of the messages to return + MinDate int32 `json:"min_date"` + // If not 0, the maximum date of the messages to return + MaxDate int32 `json:"max_date"` +} + +// Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). For optimal performance the number of returned messages is chosen by the library +func (client *Client) SearchMessages(req *SearchMessagesRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchMessages", + }, + Data: map[string]interface{}{ + "chat_list": req.ChatList, + "query": req.Query, + "offset_date": req.OffsetDate, + "offset_chat_id": req.OffsetChatId, + "offset_message_id": req.OffsetMessageId, + "limit": req.Limit, + "filter": req.Filter, + "min_date": req.MinDate, + "max_date": req.MaxDate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type SearchSecretMessagesRequest struct { + // Identifier of the chat in which to search. Specify 0 to search in all secret chats + ChatId int64 `json:"chat_id"` + // Query to search for. If empty, searchChatMessages should be used instead + Query string `json:"query"` + // Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results + Offset string `json:"offset"` + // The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached + Limit int32 `json:"limit"` + // A filter for message content in the search results + Filter SearchMessagesFilter `json:"filter"` +} + +// Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance the number of returned messages is chosen by the library +func (client *Client) SearchSecretMessages(req *SearchSecretMessagesRequest) (*FoundMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchSecretMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "query": req.Query, + "offset": req.Offset, + "limit": req.Limit, + "filter": req.Filter, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundMessages(result.Data) +} + +type SearchCallMessagesRequest struct { + // Identifier of the message from which to search; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached + Limit int32 `json:"limit"` + // If true, returns only messages with missed calls + OnlyMissed bool `json:"only_missed"` +} + +// Searches for call messages. Returns the results in reverse chronological order (i. e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library +func (client *Client) SearchCallMessages(req *SearchCallMessagesRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchCallMessages", + }, + Data: map[string]interface{}{ + "from_message_id": req.FromMessageId, + "limit": req.Limit, + "only_missed": req.OnlyMissed, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type SearchChatRecentLocationMessagesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // The maximum number of messages to be returned + Limit int32 `json:"limit"` +} + +// Returns information about the recent locations of chat members that were sent to the chat. Returns up to 1 location message per user +func (client *Client) SearchChatRecentLocationMessages(req *SearchChatRecentLocationMessagesRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchChatRecentLocationMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +// Returns all active live locations that should be updated by the application. The list is persistent across application restarts only if the message database is used +func (client *Client) GetActiveLiveLocationMessages() (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getActiveLiveLocationMessages", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type GetChatMessageByDateRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Point in time (Unix timestamp) relative to which to search for messages + Date int32 `json:"date"` +} + +// Returns the last message sent in a chat no later than the specified date +func (client *Client) GetChatMessageByDate(req *GetChatMessageByDateRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatMessageByDate", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "date": req.Date, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type GetChatMessageCountRequest struct { + // Identifier of the chat in which to count messages + ChatId int64 `json:"chat_id"` + // Filter for message content; searchMessagesFilterEmpty is unsupported in this function + Filter SearchMessagesFilter `json:"filter"` + // If true, returns count that is available locally without sending network requests, returning -1 if the number of messages is unknown + ReturnLocal bool `json:"return_local"` +} + +// Returns approximate number of messages of the specified type in the chat +func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Count, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatMessageCount", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "filter": req.Filter, + "return_local": req.ReturnLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCount(result.Data) +} + +type GetChatScheduledMessagesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) +func (client *Client) GetChatScheduledMessages(req *GetChatScheduledMessagesRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatScheduledMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type GetMessagePublicForwardsRequest struct { + // Chat identifier of the message + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results + Offset string `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. Fewer messages may be returned than specified by the limit, even if the end of the list has not been reached + Limit int32 `json:"limit"` +} + +// Returns forwarded copies of a channel message to different public channels. For optimal performance the number of returned messages is chosen by the library +func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequest) (*FoundMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessagePublicForwards", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundMessages(result.Data) +} + +type RemoveNotificationRequest struct { + // Identifier of notification group to which the notification belongs + NotificationGroupId int32 `json:"notification_group_id"` + // Identifier of removed notification + NotificationId int32 `json:"notification_id"` +} + +// Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user +func (client *Client) RemoveNotification(req *RemoveNotificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeNotification", + }, + Data: map[string]interface{}{ + "notification_group_id": req.NotificationGroupId, + "notification_id": req.NotificationId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveNotificationGroupRequest struct { + // Notification group identifier + NotificationGroupId int32 `json:"notification_group_id"` + // The maximum identifier of removed notifications + MaxNotificationId int32 `json:"max_notification_id"` +} + +// Removes a group of active notifications. Needs to be called only if the notification group is removed by the current user +func (client *Client) RemoveNotificationGroup(req *RemoveNotificationGroupRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeNotificationGroup", + }, + Data: map[string]interface{}{ + "notification_group_id": req.NotificationGroupId, + "max_notification_id": req.MaxNotificationId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetMessageLinkRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // Pass true to create a link for the whole media album + ForAlbum bool `json:"for_album"` + // Pass true to create a link to the message as a channel post comment, or from a message thread + ForComment bool `json:"for_comment"` +} + +// Returns an HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels. This is an offline request +func (client *Client) GetMessageLink(req *GetMessageLinkRequest) (*MessageLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageLink", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "for_album": req.ForAlbum, + "for_comment": req.ForComment, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageLink(result.Data) +} + +type GetMessageEmbeddingCodeRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // Pass true to return an HTML code for embedding of the whole media album + ForAlbum bool `json:"for_album"` +} + +// Returns an HTML code for embedding the message. Available only for messages in supergroups and channels with a username +func (client *Client) GetMessageEmbeddingCode(req *GetMessageEmbeddingCodeRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageEmbeddingCode", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "for_album": req.ForAlbum, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type GetMessageLinkInfoRequest struct { + // The message link in the format "https://t.me/c/...", or "tg://privatepost?...", or "https://t.me/username/...", or "tg://resolve?..." + Url string `json:"url"` +} + +// Returns information about a public or private message link +func (client *Client) GetMessageLinkInfo(req *GetMessageLinkInfoRequest) (*MessageLinkInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageLinkInfo", + }, + Data: map[string]interface{}{ + "url": req.Url, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageLinkInfo(result.Data) +} + +type SendMessageRequest struct { + // Target chat + ChatId int64 `json:"chat_id"` + // If not 0, a message thread identifier in which the message will be sent + MessageThreadId int64 `json:"message_thread_id"` + // Identifier of the message to reply to or 0 + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Options to be used to send the message + Options *MessageSendOptions `json:"options"` + // Markup for replying to the message; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The content of the message to be sent + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Sends a message. Returns the sent message +func (client *Client) SendMessage(req *SendMessageRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + "reply_to_message_id": req.ReplyToMessageId, + "options": req.Options, + "reply_markup": req.ReplyMarkup, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type SendMessageAlbumRequest struct { + // Target chat + ChatId int64 `json:"chat_id"` + // If not 0, a message thread identifier in which the messages will be sent + MessageThreadId int64 `json:"message_thread_id"` + // Identifier of a message to reply to or 0 + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Options to be used to send the messages + Options *MessageSendOptions `json:"options"` + // Contents of messages to be sent + InputMessageContents []InputMessageContent `json:"input_message_contents"` +} + +// Sends messages grouped together into an album. Currently only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages +func (client *Client) SendMessageAlbum(req *SendMessageAlbumRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendMessageAlbum", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + "reply_to_message_id": req.ReplyToMessageId, + "options": req.Options, + "input_message_contents": req.InputMessageContents, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type SendBotStartMessageRequest struct { + // Identifier of the bot + BotUserId int32 `json:"bot_user_id"` + // Identifier of the target chat + ChatId int64 `json:"chat_id"` + // A hidden parameter sent to the bot for deep linking purposes (https://core.telegram.org/bots#deep-linking) + Parameter string `json:"parameter"` +} + +// Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message +func (client *Client) SendBotStartMessage(req *SendBotStartMessageRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendBotStartMessage", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "chat_id": req.ChatId, + "parameter": req.Parameter, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type SendInlineQueryResultMessageRequest struct { + // Target chat + ChatId int64 `json:"chat_id"` + // If not 0, a message thread identifier in which the message will be sent + MessageThreadId int64 `json:"message_thread_id"` + // Identifier of a message to reply to or 0 + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Options to be used to send the message + Options *MessageSendOptions `json:"options"` + // Identifier of the inline query + QueryId JsonInt64 `json:"query_id"` + // Identifier of the inline result + ResultId string `json:"result_id"` + // If true, there will be no mention of a bot, via which the message is sent. Can be used only for bots GetOption("animation_search_bot_username"), GetOption("photo_search_bot_username") and GetOption("venue_search_bot_username") + HideViaBot bool `json:"hide_via_bot"` +} + +// Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message +func (client *Client) SendInlineQueryResultMessage(req *SendInlineQueryResultMessageRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendInlineQueryResultMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + "reply_to_message_id": req.ReplyToMessageId, + "options": req.Options, + "query_id": req.QueryId, + "result_id": req.ResultId, + "hide_via_bot": req.HideViaBot, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type ForwardMessagesRequest struct { + // Identifier of the chat to which to forward messages + ChatId int64 `json:"chat_id"` + // Identifier of the chat from which to forward messages + FromChatId int64 `json:"from_chat_id"` + // Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order + MessageIds []int64 `json:"message_ids"` + // Options to be used to send the messages + Options *MessageSendOptions `json:"options"` + // True, if content of the messages needs to be copied without links to the original messages. Always true if the messages are forwarded to a secret chat + SendCopy bool `json:"send_copy"` + // True, if media caption of message copies needs to be removed. Ignored if send_copy is false + RemoveCaption bool `json:"remove_caption"` +} + +// Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message +func (client *Client) ForwardMessages(req *ForwardMessagesRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "forwardMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "from_chat_id": req.FromChatId, + "message_ids": req.MessageIds, + "options": req.Options, + "send_copy": req.SendCopy, + "remove_caption": req.RemoveCaption, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type ResendMessagesRequest struct { + // Identifier of the chat to send messages + ChatId int64 `json:"chat_id"` + // Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order + MessageIds []int64 `json:"message_ids"` +} + +// Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message +func (client *Client) ResendMessages(req *ResendMessagesRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_ids": req.MessageIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type SendChatSetTtlMessageRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New TTL value, in seconds + Ttl int32 `json:"ttl"` +} + +// Changes the current TTL setting (sets a new self-destruct timer) in a secret chat and sends the corresponding message +func (client *Client) SendChatSetTtlMessage(req *SendChatSetTtlMessageRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendChatSetTtlMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "ttl": req.Ttl, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type SendChatScreenshotTakenNotificationRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats +func (client *Client) SendChatScreenshotTakenNotification(req *SendChatScreenshotTakenNotificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendChatScreenshotTakenNotification", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddLocalMessageRequest struct { + // Target chat + ChatId int64 `json:"chat_id"` + // The sender sender of the message + Sender MessageSender `json:"sender"` + // Identifier of the message to reply to or 0 + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Pass true to disable notification for the message + DisableNotification bool `json:"disable_notification"` + // The content of the message to be added + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message +func (client *Client) AddLocalMessage(req *AddLocalMessageRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addLocalMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "sender": req.Sender, + "reply_to_message_id": req.ReplyToMessageId, + "disable_notification": req.DisableNotification, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type DeleteMessagesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifiers of the messages to be deleted + MessageIds []int64 `json:"message_ids"` + // Pass true to try to delete messages for all chat members. Always true for supergroups, channels and secret chats + Revoke bool `json:"revoke"` +} + +// Deletes messages +func (client *Client) DeleteMessages(req *DeleteMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_ids": req.MessageIds, + "revoke": req.Revoke, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteChatMessagesFromUserRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // User identifier + UserId int32 `json:"user_id"` +} + +// Deletes all messages sent by the specified user to a chat. Supported only for supergroups; requires can_delete_messages administrator privileges +func (client *Client) DeleteChatMessagesFromUser(req *DeleteChatMessagesFromUserRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteChatMessagesFromUser", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type EditMessageTextRequest struct { + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New text content of the message. Should be of type InputMessageText + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side +func (client *Client) EditMessageText(req *EditMessageTextRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editMessageText", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type EditMessageLiveLocationRequest struct { + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New location content of the message; may be null. Pass null to stop sharing the live location + Location *Location `json:"location"` + // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown + Heading int32 `json:"heading"` + // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled + ProximityAlertRadius int32 `json:"proximity_alert_radius"` +} + +// Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side +func (client *Client) EditMessageLiveLocation(req *EditMessageLiveLocationRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editMessageLiveLocation", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "location": req.Location, + "heading": req.Heading, + "proximity_alert_radius": req.ProximityAlertRadius, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type EditMessageMediaRequest struct { + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Edits the content of a message with an animation, an audio, a document, a photo or a video. The media in the message can't be replaced if the message was set to self-destruct. Media can't be replaced by self-destructing media. Media in an album can be edited only to contain a photo or a video. Returns the edited message after the edit is completed on the server side +func (client *Client) EditMessageMedia(req *EditMessageMediaRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editMessageMedia", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type EditMessageCaptionRequest struct { + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New message content caption; 0-GetOption("message_caption_length_max") characters + Caption *FormattedText `json:"caption"` +} + +// Edits the message content caption. Returns the edited message after the edit is completed on the server side +func (client *Client) EditMessageCaption(req *EditMessageCaptionRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editMessageCaption", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "caption": req.Caption, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type EditMessageReplyMarkupRequest struct { + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup + ReplyMarkup ReplyMarkup `json:"reply_markup"` +} + +// Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side +func (client *Client) EditMessageReplyMarkup(req *EditMessageReplyMarkupRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editMessageReplyMarkup", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type EditInlineMessageTextRequest struct { + // Inline message identifier + InlineMessageId string `json:"inline_message_id"` + // The new message reply markup + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New text content of the message. Should be of type InputMessageText + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Edits the text of an inline text or game message sent via a bot; for bots only +func (client *Client) EditInlineMessageText(req *EditInlineMessageTextRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editInlineMessageText", + }, + Data: map[string]interface{}{ + "inline_message_id": req.InlineMessageId, + "reply_markup": req.ReplyMarkup, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type EditInlineMessageLiveLocationRequest struct { + // Inline message identifier + InlineMessageId string `json:"inline_message_id"` + // The new message reply markup + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New location content of the message; may be null. Pass null to stop sharing the live location + Location *Location `json:"location"` + // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown + Heading int32 `json:"heading"` + // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled + ProximityAlertRadius int32 `json:"proximity_alert_radius"` +} + +// Edits the content of a live location in an inline message sent via a bot; for bots only +func (client *Client) EditInlineMessageLiveLocation(req *EditInlineMessageLiveLocationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editInlineMessageLiveLocation", + }, + Data: map[string]interface{}{ + "inline_message_id": req.InlineMessageId, + "reply_markup": req.ReplyMarkup, + "location": req.Location, + "heading": req.Heading, + "proximity_alert_radius": req.ProximityAlertRadius, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type EditInlineMessageMediaRequest struct { + // Inline message identifier + InlineMessageId string `json:"inline_message_id"` + // The new message reply markup; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only +func (client *Client) EditInlineMessageMedia(req *EditInlineMessageMediaRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editInlineMessageMedia", + }, + Data: map[string]interface{}{ + "inline_message_id": req.InlineMessageId, + "reply_markup": req.ReplyMarkup, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type EditInlineMessageCaptionRequest struct { + // Inline message identifier + InlineMessageId string `json:"inline_message_id"` + // The new message reply markup + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New message content caption; 0-GetOption("message_caption_length_max") characters + Caption *FormattedText `json:"caption"` +} + +// Edits the caption of an inline message sent via a bot; for bots only +func (client *Client) EditInlineMessageCaption(req *EditInlineMessageCaptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editInlineMessageCaption", + }, + Data: map[string]interface{}{ + "inline_message_id": req.InlineMessageId, + "reply_markup": req.ReplyMarkup, + "caption": req.Caption, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type EditInlineMessageReplyMarkupRequest struct { + // Inline message identifier + InlineMessageId string `json:"inline_message_id"` + // The new message reply markup + ReplyMarkup ReplyMarkup `json:"reply_markup"` +} + +// Edits the reply markup of an inline message sent via a bot; for bots only +func (client *Client) EditInlineMessageReplyMarkup(req *EditInlineMessageReplyMarkupRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editInlineMessageReplyMarkup", + }, + Data: map[string]interface{}{ + "inline_message_id": req.InlineMessageId, + "reply_markup": req.ReplyMarkup, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type EditMessageSchedulingStateRequest struct { + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message scheduling state. Pass null to send the message immediately + SchedulingState MessageSchedulingState `json:"scheduling_state"` +} + +// Edits the time when a scheduled message will be sent. Scheduling state of all messages in the same album or forwarded together with the message will be also changed +func (client *Client) EditMessageSchedulingState(req *EditMessageSchedulingStateRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editMessageSchedulingState", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "scheduling_state": req.SchedulingState, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetTextEntitiesRequest struct { + // The text in which to look for entites + Text string `json:"text"` +} + +// Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) contained in the text. Can be called synchronously +func (client *Client) GetTextEntities(req *GetTextEntitiesRequest) (*TextEntities, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getTextEntities", + }, + Data: map[string]interface{}{ + "text": req.Text, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTextEntities(result.Data) +} + +type ParseTextEntitiesRequest struct { + // The text to parse + Text string `json:"text"` + // Text parse mode + ParseMode TextParseMode `json:"parse_mode"` +} + +// Parses Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities contained in the text. Can be called synchronously +func (client *Client) ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "parseTextEntities", + }, + Data: map[string]interface{}{ + "text": req.Text, + "parse_mode": req.ParseMode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFormattedText(result.Data) +} + +type ParseMarkdownRequest struct { + // The text to parse. For example, "__italic__ ~~strikethrough~~ **bold** `code` ```pre``` __[italic__ text_url](telegram.org) __italic**bold italic__bold**" + Text *FormattedText `json:"text"` +} + +// Parses Markdown entities in a human-friendly format, ignoring markup errors. Can be called synchronously +func (client *Client) ParseMarkdown(req *ParseMarkdownRequest) (*FormattedText, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "parseMarkdown", + }, + Data: map[string]interface{}{ + "text": req.Text, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFormattedText(result.Data) +} + +type GetMarkdownTextRequest struct { + // The text + Text *FormattedText `json:"text"` +} + +// Replaces text entities with Markdown formatting in a human-friendly format. Entities that can't be represented in Markdown unambiguously are kept as is. Can be called synchronously +func (client *Client) GetMarkdownText(req *GetMarkdownTextRequest) (*FormattedText, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getMarkdownText", + }, + Data: map[string]interface{}{ + "text": req.Text, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFormattedText(result.Data) +} + +type GetFileMimeTypeRequest struct { + // The name of the file or path to the file + FileName string `json:"file_name"` +} + +// Returns the MIME type of a file, guessed by its extension. Returns an empty string on failure. Can be called synchronously +func (client *Client) GetFileMimeType(req *GetFileMimeTypeRequest) (*Text, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getFileMimeType", + }, + Data: map[string]interface{}{ + "file_name": req.FileName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type GetFileExtensionRequest struct { + // The MIME type of the file + MimeType string `json:"mime_type"` +} + +// Returns the extension of a file, guessed by its MIME type. Returns an empty string on failure. Can be called synchronously +func (client *Client) GetFileExtension(req *GetFileExtensionRequest) (*Text, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getFileExtension", + }, + Data: map[string]interface{}{ + "mime_type": req.MimeType, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type CleanFileNameRequest struct { + // File name or path to the file + FileName string `json:"file_name"` +} + +// Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously +func (client *Client) CleanFileName(req *CleanFileNameRequest) (*Text, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "cleanFileName", + }, + Data: map[string]interface{}{ + "file_name": req.FileName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type GetLanguagePackStringRequest struct { + // Path to the language pack database in which strings are stored + LanguagePackDatabasePath string `json:"language_pack_database_path"` + // Localization target to which the language pack belongs + LocalizationTarget string `json:"localization_target"` + // Language pack identifier + LanguagePackId string `json:"language_pack_id"` + // Language pack key of the string to be returned + Key string `json:"key"` +} + +// Returns a string stored in the local database from the specified localization target and language pack by its key. Returns a 404 error if the string is not found. Can be called synchronously +func (client *Client) GetLanguagePackString(req *GetLanguagePackStringRequest) (LanguagePackStringValue, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getLanguagePackString", + }, + Data: map[string]interface{}{ + "language_pack_database_path": req.LanguagePackDatabasePath, + "localization_target": req.LocalizationTarget, + "language_pack_id": req.LanguagePackId, + "key": req.Key, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeLanguagePackStringValueOrdinary: + return UnmarshalLanguagePackStringValueOrdinary(result.Data) + + case TypeLanguagePackStringValuePluralized: + return UnmarshalLanguagePackStringValuePluralized(result.Data) + + case TypeLanguagePackStringValueDeleted: + return UnmarshalLanguagePackStringValueDeleted(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type GetJsonValueRequest struct { + // The JSON-serialized string + Json string `json:"json"` +} + +// Converts a JSON-serialized string to corresponding JsonValue object. Can be called synchronously +func (client *Client) GetJsonValue(req *GetJsonValueRequest) (JsonValue, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getJsonValue", + }, + Data: map[string]interface{}{ + "json": req.Json, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeJsonValueNull: + return UnmarshalJsonValueNull(result.Data) + + case TypeJsonValueBoolean: + return UnmarshalJsonValueBoolean(result.Data) + + case TypeJsonValueNumber: + return UnmarshalJsonValueNumber(result.Data) + + case TypeJsonValueString: + return UnmarshalJsonValueString(result.Data) + + case TypeJsonValueArray: + return UnmarshalJsonValueArray(result.Data) + + case TypeJsonValueObject: + return UnmarshalJsonValueObject(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type GetJsonStringRequest struct { + // The JsonValue object + JsonValue JsonValue `json:"json_value"` +} + +// Converts a JsonValue object to corresponding JSON-serialized string. Can be called synchronously +func (client *Client) GetJsonString(req *GetJsonStringRequest) (*Text, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getJsonString", + }, + Data: map[string]interface{}{ + "json_value": req.JsonValue, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type SetPollAnswerRequest struct { + // Identifier of the chat to which the poll belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the poll + MessageId int64 `json:"message_id"` + // 0-based identifiers of answer options, chosen by the user. User can choose more than 1 answer option only is the poll allows multiple answers + OptionIds []int32 `json:"option_ids"` +} + +// Changes the user answer to a poll. A poll in quiz mode can be answered only once +func (client *Client) SetPollAnswer(req *SetPollAnswerRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPollAnswer", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "option_ids": req.OptionIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetPollVotersRequest struct { + // Identifier of the chat to which the poll belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the poll + MessageId int64 `json:"message_id"` + // 0-based identifier of the answer option + OptionId int32 `json:"option_id"` + // Number of users to skip in the result; must be non-negative + Offset int32 `json:"offset"` + // The maximum number of users to be returned; must be positive and can't be greater than 50. Fewer users may be returned than specified by the limit, even if the end of the voter list has not been reached + Limit int32 `json:"limit"` +} + +// Returns users voted for the specified option in a non-anonymous polls. For the optimal performance the number of returned users is chosen by the library +func (client *Client) GetPollVoters(req *GetPollVotersRequest) (*Users, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPollVoters", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "option_id": req.OptionId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUsers(result.Data) +} + +type StopPollRequest struct { + // Identifier of the chat to which the poll belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the poll + MessageId int64 `json:"message_id"` + // The new message reply markup; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` +} + +// Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set +func (client *Client) StopPoll(req *StopPollRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "stopPoll", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type HideSuggestedActionRequest struct { + // Suggested action to hide + Action SuggestedAction `json:"action"` +} + +// Hides a suggested action +func (client *Client) HideSuggestedAction(req *HideSuggestedActionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "hideSuggestedAction", + }, + Data: map[string]interface{}{ + "action": req.Action, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetLoginUrlInfoRequest struct { + // Chat identifier of the message with the button + ChatId int64 `json:"chat_id"` + // Message identifier of the message with the button + MessageId int64 `json:"message_id"` + // Button identifier + ButtonId int32 `json:"button_id"` +} + +// Returns information about a button of type inlineKeyboardButtonTypeLoginUrl. The method needs to be called when the user presses the button +func (client *Client) GetLoginUrlInfo(req *GetLoginUrlInfoRequest) (LoginUrlInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLoginUrlInfo", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "button_id": req.ButtonId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeLoginUrlInfoOpen: + return UnmarshalLoginUrlInfoOpen(result.Data) + + case TypeLoginUrlInfoRequestConfirmation: + return UnmarshalLoginUrlInfoRequestConfirmation(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type GetLoginUrlRequest struct { + // Chat identifier of the message with the button + ChatId int64 `json:"chat_id"` + // Message identifier of the message with the button + MessageId int64 `json:"message_id"` + // Button identifier + ButtonId int32 `json:"button_id"` + // True, if the user allowed the bot to send them messages + AllowWriteAccess bool `json:"allow_write_access"` +} + +// Returns an HTTP URL which can be used to automatically authorize the user on a website after clicking an inline button of type inlineKeyboardButtonTypeLoginUrl. Use the method getLoginUrlInfo to find whether a prior user confirmation is needed. If an error is returned, then the button must be handled as an ordinary URL button +func (client *Client) GetLoginUrl(req *GetLoginUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLoginUrl", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "button_id": req.ButtonId, + "allow_write_access": req.AllowWriteAccess, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + +type GetInlineQueryResultsRequest struct { + // The identifier of the target bot + BotUserId int32 `json:"bot_user_id"` + // Identifier of the chat where the query was sent + ChatId int64 `json:"chat_id"` + // Location of the user, only if needed + UserLocation *Location `json:"user_location"` + // Text of the query + Query string `json:"query"` + // Offset of the first entry to return + Offset string `json:"offset"` +} + +// Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires +func (client *Client) GetInlineQueryResults(req *GetInlineQueryResultsRequest) (*InlineQueryResults, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getInlineQueryResults", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "chat_id": req.ChatId, + "user_location": req.UserLocation, + "query": req.Query, + "offset": req.Offset, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalInlineQueryResults(result.Data) +} + +type AnswerInlineQueryRequest struct { + // Identifier of the inline query + InlineQueryId JsonInt64 `json:"inline_query_id"` + // True, if the result of the query can be cached for the specified user + IsPersonal bool `json:"is_personal"` + // The results of the query + Results []InputInlineQueryResult `json:"results"` + // Allowed time to cache the results of the query, in seconds + CacheTime int32 `json:"cache_time"` + // Offset for the next inline query; pass an empty string if there are no more results + NextOffset string `json:"next_offset"` + // If non-empty, this text should be shown on the button that opens a private chat with the bot and sends a start message to the bot with the parameter switch_pm_parameter + SwitchPmText string `json:"switch_pm_text"` + // The parameter for the bot start message + SwitchPmParameter string `json:"switch_pm_parameter"` +} + +// Sets the result of an inline query; for bots only +func (client *Client) AnswerInlineQuery(req *AnswerInlineQueryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "answerInlineQuery", + }, + Data: map[string]interface{}{ + "inline_query_id": req.InlineQueryId, + "is_personal": req.IsPersonal, + "results": req.Results, + "cache_time": req.CacheTime, + "next_offset": req.NextOffset, + "switch_pm_text": req.SwitchPmText, + "switch_pm_parameter": req.SwitchPmParameter, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetCallbackQueryAnswerRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message from which the query originated + MessageId int64 `json:"message_id"` + // Query payload + Payload CallbackQueryPayload `json:"payload"` +} + +// Sends a callback query to a bot and returns an answer. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires +func (client *Client) GetCallbackQueryAnswer(req *GetCallbackQueryAnswerRequest) (*CallbackQueryAnswer, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getCallbackQueryAnswer", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "payload": req.Payload, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCallbackQueryAnswer(result.Data) +} + +type AnswerCallbackQueryRequest struct { + // Identifier of the callback query + CallbackQueryId JsonInt64 `json:"callback_query_id"` + // Text of the answer + Text string `json:"text"` + // If true, 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"` + // Time during which the result of the query can be cached, in seconds + CacheTime int32 `json:"cache_time"` +} + +// Sets the result of a callback query; for bots only +func (client *Client) AnswerCallbackQuery(req *AnswerCallbackQueryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "answerCallbackQuery", + }, + Data: map[string]interface{}{ + "callback_query_id": req.CallbackQueryId, + "text": req.Text, + "show_alert": req.ShowAlert, + "url": req.Url, + "cache_time": req.CacheTime, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AnswerShippingQueryRequest struct { + // Identifier of the shipping query + ShippingQueryId JsonInt64 `json:"shipping_query_id"` + // Available shipping options + ShippingOptions []*ShippingOption `json:"shipping_options"` + // An error message, empty on success + ErrorMessage string `json:"error_message"` +} + +// Sets the result of a shipping query; for bots only +func (client *Client) AnswerShippingQuery(req *AnswerShippingQueryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "answerShippingQuery", + }, + Data: map[string]interface{}{ + "shipping_query_id": req.ShippingQueryId, + "shipping_options": req.ShippingOptions, + "error_message": req.ErrorMessage, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AnswerPreCheckoutQueryRequest struct { + // Identifier of the pre-checkout query + PreCheckoutQueryId JsonInt64 `json:"pre_checkout_query_id"` + // An error message, empty on success + ErrorMessage string `json:"error_message"` +} + +// Sets the result of a pre-checkout query; for bots only +func (client *Client) AnswerPreCheckoutQuery(req *AnswerPreCheckoutQueryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "answerPreCheckoutQuery", + }, + Data: map[string]interface{}{ + "pre_checkout_query_id": req.PreCheckoutQueryId, + "error_message": req.ErrorMessage, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetGameScoreRequest struct { + // The chat to which the message with the game belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // True, if the message should be edited + EditMessage bool `json:"edit_message"` + // User identifier + UserId int32 `json:"user_id"` + // The new score + Score int32 `json:"score"` + // Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table + Force bool `json:"force"` +} + +// Updates the game score of the specified user in the game; for bots only +func (client *Client) SetGameScore(req *SetGameScoreRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGameScore", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "edit_message": req.EditMessage, + "user_id": req.UserId, + "score": req.Score, + "force": req.Force, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type SetInlineGameScoreRequest struct { + // Inline message identifier + InlineMessageId string `json:"inline_message_id"` + // True, if the message should be edited + EditMessage bool `json:"edit_message"` + // User identifier + UserId int32 `json:"user_id"` + // The new score + Score int32 `json:"score"` + // Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table + Force bool `json:"force"` +} + +// Updates the game score of the specified user in a game; for bots only +func (client *Client) SetInlineGameScore(req *SetInlineGameScoreRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setInlineGameScore", + }, + Data: map[string]interface{}{ + "inline_message_id": req.InlineMessageId, + "edit_message": req.EditMessage, + "user_id": req.UserId, + "score": req.Score, + "force": req.Force, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetGameHighScoresRequest struct { + // The chat that contains the message with the game + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // User identifier + UserId int32 `json:"user_id"` +} + +// Returns the high scores for a game and some part of the high score table in the range of the specified user; for bots only +func (client *Client) GetGameHighScores(req *GetGameHighScoresRequest) (*GameHighScores, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGameHighScores", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGameHighScores(result.Data) +} + +type GetInlineGameHighScoresRequest struct { + // Inline message identifier + InlineMessageId string `json:"inline_message_id"` + // User identifier + UserId int32 `json:"user_id"` +} + +// Returns game high scores and some part of the high score table in the range of the specified user; for bots only +func (client *Client) GetInlineGameHighScores(req *GetInlineGameHighScoresRequest) (*GameHighScores, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getInlineGameHighScores", + }, + Data: map[string]interface{}{ + "inline_message_id": req.InlineMessageId, + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGameHighScores(result.Data) +} + +type DeleteChatReplyMarkupRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // The message identifier of the used keyboard + MessageId int64 `json:"message_id"` +} + +// Deletes the default reply markup from a chat. Must be called after a one-time keyboard or a ForceReply reply markup has been used. UpdateChatReplyMarkup will be sent if the reply markup will be changed +func (client *Client) DeleteChatReplyMarkup(req *DeleteChatReplyMarkupRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteChatReplyMarkup", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendChatActionRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // If not 0, a message thread identifier in which the action was performed + MessageThreadId int64 `json:"message_thread_id"` + // The action description + Action ChatAction `json:"action"` +} + +// Sends a notification about user activity in a chat +func (client *Client) SendChatAction(req *SendChatActionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendChatAction", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + "action": req.Action, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type OpenChatRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Informs TDLib that the chat is opened by the user. Many useful activities depend on the chat being opened or closed (e.g., in supergroups and channels all updates are received only for opened chats) +func (client *Client) OpenChat(req *OpenChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CloseChatRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Informs TDLib that the chat is closed by the user. Many useful activities depend on the chat being opened or closed +func (client *Client) CloseChat(req *CloseChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "closeChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ViewMessagesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // If not 0, a message thread identifier in which the messages are being viewed + MessageThreadId int64 `json:"message_thread_id"` + // The identifiers of the messages being viewed + MessageIds []int64 `json:"message_ids"` + // True, if messages in closed chats should be marked as read by the request + ForceRead bool `json:"force_read"` +} + +// Informs TDLib that messages are being viewed by the user. Many useful activities depend on whether the messages are currently being viewed or not (e.g., marking messages as read, incrementing a view counter, updating a view counter, removing deleted messages in supergroups and channels) +func (client *Client) ViewMessages(req *ViewMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "viewMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + "message_ids": req.MessageIds, + "force_read": req.ForceRead, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type OpenMessageContentRequest struct { + // Chat identifier of the message + ChatId int64 `json:"chat_id"` + // Identifier of the message with the opened content + MessageId int64 `json:"message_id"` +} + +// Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). An updateMessageContentOpened update will be generated if something has changed +func (client *Client) OpenMessageContent(req *OpenMessageContentRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openMessageContent", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReadAllChatMentionsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Marks all mentions in a chat as read +func (client *Client) ReadAllChatMentions(req *ReadAllChatMentionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readAllChatMentions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CreatePrivateChatRequest struct { + // User identifier + UserId int32 `json:"user_id"` + // If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect + Force bool `json:"force"` +} + +// Returns an existing chat corresponding to a given user +func (client *Client) CreatePrivateChat(req *CreatePrivateChatRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createPrivateChat", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "force": req.Force, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type CreateBasicGroupChatRequest struct { + // Basic group identifier + BasicGroupId int32 `json:"basic_group_id"` + // If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect + Force bool `json:"force"` +} + +// Returns an existing chat corresponding to a known basic group +func (client *Client) CreateBasicGroupChat(req *CreateBasicGroupChatRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createBasicGroupChat", + }, + Data: map[string]interface{}{ + "basic_group_id": req.BasicGroupId, + "force": req.Force, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type CreateSupergroupChatRequest struct { + // Supergroup or channel identifier + SupergroupId int32 `json:"supergroup_id"` + // If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect + Force bool `json:"force"` +} + +// Returns an existing chat corresponding to a known supergroup or channel +func (client *Client) CreateSupergroupChat(req *CreateSupergroupChatRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createSupergroupChat", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "force": req.Force, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type CreateSecretChatRequest struct { + // Secret chat identifier + SecretChatId int32 `json:"secret_chat_id"` +} + +// Returns an existing chat corresponding to a known secret chat +func (client *Client) CreateSecretChat(req *CreateSecretChatRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createSecretChat", + }, + Data: map[string]interface{}{ + "secret_chat_id": req.SecretChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type CreateNewBasicGroupChatRequest struct { + // Identifiers of users to be added to the basic group + UserIds []int32 `json:"user_ids"` + // Title of the new basic group; 1-128 characters + Title string `json:"title"` +} + +// Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat +func (client *Client) CreateNewBasicGroupChat(req *CreateNewBasicGroupChatRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createNewBasicGroupChat", + }, + Data: map[string]interface{}{ + "user_ids": req.UserIds, + "title": req.Title, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type CreateNewSupergroupChatRequest struct { + // Title of the new chat; 1-128 characters + Title string `json:"title"` + // True, if a channel chat should be created + IsChannel bool `json:"is_channel"` + // Chat description; 0-255 characters + Description string `json:"description"` + // Chat location if a location-based supergroup is being created + Location *ChatLocation `json:"location"` +} + +// Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat +func (client *Client) CreateNewSupergroupChat(req *CreateNewSupergroupChatRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createNewSupergroupChat", + }, + Data: map[string]interface{}{ + "title": req.Title, + "is_channel": req.IsChannel, + "description": req.Description, + "location": req.Location, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type CreateNewSecretChatRequest struct { + // Identifier of the target user + UserId int32 `json:"user_id"` +} + +// Creates a new secret chat. Returns the newly created chat +func (client *Client) CreateNewSecretChat(req *CreateNewSecretChatRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createNewSecretChat", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type UpgradeBasicGroupChatToSupergroupChatRequest struct { + // Identifier of the chat to upgrade + ChatId int64 `json:"chat_id"` +} + +// Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires creator privileges. Deactivates the original basic group +func (client *Client) UpgradeBasicGroupChatToSupergroupChat(req *UpgradeBasicGroupChatToSupergroupChatRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "upgradeBasicGroupChatToSupergroupChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type GetChatListsToAddChatRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns chat lists to which the chat can be added. This is an offline request +func (client *Client) GetChatListsToAddChat(req *GetChatListsToAddChatRequest) (*ChatLists, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatListsToAddChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatLists(result.Data) +} + +type AddChatToListRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // The chat list. Use getChatListsToAddChat to get suitable chat lists + ChatList ChatList `json:"chat_list"` +} + +// Adds a chat to a chat list. A chat can't be simultaneously in Main and Archive chat lists, so it is automatically removed from another one if needed +func (client *Client) AddChatToList(req *AddChatToListRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addChatToList", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "chat_list": req.ChatList, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetChatFilterRequest struct { + // Chat filter identifier + ChatFilterId int32 `json:"chat_filter_id"` +} + +// Returns information about a chat filter by its identifier +func (client *Client) GetChatFilter(req *GetChatFilterRequest) (*ChatFilter, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatFilter", + }, + Data: map[string]interface{}{ + "chat_filter_id": req.ChatFilterId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatFilter(result.Data) +} + +type CreateChatFilterRequest struct { + // Chat filter + Filter *ChatFilter `json:"filter"` +} + +// Creates new chat filter. Returns information about the created chat filter +func (client *Client) CreateChatFilter(req *CreateChatFilterRequest) (*ChatFilterInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createChatFilter", + }, + Data: map[string]interface{}{ + "filter": req.Filter, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatFilterInfo(result.Data) +} + +type EditChatFilterRequest struct { + // Chat filter identifier + ChatFilterId int32 `json:"chat_filter_id"` + // The edited chat filter + Filter *ChatFilter `json:"filter"` +} + +// Edits existing chat filter. Returns information about the edited chat filter +func (client *Client) EditChatFilter(req *EditChatFilterRequest) (*ChatFilterInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editChatFilter", + }, + Data: map[string]interface{}{ + "chat_filter_id": req.ChatFilterId, + "filter": req.Filter, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatFilterInfo(result.Data) +} + +type DeleteChatFilterRequest struct { + // Chat filter identifier + ChatFilterId int32 `json:"chat_filter_id"` +} + +// Deletes existing chat filter +func (client *Client) DeleteChatFilter(req *DeleteChatFilterRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteChatFilter", + }, + Data: map[string]interface{}{ + "chat_filter_id": req.ChatFilterId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReorderChatFiltersRequest struct { + // Identifiers of chat filters in the new correct order + ChatFilterIds []int32 `json:"chat_filter_ids"` +} + +// Changes the order of chat filters +func (client *Client) ReorderChatFilters(req *ReorderChatFiltersRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderChatFilters", + }, + Data: map[string]interface{}{ + "chat_filter_ids": req.ChatFilterIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns recommended chat filters for the current user +func (client *Client) GetRecommendedChatFilters() (*RecommendedChatFilters, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getRecommendedChatFilters", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalRecommendedChatFilters(result.Data) +} + +type GetChatFilterDefaultIconNameRequest struct { + // Chat filter + Filter *ChatFilter `json:"filter"` +} + +// Returns default icon name for a filter. Can be called synchronously +func (client *Client) GetChatFilterDefaultIconName(req *GetChatFilterDefaultIconNameRequest) (*Text, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getChatFilterDefaultIconName", + }, + Data: map[string]interface{}{ + "filter": req.Filter, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type SetChatTitleRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New title of the chat; 1-128 characters + Title string `json:"title"` +} + +// Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info rights +func (client *Client) SetChatTitle(req *SetChatTitleRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatTitle", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "title": req.Title, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatPhotoRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New chat photo. Pass null to delete the chat photo + Photo InputChatPhoto `json:"photo"` +} + +// Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info rights +func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatPhoto", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "photo": req.Photo, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatPermissionsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New non-administrator members permissions in the chat + Permissions *ChatPermissions `json:"permissions"` +} + +// Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right +func (client *Client) SetChatPermissions(req *SetChatPermissionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatPermissions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "permissions": req.Permissions, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatDraftMessageRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // If not 0, a message thread identifier in which the draft was changed + MessageThreadId int64 `json:"message_thread_id"` + // New draft message; may be null + DraftMessage *DraftMessage `json:"draft_message"` +} + +// Changes the draft message in a chat +func (client *Client) SetChatDraftMessage(req *SetChatDraftMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatDraftMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + "draft_message": req.DraftMessage, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatNotificationSettingsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New notification settings for the chat. If the chat is muted for more than 1 week, it is considered to be muted forever + NotificationSettings *ChatNotificationSettings `json:"notification_settings"` +} + +// Changes the notification settings of a chat. Notification settings of a chat with the current user (Saved Messages) can't be changed +func (client *Client) SetChatNotificationSettings(req *SetChatNotificationSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatNotificationSettings", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "notification_settings": req.NotificationSettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleChatIsMarkedAsUnreadRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of is_marked_as_unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` +} + +// Changes the marked as unread state of a chat +func (client *Client) ToggleChatIsMarkedAsUnread(req *ToggleChatIsMarkedAsUnreadRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatIsMarkedAsUnread", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_marked_as_unread": req.IsMarkedAsUnread, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleChatDefaultDisableNotificationRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of default_disable_notification + DefaultDisableNotification bool `json:"default_disable_notification"` +} + +// Changes the value of the default disable_notification parameter, used when a message is sent to a chat +func (client *Client) ToggleChatDefaultDisableNotification(req *ToggleChatDefaultDisableNotificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatDefaultDisableNotification", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "default_disable_notification": req.DefaultDisableNotification, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatClientDataRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of client_data + ClientData string `json:"client_data"` +} + +// Changes application-specific data associated with a chat +func (client *Client) SetChatClientData(req *SetChatClientDataRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatClientData", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "client_data": req.ClientData, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatDescriptionRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // New chat description; 0-255 characters + Description string `json:"description"` +} + +// Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info rights +func (client *Client) SetChatDescription(req *SetChatDescriptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatDescription", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "description": req.Description, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatDiscussionGroupRequest struct { + // Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages rights in the supergroup) + ChatId int64 `json:"chat_id"` + // Identifier of a new channel's discussion group. Use 0 to remove the discussion group. Use the method getSuitableDiscussionChats to find all suitable groups. Basic group chats must be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that + DiscussionChatId int64 `json:"discussion_chat_id"` +} + +// Changes the discussion group of a channel chat; requires can_change_info rights in the channel if it is specified +func (client *Client) SetChatDiscussionGroup(req *SetChatDiscussionGroupRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatDiscussionGroup", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "discussion_chat_id": req.DiscussionChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatLocationRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New location for the chat; must be valid and not null + Location *ChatLocation `json:"location"` +} + +// Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use +func (client *Client) SetChatLocation(req *SetChatLocationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatLocation", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "location": req.Location, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatSlowModeDelayRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New slow mode delay for the chat; must be one of 0, 10, 30, 60, 300, 900, 3600 + SlowModeDelay int32 `json:"slow_mode_delay"` +} + +// Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members rights +func (client *Client) SetChatSlowModeDelay(req *SetChatSlowModeDelayRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatSlowModeDelay", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "slow_mode_delay": req.SlowModeDelay, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type PinChatMessageRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Identifier of the new pinned message + MessageId int64 `json:"message_id"` + // True, if there should be no notification about the pinned message. Notifications are always disabled in channels and private chats + DisableNotification bool `json:"disable_notification"` + // True, if the message needs to be pinned for one side only; private chats only + OnlyForSelf bool `json:"only_for_self"` +} + +// Pins a message in a chat; requires can_pin_messages rights or can_edit_messages rights in the channel +func (client *Client) PinChatMessage(req *PinChatMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "pinChatMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "disable_notification": req.DisableNotification, + "only_for_self": req.OnlyForSelf, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type UnpinChatMessageRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Identifier of the removed pinned message + MessageId int64 `json:"message_id"` +} + +// Removes a pinned message from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel +func (client *Client) UnpinChatMessage(req *UnpinChatMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "unpinChatMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type UnpinAllChatMessagesRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` +} + +// Removes all pinned messages from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel +func (client *Client) UnpinAllChatMessages(req *UnpinAllChatMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "unpinAllChatMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type JoinChatRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Adds current user as a new member to a chat. Private and secret chats can't be joined using this method +func (client *Client) JoinChat(req *JoinChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "joinChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type LeaveChatRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Removes current user from chat members. Private and secret chats can't be left using this method +func (client *Client) LeaveChat(req *LeaveChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "leaveChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddChatMemberRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the user + UserId int32 `json:"user_id"` + // The number of earlier messages from the chat to be forwarded to the new member; up to 100. Ignored for supergroups and channels + ForwardLimit int32 `json:"forward_limit"` +} + +// Adds a new member to a chat. Members can't be added to private or secret chats. Members will not be added until the chat state has been synchronized with the server +func (client *Client) AddChatMember(req *AddChatMemberRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addChatMember", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "user_id": req.UserId, + "forward_limit": req.ForwardLimit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddChatMembersRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifiers of the users to be added to the chat + UserIds []int32 `json:"user_ids"` +} + +// Adds multiple new members to a chat. Currently this option is only available for supergroups and channels. This option can't be used to join a chat. Members can't be added to a channel if it has more than 200 members. Members will not be added until the chat state has been synchronized with the server +func (client *Client) AddChatMembers(req *AddChatMembersRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addChatMembers", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "user_ids": req.UserIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatMemberStatusRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // User identifier + UserId int32 `json:"user_id"` + // The new status of the member in the chat + Status ChatMemberStatus `json:"status"` +} + +// Changes the status of a chat member, needs appropriate privileges. This function is currently not suitable for adding new members to the chat and transferring chat ownership; instead, use addChatMember or transferChatOwnership. The chat member status will not be changed until it has been synchronized with the server +func (client *Client) SetChatMemberStatus(req *SetChatMemberStatusRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatMemberStatus", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "user_id": req.UserId, + "status": req.Status, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Checks whether the current session can be used to transfer a chat ownership to another user +func (client *Client) CanTransferOwnership() (CanTransferOwnershipResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "canTransferOwnership", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeCanTransferOwnershipResultOk: + return UnmarshalCanTransferOwnershipResultOk(result.Data) + + case TypeCanTransferOwnershipResultPasswordNeeded: + return UnmarshalCanTransferOwnershipResultPasswordNeeded(result.Data) + + case TypeCanTransferOwnershipResultPasswordTooFresh: + return UnmarshalCanTransferOwnershipResultPasswordTooFresh(result.Data) + + case TypeCanTransferOwnershipResultSessionTooFresh: + return UnmarshalCanTransferOwnershipResultSessionTooFresh(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type TransferChatOwnershipRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the user to which transfer the ownership. The ownership can't be transferred to a bot or to a deleted user + UserId int32 `json:"user_id"` + // The password of the current user + Password string `json:"password"` +} + +// Changes the owner of a chat. The current user must be a current owner of the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats +func (client *Client) TransferChatOwnership(req *TransferChatOwnershipRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "transferChatOwnership", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "user_id": req.UserId, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetChatMemberRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // User identifier + UserId int32 `json:"user_id"` +} + +// Returns information about a single member of a chat +func (client *Client) GetChatMember(req *GetChatMemberRequest) (*ChatMember, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatMember", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatMember(result.Data) +} + +type SearchChatMembersRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Query to search for + Query string `json:"query"` + // The maximum number of users to be returned + Limit int32 `json:"limit"` + // The type of users to return. By default, chatMembersFilterMembers + Filter ChatMembersFilter `json:"filter"` +} + +// Searches for a specified query in the first name, last name and username of the members of a specified chat. Requires administrator rights in channels +func (client *Client) SearchChatMembers(req *SearchChatMembersRequest) (*ChatMembers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchChatMembers", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "query": req.Query, + "limit": req.Limit, + "filter": req.Filter, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatMembers(result.Data) +} + +type GetChatAdministratorsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns a list of administrators of the chat with their custom titles +func (client *Client) GetChatAdministrators(req *GetChatAdministratorsRequest) (*ChatAdministrators, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatAdministrators", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatAdministrators(result.Data) +} + +type ClearAllDraftMessagesRequest struct { + // If true, local draft messages in secret chats will not be cleared + ExcludeSecretChats bool `json:"exclude_secret_chats"` +} + +// Clears draft messages in all chats +func (client *Client) ClearAllDraftMessages(req *ClearAllDraftMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clearAllDraftMessages", + }, + Data: map[string]interface{}{ + "exclude_secret_chats": req.ExcludeSecretChats, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetChatNotificationSettingsExceptionsRequest struct { + // If specified, only chats from the specified scope will be returned + Scope NotificationSettingsScope `json:"scope"` + // If true, also chats with non-default sound will be returned + CompareSound bool `json:"compare_sound"` +} + +// Returns list of chats with non-default notification settings +func (client *Client) GetChatNotificationSettingsExceptions(req *GetChatNotificationSettingsExceptionsRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatNotificationSettingsExceptions", + }, + Data: map[string]interface{}{ + "scope": req.Scope, + "compare_sound": req.CompareSound, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type GetScopeNotificationSettingsRequest struct { + // Types of chats for which to return the notification settings information + Scope NotificationSettingsScope `json:"scope"` +} + +// Returns the notification settings for chats of a given type +func (client *Client) GetScopeNotificationSettings(req *GetScopeNotificationSettingsRequest) (*ScopeNotificationSettings, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getScopeNotificationSettings", + }, + Data: map[string]interface{}{ + "scope": req.Scope, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalScopeNotificationSettings(result.Data) +} + +type SetScopeNotificationSettingsRequest struct { + // Types of chats for which to change the notification settings + Scope NotificationSettingsScope `json:"scope"` + // The new notification settings for the given scope + NotificationSettings *ScopeNotificationSettings `json:"notification_settings"` +} + +// Changes notification settings for chats of a given type +func (client *Client) SetScopeNotificationSettings(req *SetScopeNotificationSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setScopeNotificationSettings", + }, + Data: map[string]interface{}{ + "scope": req.Scope, + "notification_settings": req.NotificationSettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Resets all notification settings to their default values. By default, all chats are unmuted, the sound is set to "default" and message previews are shown +func (client *Client) ResetAllNotificationSettings() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resetAllNotificationSettings", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleChatIsPinnedRequest struct { + // Chat list in which to change the pinned state of the chat + ChatList ChatList `json:"chat_list"` + // Chat identifier + ChatId int64 `json:"chat_id"` + // True, if the chat is pinned + IsPinned bool `json:"is_pinned"` +} + +// Changes the pinned state of a chat. There can be up to GetOption("pinned_chat_count_max")/GetOption("pinned_archived_chat_count_max") pinned non-secret chats and the same number of secret chats in the main/arhive chat list +func (client *Client) ToggleChatIsPinned(req *ToggleChatIsPinnedRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatIsPinned", + }, + Data: map[string]interface{}{ + "chat_list": req.ChatList, + "chat_id": req.ChatId, + "is_pinned": req.IsPinned, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetPinnedChatsRequest struct { + // Chat list in which to change the order of pinned chats + ChatList ChatList `json:"chat_list"` + // The new list of pinned chats + ChatIds []int64 `json:"chat_ids"` +} + +// Changes the order of pinned chats +func (client *Client) SetPinnedChats(req *SetPinnedChatsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPinnedChats", + }, + Data: map[string]interface{}{ + "chat_list": req.ChatList, + "chat_ids": req.ChatIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DownloadFileRequest struct { + // Identifier of the file to download + FileId int32 `json:"file_id"` + // Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded first + Priority int32 `json:"priority"` + // The starting position from which the file should be downloaded + Offset int32 `json:"offset"` + // Number of bytes which should be downloaded starting from the "offset" position before the download will be automatically cancelled; use 0 to download without a limit + Limit int32 `json:"limit"` + // If false, this request returns file state just after the download has been started. If true, this request returns file state only after the download has succeeded, has failed, has been cancelled or a new downloadFile request with different offset/limit parameters was sent + Synchronous bool `json:"synchronous"` +} + +// Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates +func (client *Client) DownloadFile(req *DownloadFileRequest) (*File, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "downloadFile", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + "priority": req.Priority, + "offset": req.Offset, + "limit": req.Limit, + "synchronous": req.Synchronous, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFile(result.Data) +} + +type GetFileDownloadedPrefixSizeRequest struct { + // Identifier of the file + FileId int32 `json:"file_id"` + // Offset from which downloaded prefix size should be calculated + Offset int32 `json:"offset"` +} + +// Returns file downloaded prefix size from a given offset +func (client *Client) GetFileDownloadedPrefixSize(req *GetFileDownloadedPrefixSizeRequest) (*Count, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getFileDownloadedPrefixSize", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + "offset": req.Offset, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCount(result.Data) +} + +type CancelDownloadFileRequest struct { + // Identifier of a file to stop downloading + FileId int32 `json:"file_id"` + // Pass true to stop downloading only if it hasn't been started, i.e. request hasn't been sent to server + OnlyIfPending bool `json:"only_if_pending"` +} + +// Stops the downloading of a file. If a file has already been downloaded, does nothing +func (client *Client) CancelDownloadFile(req *CancelDownloadFileRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "cancelDownloadFile", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + "only_if_pending": req.OnlyIfPending, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type UploadFileRequest struct { + // File to upload + File InputFile `json:"file"` + // File type + FileType FileType `json:"file_type"` + // Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which uploadFile was called will be uploaded first + Priority int32 `json:"priority"` +} + +// Asynchronously uploads a file to the cloud without sending it in a message. updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message +func (client *Client) UploadFile(req *UploadFileRequest) (*File, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "uploadFile", + }, + Data: map[string]interface{}{ + "file": req.File, + "file_type": req.FileType, + "priority": req.Priority, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFile(result.Data) +} + +type CancelUploadFileRequest struct { + // Identifier of the file to stop uploading + FileId int32 `json:"file_id"` +} + +// Stops the uploading of a file. Supported only for files uploaded by using uploadFile. For other files the behavior is undefined +func (client *Client) CancelUploadFile(req *CancelUploadFileRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "cancelUploadFile", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type WriteGeneratedFilePartRequest struct { + // The identifier of the generation process + GenerationId JsonInt64 `json:"generation_id"` + // The offset from which to write the data to the file + Offset int32 `json:"offset"` + // The data to write + Data []byte `json:"data"` +} + +// Writes a part of a generated file. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct write to the destination file +func (client *Client) WriteGeneratedFilePart(req *WriteGeneratedFilePartRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "writeGeneratedFilePart", + }, + Data: map[string]interface{}{ + "generation_id": req.GenerationId, + "offset": req.Offset, + "data": req.Data, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetFileGenerationProgressRequest struct { + // The identifier of the generation process + GenerationId JsonInt64 `json:"generation_id"` + // Expected size of the generated file, in bytes; 0 if unknown + ExpectedSize int32 `json:"expected_size"` + // The number of bytes already generated + LocalPrefixSize int32 `json:"local_prefix_size"` +} + +// Informs TDLib on a file generation progress +func (client *Client) SetFileGenerationProgress(req *SetFileGenerationProgressRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setFileGenerationProgress", + }, + Data: map[string]interface{}{ + "generation_id": req.GenerationId, + "expected_size": req.ExpectedSize, + "local_prefix_size": req.LocalPrefixSize, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type FinishFileGenerationRequest struct { + // The identifier of the generation process + GenerationId JsonInt64 `json:"generation_id"` + // If set, means that file generation has failed and should be terminated + Error *Error `json:"error"` +} + +// Finishes the file generation +func (client *Client) FinishFileGeneration(req *FinishFileGenerationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "finishFileGeneration", + }, + Data: map[string]interface{}{ + "generation_id": req.GenerationId, + "error": req.Error, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReadFilePartRequest struct { + // Identifier of the file. The file must be located in the TDLib file cache + FileId int32 `json:"file_id"` + // The offset from which to read the file + Offset int32 `json:"offset"` + // Number of bytes to read. An error will be returned if there are not enough bytes available in the file from the specified position. Pass 0 to read all available data from the specified position + Count int32 `json:"count"` +} + +// Reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct read from the file +func (client *Client) ReadFilePart(req *ReadFilePartRequest) (*FilePart, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readFilePart", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + "offset": req.Offset, + "count": req.Count, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFilePart(result.Data) +} + +type DeleteFileRequest struct { + // Identifier of the file to delete + FileId int32 `json:"file_id"` +} + +// Deletes a file from the TDLib file cache +func (client *Client) DeleteFile(req *DeleteFileRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteFile", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GenerateChatInviteLinkRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Generates a new invite link for a chat; the previously generated link is revoked. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right +func (client *Client) GenerateChatInviteLink(req *GenerateChatInviteLinkRequest) (*ChatInviteLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "generateChatInviteLink", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatInviteLink(result.Data) +} + +type CheckChatInviteLinkRequest struct { + // Invite link to be checked; should begin with "https://t.me/joinchat/", "https://telegram.me/joinchat/", or "https://telegram.dog/joinchat/" + InviteLink string `json:"invite_link"` +} + +// Checks the validity of an invite link for a chat and returns information about the corresponding chat +func (client *Client) CheckChatInviteLink(req *CheckChatInviteLinkRequest) (*ChatInviteLinkInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkChatInviteLink", + }, + Data: map[string]interface{}{ + "invite_link": req.InviteLink, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatInviteLinkInfo(result.Data) +} + +type JoinChatByInviteLinkRequest struct { + // Invite link to import; should begin with "https://t.me/joinchat/", "https://telegram.me/joinchat/", or "https://telegram.dog/joinchat/" + InviteLink string `json:"invite_link"` +} + +// Uses an invite link to add the current user to the chat if possible. The new member will not be added until the chat state has been synchronized with the server +func (client *Client) JoinChatByInviteLink(req *JoinChatByInviteLinkRequest) (*Chat, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "joinChatByInviteLink", + }, + Data: map[string]interface{}{ + "invite_link": req.InviteLink, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChat(result.Data) +} + +type CreateCallRequest struct { + // Identifier of the user to be called + UserId int32 `json:"user_id"` + // Description of the call protocols supported by the application + Protocol *CallProtocol `json:"protocol"` + // True, if a video call needs to be created + IsVideo bool `json:"is_video"` +} + +// Creates a new call +func (client *Client) CreateCall(req *CreateCallRequest) (*CallId, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createCall", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "protocol": req.Protocol, + "is_video": req.IsVideo, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCallId(result.Data) +} + +type AcceptCallRequest struct { + // Call identifier + CallId int32 `json:"call_id"` + // Description of the call protocols supported by the application + Protocol *CallProtocol `json:"protocol"` +} + +// Accepts an incoming call +func (client *Client) AcceptCall(req *AcceptCallRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "acceptCall", + }, + Data: map[string]interface{}{ + "call_id": req.CallId, + "protocol": req.Protocol, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendCallSignalingDataRequest struct { + // Call identifier + CallId int32 `json:"call_id"` + // The data + Data []byte `json:"data"` +} + +// Sends call signaling data +func (client *Client) SendCallSignalingData(req *SendCallSignalingDataRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendCallSignalingData", + }, + Data: map[string]interface{}{ + "call_id": req.CallId, + "data": req.Data, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DiscardCallRequest struct { + // Call identifier + CallId int32 `json:"call_id"` + // True, if the user was disconnected + IsDisconnected bool `json:"is_disconnected"` + // The call duration, in seconds + Duration int32 `json:"duration"` + // True, if the call was a video call + IsVideo bool `json:"is_video"` + // Identifier of the connection used during the call + ConnectionId JsonInt64 `json:"connection_id"` +} + +// Discards a call +func (client *Client) DiscardCall(req *DiscardCallRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "discardCall", + }, + Data: map[string]interface{}{ + "call_id": req.CallId, + "is_disconnected": req.IsDisconnected, + "duration": req.Duration, + "is_video": req.IsVideo, + "connection_id": req.ConnectionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendCallRatingRequest struct { + // Call identifier + CallId int32 `json:"call_id"` + // Call rating; 1-5 + Rating int32 `json:"rating"` + // An optional user comment if the rating is less than 5 + Comment string `json:"comment"` + // List of the exact types of problems with the call, specified by the user + Problems []CallProblem `json:"problems"` +} + +// Sends a call rating +func (client *Client) SendCallRating(req *SendCallRatingRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendCallRating", + }, + Data: map[string]interface{}{ + "call_id": req.CallId, + "rating": req.Rating, + "comment": req.Comment, + "problems": req.Problems, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendCallDebugInformationRequest struct { + // Call identifier + CallId int32 `json:"call_id"` + // Debug information in application-specific format + DebugInformation string `json:"debug_information"` +} + +// Sends debug information for a call +func (client *Client) SendCallDebugInformation(req *SendCallDebugInformationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendCallDebugInformation", + }, + Data: map[string]interface{}{ + "call_id": req.CallId, + "debug_information": req.DebugInformation, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleMessageSenderIsBlockedRequest struct { + // Message Sender + Sender MessageSender `json:"sender"` + // New value of is_blocked + IsBlocked bool `json:"is_blocked"` +} + +// Changes the block state of a message sender. Currently, only users and supergroup chats can be blocked +func (client *Client) ToggleMessageSenderIsBlocked(req *ToggleMessageSenderIsBlockedRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleMessageSenderIsBlocked", + }, + Data: map[string]interface{}{ + "sender": req.Sender, + "is_blocked": req.IsBlocked, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type BlockMessageSenderFromRepliesRequest struct { + // The identifier of an incoming message in the Replies chat + MessageId int64 `json:"message_id"` + // Pass true if the message must be deleted + DeleteMessage bool `json:"delete_message"` + // Pass true if all messages from the same sender must be deleted + DeleteAllMessages bool `json:"delete_all_messages"` + // Pass true if the sender must be reported to the Telegram moderators + ReportSpam bool `json:"report_spam"` +} + +// Blocks an original sender of a message in the Replies chat +func (client *Client) BlockMessageSenderFromReplies(req *BlockMessageSenderFromRepliesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "blockMessageSenderFromReplies", + }, + Data: map[string]interface{}{ + "message_id": req.MessageId, + "delete_message": req.DeleteMessage, + "delete_all_messages": req.DeleteAllMessages, + "report_spam": req.ReportSpam, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBlockedMessageSendersRequest struct { + // Number of users and chats to skip in the result; must be non-negative + Offset int32 `json:"offset"` + // The maximum number of users and chats to return; up to 100 + Limit int32 `json:"limit"` +} + +// Returns users and chats that were blocked by the current user +func (client *Client) GetBlockedMessageSenders(req *GetBlockedMessageSendersRequest) (*MessageSenders, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBlockedMessageSenders", + }, + Data: map[string]interface{}{ + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageSenders(result.Data) +} + +type AddContactRequest struct { + // The contact to add or edit; phone number can be empty and needs to be specified only if known, vCard is ignored + Contact *Contact `json:"contact"` + // True, if the new contact needs to be allowed to see current user's phone number. A corresponding rule to userPrivacySettingShowPhoneNumber will be added if needed. Use the field UserFullInfo.need_phone_number_privacy_exception to check whether the current user needs to be asked to share their phone number + SharePhoneNumber bool `json:"share_phone_number"` +} + +// Adds a user to the contact list or edits an existing contact by their user identifier +func (client *Client) AddContact(req *AddContactRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addContact", + }, + Data: map[string]interface{}{ + "contact": req.Contact, + "share_phone_number": req.SharePhoneNumber, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ImportContactsRequest struct { + // The list of contacts to import or edit; contacts' vCard are ignored and are not imported + Contacts []*Contact `json:"contacts"` +} + +// Adds new contacts or edits existing contacts by their phone numbers; contacts' user identifiers are ignored +func (client *Client) ImportContacts(req *ImportContactsRequest) (*ImportedContacts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "importContacts", + }, + Data: map[string]interface{}{ + "contacts": req.Contacts, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalImportedContacts(result.Data) +} + +// Returns all user contacts +func (client *Client) GetContacts() (*Users, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getContacts", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUsers(result.Data) +} + +type SearchContactsRequest struct { + // Query to search for; may be empty to return all contacts + Query string `json:"query"` + // The maximum number of users to be returned + Limit int32 `json:"limit"` +} + +// Searches for the specified query in the first names, last names and usernames of the known user contacts +func (client *Client) SearchContacts(req *SearchContactsRequest) (*Users, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchContacts", + }, + Data: map[string]interface{}{ + "query": req.Query, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUsers(result.Data) +} + +type RemoveContactsRequest struct { + // Identifiers of users to be deleted + UserIds []int32 `json:"user_ids"` +} + +// Removes users from the contact list +func (client *Client) RemoveContacts(req *RemoveContactsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeContacts", + }, + Data: map[string]interface{}{ + "user_ids": req.UserIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns the total number of imported contacts +func (client *Client) GetImportedContactCount() (*Count, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getImportedContactCount", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCount(result.Data) +} + +type ChangeImportedContactsRequest struct { + // The new list of contacts, contact's vCard are ignored and are not imported + Contacts []*Contact `json:"contacts"` +} + +// Changes imported contacts using the list of current user contacts saved on the device. Imports newly added contacts and, if at least the file database is enabled, deletes recently deleted contacts. Query result depends on the result of the previous query, so only one query is possible at the same time +func (client *Client) ChangeImportedContacts(req *ChangeImportedContactsRequest) (*ImportedContacts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "changeImportedContacts", + }, + Data: map[string]interface{}{ + "contacts": req.Contacts, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalImportedContacts(result.Data) +} + +// Clears all imported contacts, contact list remains unchanged +func (client *Client) ClearImportedContacts() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clearImportedContacts", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SharePhoneNumberRequest struct { + // Identifier of the user with whom to share the phone number. The user must be a mutual contact + UserId int32 `json:"user_id"` +} + +// Shares the phone number of the current user with a mutual contact. Supposed to be called when the user clicks on chatActionBarSharePhoneNumber +func (client *Client) SharePhoneNumber(req *SharePhoneNumberRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sharePhoneNumber", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetUserProfilePhotosRequest struct { + // User identifier + UserId int32 `json:"user_id"` + // The number of photos to skip; must be non-negative + Offset int32 `json:"offset"` + // The maximum number of photos to be returned; up to 100 + Limit int32 `json:"limit"` +} + +// Returns the profile photos of a user. The result of this query may be outdated: some photos might have been deleted already +func (client *Client) GetUserProfilePhotos(req *GetUserProfilePhotosRequest) (*ChatPhotos, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUserProfilePhotos", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatPhotos(result.Data) +} + +type GetStickersRequest struct { + // String representation of emoji. If empty, returns all known installed stickers + Emoji string `json:"emoji"` + // The maximum number of stickers to be returned + Limit int32 `json:"limit"` +} + +// Returns stickers from the installed sticker sets that correspond to a given emoji. If the emoji is not empty, favorite and recently used stickers may also be returned +func (client *Client) GetStickers(req *GetStickersRequest) (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStickers", + }, + Data: map[string]interface{}{ + "emoji": req.Emoji, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + +type SearchStickersRequest struct { + // String representation of emoji; must be non-empty + Emoji string `json:"emoji"` + // The maximum number of stickers to be returned + Limit int32 `json:"limit"` +} + +// Searches for stickers from public sticker sets that correspond to a given emoji +func (client *Client) SearchStickers(req *SearchStickersRequest) (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchStickers", + }, + Data: map[string]interface{}{ + "emoji": req.Emoji, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + +type GetInstalledStickerSetsRequest struct { + // Pass true to return mask sticker sets; pass false to return ordinary sticker sets + IsMasks bool `json:"is_masks"` +} + +// Returns a list of installed sticker sets +func (client *Client) GetInstalledStickerSets(req *GetInstalledStickerSetsRequest) (*StickerSets, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getInstalledStickerSets", + }, + Data: map[string]interface{}{ + "is_masks": req.IsMasks, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSets(result.Data) +} + +type GetArchivedStickerSetsRequest struct { + // Pass true to return mask stickers sets; pass false to return ordinary sticker sets + IsMasks bool `json:"is_masks"` + // Identifier of the sticker set from which to return the result + OffsetStickerSetId JsonInt64 `json:"offset_sticker_set_id"` + // The maximum number of sticker sets to return + Limit int32 `json:"limit"` +} + +// Returns a list of archived sticker sets +func (client *Client) GetArchivedStickerSets(req *GetArchivedStickerSetsRequest) (*StickerSets, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getArchivedStickerSets", + }, + Data: map[string]interface{}{ + "is_masks": req.IsMasks, + "offset_sticker_set_id": req.OffsetStickerSetId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSets(result.Data) +} + +type GetTrendingStickerSetsRequest struct { + // The offset from which to return the sticker sets; must be non-negative + Offset int32 `json:"offset"` + // The maximum number of sticker sets to be returned; must be non-negative. Fewer sticker sets may be returned than specified by the limit, even if the end of the list has not been reached + Limit int32 `json:"limit"` +} + +// Returns a list of trending sticker sets. For the optimal performance the number of returned sticker sets is chosen by the library +func (client *Client) GetTrendingStickerSets(req *GetTrendingStickerSetsRequest) (*StickerSets, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTrendingStickerSets", + }, + Data: map[string]interface{}{ + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSets(result.Data) +} + +type GetAttachedStickerSetsRequest struct { + // File identifier + FileId int32 `json:"file_id"` +} + +// Returns a list of sticker sets attached to a file. Currently only photos and videos can have attached sticker sets +func (client *Client) GetAttachedStickerSets(req *GetAttachedStickerSetsRequest) (*StickerSets, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAttachedStickerSets", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSets(result.Data) +} + +type GetStickerSetRequest struct { + // Identifier of the sticker set + SetId JsonInt64 `json:"set_id"` +} + +// Returns information about a sticker set by its identifier +func (client *Client) GetStickerSet(req *GetStickerSetRequest) (*StickerSet, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStickerSet", + }, + Data: map[string]interface{}{ + "set_id": req.SetId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSet(result.Data) +} + +type SearchStickerSetRequest struct { + // Name of the sticker set + Name string `json:"name"` +} + +// Searches for a sticker set by its name +func (client *Client) SearchStickerSet(req *SearchStickerSetRequest) (*StickerSet, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchStickerSet", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSet(result.Data) +} + +type SearchInstalledStickerSetsRequest struct { + // Pass true to return mask sticker sets; pass false to return ordinary sticker sets + IsMasks bool `json:"is_masks"` + // Query to search for + Query string `json:"query"` + // The maximum number of sticker sets to return + Limit int32 `json:"limit"` +} + +// Searches for installed sticker sets by looking for specified query in their title and name +func (client *Client) SearchInstalledStickerSets(req *SearchInstalledStickerSetsRequest) (*StickerSets, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchInstalledStickerSets", + }, + Data: map[string]interface{}{ + "is_masks": req.IsMasks, + "query": req.Query, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSets(result.Data) +} + +type SearchStickerSetsRequest struct { + // Query to search for + Query string `json:"query"` +} + +// Searches for ordinary sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results +func (client *Client) SearchStickerSets(req *SearchStickerSetsRequest) (*StickerSets, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchStickerSets", + }, + Data: map[string]interface{}{ + "query": req.Query, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSets(result.Data) +} + +type ChangeStickerSetRequest struct { + // Identifier of the sticker set + SetId JsonInt64 `json:"set_id"` + // The new value of is_installed + IsInstalled bool `json:"is_installed"` + // The new value of is_archived. A sticker set can't be installed and archived simultaneously + IsArchived bool `json:"is_archived"` +} + +// Installs/uninstalls or activates/archives a sticker set +func (client *Client) ChangeStickerSet(req *ChangeStickerSetRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "changeStickerSet", + }, + Data: map[string]interface{}{ + "set_id": req.SetId, + "is_installed": req.IsInstalled, + "is_archived": req.IsArchived, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ViewTrendingStickerSetsRequest struct { + // Identifiers of viewed trending sticker sets + StickerSetIds []JsonInt64 `json:"sticker_set_ids"` +} + +// Informs the server that some trending sticker sets have been viewed by the user +func (client *Client) ViewTrendingStickerSets(req *ViewTrendingStickerSetsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "viewTrendingStickerSets", + }, + Data: map[string]interface{}{ + "sticker_set_ids": req.StickerSetIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReorderInstalledStickerSetsRequest struct { + // Pass true to change the order of mask sticker sets; pass false to change the order of ordinary sticker sets + IsMasks bool `json:"is_masks"` + // Identifiers of installed sticker sets in the new correct order + StickerSetIds []JsonInt64 `json:"sticker_set_ids"` +} + +// Changes the order of installed sticker sets +func (client *Client) ReorderInstalledStickerSets(req *ReorderInstalledStickerSetsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderInstalledStickerSets", + }, + Data: map[string]interface{}{ + "is_masks": req.IsMasks, + "sticker_set_ids": req.StickerSetIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetRecentStickersRequest struct { + // Pass true to return stickers and masks that were recently attached to photos or video files; pass false to return recently sent stickers + IsAttached bool `json:"is_attached"` +} + +// Returns a list of recently used stickers +func (client *Client) GetRecentStickers(req *GetRecentStickersRequest) (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getRecentStickers", + }, + Data: map[string]interface{}{ + "is_attached": req.IsAttached, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + +type AddRecentStickerRequest struct { + // Pass true to add the sticker to the list of stickers recently attached to photo or video files; pass false to add the sticker to the list of recently sent stickers + IsAttached bool `json:"is_attached"` + // Sticker file to add + Sticker InputFile `json:"sticker"` +} + +// Manually adds a new sticker to the list of recently used stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list +func (client *Client) AddRecentSticker(req *AddRecentStickerRequest) (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addRecentSticker", + }, + Data: map[string]interface{}{ + "is_attached": req.IsAttached, + "sticker": req.Sticker, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + +type RemoveRecentStickerRequest struct { + // Pass true to remove the sticker from the list of stickers recently attached to photo or video files; pass false to remove the sticker from the list of recently sent stickers + IsAttached bool `json:"is_attached"` + // Sticker file to delete + Sticker InputFile `json:"sticker"` +} + +// Removes a sticker from the list of recently used stickers +func (client *Client) RemoveRecentSticker(req *RemoveRecentStickerRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeRecentSticker", + }, + Data: map[string]interface{}{ + "is_attached": req.IsAttached, + "sticker": req.Sticker, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ClearRecentStickersRequest struct { + // Pass true to clear the list of stickers recently attached to photo or video files; pass false to clear the list of recently sent stickers + IsAttached bool `json:"is_attached"` +} + +// Clears the list of recently used stickers +func (client *Client) ClearRecentStickers(req *ClearRecentStickersRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clearRecentStickers", + }, + Data: map[string]interface{}{ + "is_attached": req.IsAttached, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns favorite stickers +func (client *Client) GetFavoriteStickers() (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getFavoriteStickers", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + +type AddFavoriteStickerRequest struct { + // Sticker file to add + Sticker InputFile `json:"sticker"` +} + +// Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list +func (client *Client) AddFavoriteSticker(req *AddFavoriteStickerRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addFavoriteSticker", + }, + Data: map[string]interface{}{ + "sticker": req.Sticker, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveFavoriteStickerRequest struct { + // Sticker file to delete from the list + Sticker InputFile `json:"sticker"` +} + +// Removes a sticker from the list of favorite stickers +func (client *Client) RemoveFavoriteSticker(req *RemoveFavoriteStickerRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeFavoriteSticker", + }, + Data: map[string]interface{}{ + "sticker": req.Sticker, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetStickerEmojisRequest struct { + // Sticker file identifier + Sticker InputFile `json:"sticker"` +} + +// Returns emoji corresponding to a sticker. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object +func (client *Client) GetStickerEmojis(req *GetStickerEmojisRequest) (*Emojis, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStickerEmojis", + }, + Data: map[string]interface{}{ + "sticker": req.Sticker, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojis(result.Data) +} + +type SearchEmojisRequest struct { + // Text to search for + Text string `json:"text"` + // True, if only emojis, which exactly match text needs to be returned + ExactMatch bool `json:"exact_match"` + // List of possible IETF language tags of the user's input language; may be empty if unknown + InputLanguageCodes []string `json:"input_language_codes"` +} + +// Searches for emojis by keywords. Supported only if the file database is enabled +func (client *Client) SearchEmojis(req *SearchEmojisRequest) (*Emojis, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchEmojis", + }, + Data: map[string]interface{}{ + "text": req.Text, + "exact_match": req.ExactMatch, + "input_language_codes": req.InputLanguageCodes, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojis(result.Data) +} + +type GetEmojiSuggestionsUrlRequest struct { + // Language code for which the emoji replacements will be suggested + LanguageCode string `json:"language_code"` +} + +// Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation +func (client *Client) GetEmojiSuggestionsUrl(req *GetEmojiSuggestionsUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getEmojiSuggestionsUrl", + }, + Data: map[string]interface{}{ + "language_code": req.LanguageCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + +// Returns saved animations +func (client *Client) GetSavedAnimations() (*Animations, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSavedAnimations", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAnimations(result.Data) +} + +type AddSavedAnimationRequest struct { + // The animation file to be added. Only animations known to the server (i.e. successfully sent via a message) can be added to the list + Animation InputFile `json:"animation"` +} + +// Manually adds a new animation to the list of saved animations. The new animation is added to the beginning of the list. If the animation was already in the list, it is removed first. Only non-secret video animations with MIME type "video/mp4" can be added to the list +func (client *Client) AddSavedAnimation(req *AddSavedAnimationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addSavedAnimation", + }, + Data: map[string]interface{}{ + "animation": req.Animation, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveSavedAnimationRequest struct { + // Animation file to be removed + Animation InputFile `json:"animation"` +} + +// Removes an animation from the list of saved animations +func (client *Client) RemoveSavedAnimation(req *RemoveSavedAnimationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeSavedAnimation", + }, + Data: map[string]interface{}{ + "animation": req.Animation, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns up to 20 recently used inline bots in the order of their last usage +func (client *Client) GetRecentInlineBots() (*Users, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getRecentInlineBots", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUsers(result.Data) +} + +type SearchHashtagsRequest struct { + // Hashtag prefix to search for + Prefix string `json:"prefix"` + // The maximum number of hashtags to be returned + Limit int32 `json:"limit"` +} + +// Searches for recently used hashtags by their prefix +func (client *Client) SearchHashtags(req *SearchHashtagsRequest) (*Hashtags, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchHashtags", + }, + Data: map[string]interface{}{ + "prefix": req.Prefix, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHashtags(result.Data) +} + +type RemoveRecentHashtagRequest struct { + // Hashtag to delete + Hashtag string `json:"hashtag"` +} + +// Removes a hashtag from the list of recently used hashtags +func (client *Client) RemoveRecentHashtag(req *RemoveRecentHashtagRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeRecentHashtag", + }, + Data: map[string]interface{}{ + "hashtag": req.Hashtag, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetWebPagePreviewRequest struct { + // Message text with formatting + Text *FormattedText `json:"text"` +} + +// Returns a web page preview by the text of the message. Do not call this function too often. Returns a 404 error if the web page has no preview +func (client *Client) GetWebPagePreview(req *GetWebPagePreviewRequest) (*WebPage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getWebPagePreview", + }, + Data: map[string]interface{}{ + "text": req.Text, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalWebPage(result.Data) +} + +type GetWebPageInstantViewRequest struct { + // The web page URL + Url string `json:"url"` + // If true, the full instant view for the web page will be returned + ForceFull bool `json:"force_full"` +} + +// Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page +func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) (*WebPageInstantView, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getWebPageInstantView", + }, + Data: map[string]interface{}{ + "url": req.Url, + "force_full": req.ForceFull, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalWebPageInstantView(result.Data) +} + +type SetProfilePhotoRequest struct { + // Profile photo to set + Photo InputChatPhoto `json:"photo"` +} + +// Changes a profile photo for the current user +func (client *Client) SetProfilePhoto(req *SetProfilePhotoRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setProfilePhoto", + }, + Data: map[string]interface{}{ + "photo": req.Photo, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteProfilePhotoRequest struct { + // Identifier of the profile photo to delete + ProfilePhotoId JsonInt64 `json:"profile_photo_id"` +} + +// Deletes a profile photo +func (client *Client) DeleteProfilePhoto(req *DeleteProfilePhotoRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteProfilePhoto", + }, + Data: map[string]interface{}{ + "profile_photo_id": req.ProfilePhotoId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetNameRequest struct { + // The new value of the first name for the user; 1-64 characters + FirstName string `json:"first_name"` + // The new value of the optional last name for the user; 0-64 characters + LastName string `json:"last_name"` +} + +// Changes the first and last name of the current user +func (client *Client) SetName(req *SetNameRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setName", + }, + Data: map[string]interface{}{ + "first_name": req.FirstName, + "last_name": req.LastName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBioRequest struct { + // The new value of the user bio; 0-70 characters without line feeds + Bio string `json:"bio"` +} + +// Changes the bio of the current user +func (client *Client) SetBio(req *SetBioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBio", + }, + Data: map[string]interface{}{ + "bio": req.Bio, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetUsernameRequest struct { + // The new value of the username. Use an empty string to remove the username + Username string `json:"username"` +} + +// Changes the username of the current user +func (client *Client) SetUsername(req *SetUsernameRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setUsername", + }, + Data: map[string]interface{}{ + "username": req.Username, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetLocationRequest struct { + // The new location of the user + Location *Location `json:"location"` +} + +// Changes the location of the current user. Needs to be called if GetOption("is_location_visible") is true and location changes for more than 1 kilometer +func (client *Client) SetLocation(req *SetLocationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setLocation", + }, + Data: map[string]interface{}{ + "location": req.Location, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ChangePhoneNumberRequest struct { + // The new phone number of the user in international format + PhoneNumber string `json:"phone_number"` + // Settings for the authentication of the user's phone number + Settings *PhoneNumberAuthenticationSettings `json:"settings"` +} + +// Changes the phone number of the user and sends an authentication code to the user's new phone number. On success, returns information about the sent code +func (client *Client) ChangePhoneNumber(req *ChangePhoneNumberRequest) (*AuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "changePhoneNumber", + }, + Data: map[string]interface{}{ + "phone_number": req.PhoneNumber, + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAuthenticationCodeInfo(result.Data) +} + +// Re-sends the authentication code sent to confirm a new phone number for the user. Works only if the previously received authenticationCodeInfo next_code_type was not null +func (client *Client) ResendChangePhoneNumberCode() (*AuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendChangePhoneNumberCode", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAuthenticationCodeInfo(result.Data) +} + +type CheckChangePhoneNumberCodeRequest struct { + // Verification code received by SMS, phone call or flash call + Code string `json:"code"` +} + +// Checks the authentication code sent to confirm a new phone number of the user +func (client *Client) CheckChangePhoneNumberCode(req *CheckChangePhoneNumberCodeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkChangePhoneNumberCode", + }, + Data: map[string]interface{}{ + "code": req.Code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetCommandsRequest struct { + // List of the bot's commands + Commands []*BotCommand `json:"commands"` +} + +// Sets the list of commands supported by the bot; for bots only +func (client *Client) SetCommands(req *SetCommandsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setCommands", + }, + Data: map[string]interface{}{ + "commands": req.Commands, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns all active sessions of the current user +func (client *Client) GetActiveSessions() (*Sessions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getActiveSessions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSessions(result.Data) +} + +type TerminateSessionRequest struct { + // Session identifier + SessionId JsonInt64 `json:"session_id"` +} + +// Terminates a session of the current user +func (client *Client) TerminateSession(req *TerminateSessionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "terminateSession", + }, + Data: map[string]interface{}{ + "session_id": req.SessionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Terminates all other sessions of the current user +func (client *Client) TerminateAllOtherSessions() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "terminateAllOtherSessions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns all website where the current user used Telegram to log in +func (client *Client) GetConnectedWebsites() (*ConnectedWebsites, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getConnectedWebsites", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalConnectedWebsites(result.Data) +} + +type DisconnectWebsiteRequest struct { + // Website identifier + WebsiteId JsonInt64 `json:"website_id"` +} + +// Disconnects website from the current user's Telegram account +func (client *Client) DisconnectWebsite(req *DisconnectWebsiteRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "disconnectWebsite", + }, + Data: map[string]interface{}{ + "website_id": req.WebsiteId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Disconnects all websites from the current user's Telegram account +func (client *Client) DisconnectAllWebsites() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "disconnectAllWebsites", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetSupergroupUsernameRequest struct { + // Identifier of the supergroup or channel + SupergroupId int32 `json:"supergroup_id"` + // New value of the username. Use an empty string to remove the username + Username string `json:"username"` +} + +// Changes the username of a supergroup or channel, requires owner privileges in the supergroup or channel +func (client *Client) SetSupergroupUsername(req *SetSupergroupUsernameRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setSupergroupUsername", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "username": req.Username, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetSupergroupStickerSetRequest struct { + // Identifier of the supergroup + SupergroupId int32 `json:"supergroup_id"` + // New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set + StickerSetId JsonInt64 `json:"sticker_set_id"` +} + +// Changes the sticker set of a supergroup; requires can_change_info rights +func (client *Client) SetSupergroupStickerSet(req *SetSupergroupStickerSetRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setSupergroupStickerSet", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "sticker_set_id": req.StickerSetId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleSupergroupSignMessagesRequest struct { + // Identifier of the channel + SupergroupId int32 `json:"supergroup_id"` + // New value of sign_messages + SignMessages bool `json:"sign_messages"` +} + +// Toggles sender signatures messages sent in a channel; requires can_change_info rights +func (client *Client) ToggleSupergroupSignMessages(req *ToggleSupergroupSignMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSupergroupSignMessages", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "sign_messages": req.SignMessages, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleSupergroupIsAllHistoryAvailableRequest struct { + // The identifier of the supergroup + SupergroupId int32 `json:"supergroup_id"` + // The new value of is_all_history_available + IsAllHistoryAvailable bool `json:"is_all_history_available"` +} + +// Toggles whether the message history of a supergroup is available to new members; requires can_change_info rights +func (client *Client) ToggleSupergroupIsAllHistoryAvailable(req *ToggleSupergroupIsAllHistoryAvailableRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSupergroupIsAllHistoryAvailable", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "is_all_history_available": req.IsAllHistoryAvailable, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReportSupergroupSpamRequest struct { + // Supergroup identifier + SupergroupId int32 `json:"supergroup_id"` + // User identifier + UserId int32 `json:"user_id"` + // Identifiers of messages sent in the supergroup by the user. This list must be non-empty + MessageIds []int64 `json:"message_ids"` +} + +// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup +func (client *Client) ReportSupergroupSpam(req *ReportSupergroupSpamRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportSupergroupSpam", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "user_id": req.UserId, + "message_ids": req.MessageIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetSupergroupMembersRequest struct { + // Identifier of the supergroup or channel + SupergroupId int32 `json:"supergroup_id"` + // The type of users to return. By default, supergroupMembersFilterRecent + Filter SupergroupMembersFilter `json:"filter"` + // Number of users to skip + Offset int32 `json:"offset"` + // The maximum number of users be returned; up to 200 + Limit int32 `json:"limit"` +} + +// Returns information about members or banned users in a supergroup or channel. Can be used only if SupergroupFullInfo.can_get_members == true; additionally, administrator privileges may be required for some filters +func (client *Client) GetSupergroupMembers(req *GetSupergroupMembersRequest) (*ChatMembers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSupergroupMembers", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "filter": req.Filter, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatMembers(result.Data) +} + +type DeleteSupergroupRequest struct { + // Identifier of the supergroup or channel + SupergroupId int32 `json:"supergroup_id"` +} + +// Deletes a supergroup or channel along with all messages in the corresponding chat. This will release the supergroup or channel username and remove all members; requires owner privileges in the supergroup or channel. Chats with more than 1000 members can't be deleted using this method +func (client *Client) DeleteSupergroup(req *DeleteSupergroupRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteSupergroup", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CloseSecretChatRequest struct { + // Secret chat identifier + SecretChatId int32 `json:"secret_chat_id"` +} + +// Closes a secret chat, effectively transferring its state to secretChatStateClosed +func (client *Client) CloseSecretChat(req *CloseSecretChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "closeSecretChat", + }, + Data: map[string]interface{}{ + "secret_chat_id": req.SecretChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetChatEventLogRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Search query by which to filter events + Query string `json:"query"` + // Identifier of an event from which to return results. Use 0 to get results from the latest events + FromEventId JsonInt64 `json:"from_event_id"` + // The maximum number of events to return; up to 100 + Limit int32 `json:"limit"` + // The types of events to return. By default, all types will be returned + Filters *ChatEventLogFilters `json:"filters"` + // User identifiers by which to filter events. By default, events relating to all users will be returned + UserIds []int32 `json:"user_ids"` +} + +// Returns a list of service actions taken by chat members and administrators in the last 48 hours. Available only for supergroups and channels. Requires administrator rights. Returns results in reverse chronological order (i. e., in order of decreasing event_id) +func (client *Client) GetChatEventLog(req *GetChatEventLogRequest) (*ChatEvents, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatEventLog", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "query": req.Query, + "from_event_id": req.FromEventId, + "limit": req.Limit, + "filters": req.Filters, + "user_ids": req.UserIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatEvents(result.Data) +} + +type GetPaymentFormRequest struct { + // Chat identifier of the Invoice message + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` +} + +// Returns an invoice payment form. This method should be called when the user presses inlineKeyboardButtonBuy +func (client *Client) GetPaymentForm(req *GetPaymentFormRequest) (*PaymentForm, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPaymentForm", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPaymentForm(result.Data) +} + +type ValidateOrderInfoRequest struct { + // Chat identifier of the Invoice message + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // The order information, provided by the user + OrderInfo *OrderInfo `json:"order_info"` + // True, if the order information can be saved + AllowSave bool `json:"allow_save"` +} + +// Validates the order information provided by a user and returns the available shipping options for a flexible invoice +func (client *Client) ValidateOrderInfo(req *ValidateOrderInfoRequest) (*ValidatedOrderInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "validateOrderInfo", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "order_info": req.OrderInfo, + "allow_save": req.AllowSave, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalValidatedOrderInfo(result.Data) +} + +type SendPaymentFormRequest struct { + // Chat identifier of the Invoice message + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // Identifier returned by ValidateOrderInfo, or an empty string + OrderInfoId string `json:"order_info_id"` + // Identifier of a chosen shipping option, if applicable + ShippingOptionId string `json:"shipping_option_id"` + // The credentials chosen by user for payment + Credentials InputCredentials `json:"credentials"` +} + +// Sends a filled-out payment form to the bot for final verification +func (client *Client) SendPaymentForm(req *SendPaymentFormRequest) (*PaymentResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendPaymentForm", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "order_info_id": req.OrderInfoId, + "shipping_option_id": req.ShippingOptionId, + "credentials": req.Credentials, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPaymentResult(result.Data) +} + +type GetPaymentReceiptRequest struct { + // Chat identifier of the PaymentSuccessful message + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` +} + +// Returns information about a successful payment +func (client *Client) GetPaymentReceipt(req *GetPaymentReceiptRequest) (*PaymentReceipt, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPaymentReceipt", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPaymentReceipt(result.Data) +} + +// Returns saved order info, if any +func (client *Client) GetSavedOrderInfo() (*OrderInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSavedOrderInfo", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOrderInfo(result.Data) +} + +// Deletes saved order info +func (client *Client) DeleteSavedOrderInfo() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteSavedOrderInfo", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Deletes saved credentials for all payment provider bots +func (client *Client) DeleteSavedCredentials() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteSavedCredentials", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns a user that can be contacted to get support +func (client *Client) GetSupportUser() (*User, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSupportUser", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUser(result.Data) +} + +type GetBackgroundsRequest struct { + // True, if the backgrounds must be ordered for dark theme + ForDarkTheme bool `json:"for_dark_theme"` +} + +// Returns backgrounds installed by the user +func (client *Client) GetBackgrounds(req *GetBackgroundsRequest) (*Backgrounds, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBackgrounds", + }, + Data: map[string]interface{}{ + "for_dark_theme": req.ForDarkTheme, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBackgrounds(result.Data) +} + +type GetBackgroundUrlRequest struct { + // Background name + Name string `json:"name"` + // Background type + Type BackgroundType `json:"type"` +} + +// Constructs a persistent HTTP URL for a background +func (client *Client) GetBackgroundUrl(req *GetBackgroundUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBackgroundUrl", + }, + Data: map[string]interface{}{ + "name": req.Name, + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + +type SearchBackgroundRequest struct { + // The name of the background + Name string `json:"name"` +} + +// Searches for a background by its name +func (client *Client) SearchBackground(req *SearchBackgroundRequest) (*Background, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchBackground", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBackground(result.Data) +} + +type SetBackgroundRequest struct { + // The input background to use, null for filled backgrounds + Background InputBackground `json:"background"` + // Background type; null for default background. The method will return error 404 if type is null + Type BackgroundType `json:"type"` + // True, if the background is chosen for dark theme + ForDarkTheme bool `json:"for_dark_theme"` +} + +// Changes the background selected by the user; adds background to the list of installed backgrounds +func (client *Client) SetBackground(req *SetBackgroundRequest) (*Background, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBackground", + }, + Data: map[string]interface{}{ + "background": req.Background, + "type": req.Type, + "for_dark_theme": req.ForDarkTheme, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBackground(result.Data) +} + +type RemoveBackgroundRequest struct { + // The background identifier + BackgroundId JsonInt64 `json:"background_id"` +} + +// Removes background from the list of installed backgrounds +func (client *Client) RemoveBackground(req *RemoveBackgroundRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeBackground", + }, + Data: map[string]interface{}{ + "background_id": req.BackgroundId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Resets list of installed backgrounds to its default value +func (client *Client) ResetBackgrounds() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resetBackgrounds", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetLocalizationTargetInfoRequest struct { + // If true, returns only locally available information without sending network requests + OnlyLocal bool `json:"only_local"` +} + +// Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization +func (client *Client) GetLocalizationTargetInfo(req *GetLocalizationTargetInfoRequest) (*LocalizationTargetInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLocalizationTargetInfo", + }, + Data: map[string]interface{}{ + "only_local": req.OnlyLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLocalizationTargetInfo(result.Data) +} + +type GetLanguagePackInfoRequest struct { + // Language pack identifier + LanguagePackId string `json:"language_pack_id"` +} + +// Returns information about a language pack. Returned language pack identifier may be different from a provided one. Can be called before authorization +func (client *Client) GetLanguagePackInfo(req *GetLanguagePackInfoRequest) (*LanguagePackInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLanguagePackInfo", + }, + Data: map[string]interface{}{ + "language_pack_id": req.LanguagePackId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLanguagePackInfo(result.Data) +} + +type GetLanguagePackStringsRequest struct { + // Language pack identifier of the strings to be returned + LanguagePackId string `json:"language_pack_id"` + // Language pack keys of the strings to be returned; leave empty to request all available strings + Keys []string `json:"keys"` +} + +// Returns strings from a language pack in the current localization target by their keys. Can be called before authorization +func (client *Client) GetLanguagePackStrings(req *GetLanguagePackStringsRequest) (*LanguagePackStrings, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLanguagePackStrings", + }, + Data: map[string]interface{}{ + "language_pack_id": req.LanguagePackId, + "keys": req.Keys, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLanguagePackStrings(result.Data) +} + +type SynchronizeLanguagePackRequest struct { + // Language pack identifier + LanguagePackId string `json:"language_pack_id"` +} + +// Fetches the latest versions of all strings from a language pack in the current localization target from the server. This method shouldn't be called explicitly for the current used/base language packs. Can be called before authorization +func (client *Client) SynchronizeLanguagePack(req *SynchronizeLanguagePackRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "synchronizeLanguagePack", + }, + Data: map[string]interface{}{ + "language_pack_id": req.LanguagePackId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddCustomServerLanguagePackRequest struct { + // Identifier of a language pack to be added; may be different from a name that is used in an "https://t.me/setlanguage/" link + LanguagePackId string `json:"language_pack_id"` +} + +// Adds a custom server language pack to the list of installed language packs in current localization target. Can be called before authorization +func (client *Client) AddCustomServerLanguagePack(req *AddCustomServerLanguagePackRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addCustomServerLanguagePack", + }, + Data: map[string]interface{}{ + "language_pack_id": req.LanguagePackId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetCustomLanguagePackRequest struct { + // Information about the language pack. Language pack ID must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization + Info *LanguagePackInfo `json:"info"` + // Strings of the new language pack + Strings []*LanguagePackString `json:"strings"` +} + +// Adds or changes a custom local language pack to the current localization target +func (client *Client) SetCustomLanguagePack(req *SetCustomLanguagePackRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setCustomLanguagePack", + }, + Data: map[string]interface{}{ + "info": req.Info, + "strings": req.Strings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type EditCustomLanguagePackInfoRequest struct { + // New information about the custom local language pack + Info *LanguagePackInfo `json:"info"` +} + +// Edits information about a custom local language pack in the current localization target. Can be called before authorization +func (client *Client) EditCustomLanguagePackInfo(req *EditCustomLanguagePackInfoRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editCustomLanguagePackInfo", + }, + Data: map[string]interface{}{ + "info": req.Info, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetCustomLanguagePackStringRequest struct { + // Identifier of a previously added custom local language pack in the current localization target + LanguagePackId string `json:"language_pack_id"` + // New language pack string + NewString *LanguagePackString `json:"new_string"` +} + +// Adds, edits or deletes a string in a custom local language pack. Can be called before authorization +func (client *Client) SetCustomLanguagePackString(req *SetCustomLanguagePackStringRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setCustomLanguagePackString", + }, + Data: map[string]interface{}{ + "language_pack_id": req.LanguagePackId, + "new_string": req.NewString, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteLanguagePackRequest struct { + // Identifier of the language pack to delete + LanguagePackId string `json:"language_pack_id"` +} + +// Deletes all information about a language pack in the current localization target. The language pack which is currently in use (including base language pack) or is being synchronized can't be deleted. Can be called before authorization +func (client *Client) DeleteLanguagePack(req *DeleteLanguagePackRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteLanguagePack", + }, + Data: map[string]interface{}{ + "language_pack_id": req.LanguagePackId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RegisterDeviceRequest struct { + // Device token + DeviceToken DeviceToken `json:"device_token"` + // List of user identifiers of other users currently using the application + OtherUserIds []int32 `json:"other_user_ids"` +} + +// Registers the currently used device for receiving push notifications. Returns a globally unique identifier of the push notification subscription +func (client *Client) RegisterDevice(req *RegisterDeviceRequest) (*PushReceiverId, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "registerDevice", + }, + Data: map[string]interface{}{ + "device_token": req.DeviceToken, + "other_user_ids": req.OtherUserIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPushReceiverId(result.Data) +} + +type ProcessPushNotificationRequest struct { + // JSON-encoded push notification payload with all fields sent by the server, and "google.sent_time" and "google.notification.sound" fields added + Payload string `json:"payload"` +} + +// Handles a push notification. Returns error with code 406 if the push notification is not supported and connection to the server is required to fetch new data. Can be called before authorization +func (client *Client) ProcessPushNotification(req *ProcessPushNotificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "processPushNotification", + }, + Data: map[string]interface{}{ + "payload": req.Payload, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetPushReceiverIdRequest struct { + // JSON-encoded push notification payload + Payload string `json:"payload"` +} + +// Returns a globally unique push notification subscription identifier for identification of an account, which has received a push notification. Can be called synchronously +func (client *Client) GetPushReceiverId(req *GetPushReceiverIdRequest) (*PushReceiverId, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getPushReceiverId", + }, + Data: map[string]interface{}{ + "payload": req.Payload, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPushReceiverId(result.Data) +} + +type GetRecentlyVisitedTMeUrlsRequest struct { + // Google Play referrer to identify the user + Referrer string `json:"referrer"` +} + +// Returns t.me URLs recently visited by a newly registered user +func (client *Client) GetRecentlyVisitedTMeUrls(req *GetRecentlyVisitedTMeUrlsRequest) (*TMeUrls, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getRecentlyVisitedTMeUrls", + }, + Data: map[string]interface{}{ + "referrer": req.Referrer, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTMeUrls(result.Data) +} + +type SetUserPrivacySettingRulesRequest struct { + // The privacy setting + Setting UserPrivacySetting `json:"setting"` + // The new privacy rules + Rules *UserPrivacySettingRules `json:"rules"` +} + +// Changes user privacy settings +func (client *Client) SetUserPrivacySettingRules(req *SetUserPrivacySettingRulesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setUserPrivacySettingRules", + }, + Data: map[string]interface{}{ + "setting": req.Setting, + "rules": req.Rules, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetUserPrivacySettingRulesRequest struct { + // The privacy setting + Setting UserPrivacySetting `json:"setting"` +} + +// Returns the current privacy settings +func (client *Client) GetUserPrivacySettingRules(req *GetUserPrivacySettingRulesRequest) (*UserPrivacySettingRules, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUserPrivacySettingRules", + }, + Data: map[string]interface{}{ + "setting": req.Setting, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUserPrivacySettingRules(result.Data) +} + +type GetOptionRequest struct { + // The name of the option + Name string `json:"name"` +} + +// Returns the value of an option by its name. (Check the list of available options on https://core.telegram.org/tdlib/options.) Can be called before authorization +func (client *Client) GetOption(req *GetOptionRequest) (OptionValue, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getOption", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeOptionValueBoolean: + return UnmarshalOptionValueBoolean(result.Data) + + case TypeOptionValueEmpty: + return UnmarshalOptionValueEmpty(result.Data) + + case TypeOptionValueInteger: + return UnmarshalOptionValueInteger(result.Data) + + case TypeOptionValueString: + return UnmarshalOptionValueString(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type SetOptionRequest struct { + // The name of the option + Name string `json:"name"` + // The new value of the option + Value OptionValue `json:"value"` +} + +// Sets the value of an option. (Check the list of available options on https://core.telegram.org/tdlib/options.) Only writable options can be set. Can be called before authorization +func (client *Client) SetOption(req *SetOptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setOption", + }, + Data: map[string]interface{}{ + "name": req.Name, + "value": req.Value, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetAccountTtlRequest struct { + // New account TTL + Ttl *AccountTtl `json:"ttl"` +} + +// Changes the period of inactivity after which the account of the current user will automatically be deleted +func (client *Client) SetAccountTtl(req *SetAccountTtlRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setAccountTtl", + }, + Data: map[string]interface{}{ + "ttl": req.Ttl, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns the period of inactivity after which the account of the current user will automatically be deleted +func (client *Client) GetAccountTtl() (*AccountTtl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAccountTtl", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAccountTtl(result.Data) +} + +type DeleteAccountRequest struct { + // The reason why the account was deleted; optional + Reason string `json:"reason"` +} + +// Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account. Can be called before authorization when the current authorization state is authorizationStateWaitPassword +func (client *Client) DeleteAccount(req *DeleteAccountRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteAccount", + }, + Data: map[string]interface{}{ + "reason": req.Reason, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveChatActionBarRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Removes a chat action bar without any other action +func (client *Client) RemoveChatActionBar(req *RemoveChatActionBarRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeChatActionBar", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReportChatRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // The reason for reporting the chat + Reason ChatReportReason `json:"reason"` + // Identifiers of reported messages, if any + MessageIds []int64 `json:"message_ids"` +} + +// Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if this is a private chats with a bot, a private chat with a user sharing their location, a supergroup, or a channel, since other chats can't be checked by moderators +func (client *Client) ReportChat(req *ReportChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "reason": req.Reason, + "message_ids": req.MessageIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetChatStatisticsUrlRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Parameters from "tg://statsrefresh?params=******" link + Parameters string `json:"parameters"` + // Pass true if a URL with the dark theme must be returned + IsDark bool `json:"is_dark"` +} + +// Returns an HTTP URL with the chat statistics. Currently this method of getting the statistics are disabled and can be deleted in the future +func (client *Client) GetChatStatisticsUrl(req *GetChatStatisticsUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatStatisticsUrl", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "parameters": req.Parameters, + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + +type GetChatStatisticsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns detailed statistics about a chat. Currently this method can be used only for supergroups and channels. Can be used only if SupergroupFullInfo.can_get_statistics == true +func (client *Client) GetChatStatistics(req *GetChatStatisticsRequest) (ChatStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatStatistics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeChatStatisticsSupergroup: + return UnmarshalChatStatisticsSupergroup(result.Data) + + case TypeChatStatisticsChannel: + return UnmarshalChatStatisticsChannel(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type GetMessageStatisticsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns detailed statistics about a message. Can be used only if Message.can_get_statistics == true +func (client *Client) GetMessageStatistics(req *GetMessageStatisticsRequest) (*MessageStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageStatistics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageStatistics(result.Data) +} + +type GetStatisticalGraphRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // The token for graph loading + Token string `json:"token"` + // X-value for zoomed in graph or 0 otherwise + X int64 `json:"x"` +} + +// Loads an asynchronous or a zoomed in statistical graph +func (client *Client) GetStatisticalGraph(req *GetStatisticalGraphRequest) (StatisticalGraph, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStatisticalGraph", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "token": req.Token, + "x": req.X, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeStatisticalGraphData: + return UnmarshalStatisticalGraphData(result.Data) + + case TypeStatisticalGraphAsync: + return UnmarshalStatisticalGraphAsync(result.Data) + + case TypeStatisticalGraphError: + return UnmarshalStatisticalGraphError(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type GetStorageStatisticsRequest struct { + // The maximum number of chats with the largest storage usage for which separate statistics should be returned. All other chats will be grouped in entries with chat_id == 0. If the chat info database is not used, the chat_limit is ignored and is always set to 0 + ChatLimit int32 `json:"chat_limit"` +} + +// Returns storage usage statistics. Can be called before authorization +func (client *Client) GetStorageStatistics(req *GetStorageStatisticsRequest) (*StorageStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStorageStatistics", + }, + Data: map[string]interface{}{ + "chat_limit": req.ChatLimit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStorageStatistics(result.Data) +} + +// Quickly returns approximate storage usage statistics. Can be called before authorization +func (client *Client) GetStorageStatisticsFast() (*StorageStatisticsFast, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStorageStatisticsFast", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStorageStatisticsFast(result.Data) +} + +// Returns database statistics +func (client *Client) GetDatabaseStatistics() (*DatabaseStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDatabaseStatistics", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalDatabaseStatistics(result.Data) +} + +type OptimizeStorageRequest struct { + // Limit on the total size of files after deletion. Pass -1 to use the default limit + Size int64 `json:"size"` + // Limit on the time that has passed since the last time a file was accessed (or creation time for some filesystems). Pass -1 to use the default limit + Ttl int32 `json:"ttl"` + // Limit on the total count of files after deletion. Pass -1 to use the default limit + Count int32 `json:"count"` + // The amount of time after the creation of a file during which it can't be deleted, in seconds. Pass -1 to use the default value + ImmunityDelay int32 `json:"immunity_delay"` + // If not empty, only files with the given type(s) are considered. By default, all types except thumbnails, profile photos, stickers and wallpapers are deleted + FileTypes []FileType `json:"file_types"` + // If not empty, only files from the given chats are considered. Use 0 as chat identifier to delete files not belonging to any chat (e.g., profile photos) + ChatIds []int64 `json:"chat_ids"` + // If not empty, files from the given chats are excluded. Use 0 as chat identifier to exclude all files not belonging to any chat (e.g., profile photos) + ExcludeChatIds []int64 `json:"exclude_chat_ids"` + // Pass true if statistics about the files that were deleted must be returned instead of the whole storage usage statistics. Affects only returned statistics + ReturnDeletedFileStatistics bool `json:"return_deleted_file_statistics"` + // Same as in getStorageStatistics. Affects only returned statistics + ChatLimit int32 `json:"chat_limit"` +} + +// Optimizes storage usage, i.e. deletes some files and returns new storage usage statistics. Secret thumbnails can't be deleted +func (client *Client) OptimizeStorage(req *OptimizeStorageRequest) (*StorageStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "optimizeStorage", + }, + Data: map[string]interface{}{ + "size": req.Size, + "ttl": req.Ttl, + "count": req.Count, + "immunity_delay": req.ImmunityDelay, + "file_types": req.FileTypes, + "chat_ids": req.ChatIds, + "exclude_chat_ids": req.ExcludeChatIds, + "return_deleted_file_statistics": req.ReturnDeletedFileStatistics, + "chat_limit": req.ChatLimit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStorageStatistics(result.Data) +} + +type SetNetworkTypeRequest struct { + // The new network type. By default, networkTypeOther + Type NetworkType `json:"type"` +} + +// Sets the current network type. Can be called before authorization. Calling this method forces all network connections to reopen, mitigating the delay in switching between different networks, so it should be called whenever the network is changed, even if the network type remains the same. Network type is used to check whether the library can use the network at all and also for collecting detailed network data usage statistics +func (client *Client) SetNetworkType(req *SetNetworkTypeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setNetworkType", + }, + Data: map[string]interface{}{ + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetNetworkStatisticsRequest struct { + // If true, returns only data for the current library launch + OnlyCurrent bool `json:"only_current"` +} + +// Returns network data usage statistics. Can be called before authorization +func (client *Client) GetNetworkStatistics(req *GetNetworkStatisticsRequest) (*NetworkStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getNetworkStatistics", + }, + Data: map[string]interface{}{ + "only_current": req.OnlyCurrent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalNetworkStatistics(result.Data) +} + +type AddNetworkStatisticsRequest struct { + // The network statistics entry with the data to be added to statistics + Entry NetworkStatisticsEntry `json:"entry"` +} + +// Adds the specified data to data usage statistics. Can be called before authorization +func (client *Client) AddNetworkStatistics(req *AddNetworkStatisticsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addNetworkStatistics", + }, + Data: map[string]interface{}{ + "entry": req.Entry, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Resets all network data usage statistics to zero. Can be called before authorization +func (client *Client) ResetNetworkStatistics() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resetNetworkStatistics", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns auto-download settings presets for the current user +func (client *Client) GetAutoDownloadSettingsPresets() (*AutoDownloadSettingsPresets, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAutoDownloadSettingsPresets", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAutoDownloadSettingsPresets(result.Data) +} + +type SetAutoDownloadSettingsRequest struct { + // New user auto-download settings + Settings *AutoDownloadSettings `json:"settings"` + // Type of the network for which the new settings are applied + Type NetworkType `json:"type"` +} + +// Sets auto-download settings +func (client *Client) SetAutoDownloadSettings(req *SetAutoDownloadSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setAutoDownloadSettings", + }, + Data: map[string]interface{}{ + "settings": req.Settings, + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBankCardInfoRequest struct { + // The bank card number + BankCardNumber string `json:"bank_card_number"` +} + +// Returns information about a bank card +func (client *Client) GetBankCardInfo(req *GetBankCardInfoRequest) (*BankCardInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBankCardInfo", + }, + Data: map[string]interface{}{ + "bank_card_number": req.BankCardNumber, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBankCardInfo(result.Data) +} + +type GetPassportElementRequest struct { + // Telegram Passport element type + Type PassportElementType `json:"type"` + // Password of the current user + Password string `json:"password"` +} + +// Returns one of the available Telegram Passport elements +func (client *Client) GetPassportElement(req *GetPassportElementRequest) (PassportElement, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPassportElement", + }, + Data: map[string]interface{}{ + "type": req.Type, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypePassportElementPersonalDetails: + return UnmarshalPassportElementPersonalDetails(result.Data) + + case TypePassportElementPassport: + return UnmarshalPassportElementPassport(result.Data) + + case TypePassportElementDriverLicense: + return UnmarshalPassportElementDriverLicense(result.Data) + + case TypePassportElementIdentityCard: + return UnmarshalPassportElementIdentityCard(result.Data) + + case TypePassportElementInternalPassport: + return UnmarshalPassportElementInternalPassport(result.Data) + + case TypePassportElementAddress: + return UnmarshalPassportElementAddress(result.Data) + + case TypePassportElementUtilityBill: + return UnmarshalPassportElementUtilityBill(result.Data) + + case TypePassportElementBankStatement: + return UnmarshalPassportElementBankStatement(result.Data) + + case TypePassportElementRentalAgreement: + return UnmarshalPassportElementRentalAgreement(result.Data) + + case TypePassportElementPassportRegistration: + return UnmarshalPassportElementPassportRegistration(result.Data) + + case TypePassportElementTemporaryRegistration: + return UnmarshalPassportElementTemporaryRegistration(result.Data) + + case TypePassportElementPhoneNumber: + return UnmarshalPassportElementPhoneNumber(result.Data) + + case TypePassportElementEmailAddress: + return UnmarshalPassportElementEmailAddress(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type GetAllPassportElementsRequest struct { + // Password of the current user + Password string `json:"password"` +} + +// Returns all available Telegram Passport elements +func (client *Client) GetAllPassportElements(req *GetAllPassportElementsRequest) (*PassportElements, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAllPassportElements", + }, + Data: map[string]interface{}{ + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPassportElements(result.Data) +} + +type SetPassportElementRequest struct { + // Input Telegram Passport element + Element InputPassportElement `json:"element"` + // Password of the current user + Password string `json:"password"` +} + +// Adds an element to the user's Telegram Passport. May return an error with a message "PHONE_VERIFICATION_NEEDED" or "EMAIL_VERIFICATION_NEEDED" if the chosen phone number or the chosen email address must be verified first +func (client *Client) SetPassportElement(req *SetPassportElementRequest) (PassportElement, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPassportElement", + }, + Data: map[string]interface{}{ + "element": req.Element, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypePassportElementPersonalDetails: + return UnmarshalPassportElementPersonalDetails(result.Data) + + case TypePassportElementPassport: + return UnmarshalPassportElementPassport(result.Data) + + case TypePassportElementDriverLicense: + return UnmarshalPassportElementDriverLicense(result.Data) + + case TypePassportElementIdentityCard: + return UnmarshalPassportElementIdentityCard(result.Data) + + case TypePassportElementInternalPassport: + return UnmarshalPassportElementInternalPassport(result.Data) + + case TypePassportElementAddress: + return UnmarshalPassportElementAddress(result.Data) + + case TypePassportElementUtilityBill: + return UnmarshalPassportElementUtilityBill(result.Data) + + case TypePassportElementBankStatement: + return UnmarshalPassportElementBankStatement(result.Data) + + case TypePassportElementRentalAgreement: + return UnmarshalPassportElementRentalAgreement(result.Data) + + case TypePassportElementPassportRegistration: + return UnmarshalPassportElementPassportRegistration(result.Data) + + case TypePassportElementTemporaryRegistration: + return UnmarshalPassportElementTemporaryRegistration(result.Data) + + case TypePassportElementPhoneNumber: + return UnmarshalPassportElementPhoneNumber(result.Data) + + case TypePassportElementEmailAddress: + return UnmarshalPassportElementEmailAddress(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type DeletePassportElementRequest struct { + // Element type + Type PassportElementType `json:"type"` +} + +// Deletes a Telegram Passport element +func (client *Client) DeletePassportElement(req *DeletePassportElementRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deletePassportElement", + }, + Data: map[string]interface{}{ + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetPassportElementErrorsRequest struct { + // User identifier + UserId int32 `json:"user_id"` + // The errors + Errors []*InputPassportElementError `json:"errors"` +} + +// Informs the user that some of the elements in their Telegram Passport contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed +func (client *Client) SetPassportElementErrors(req *SetPassportElementErrorsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPassportElementErrors", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "errors": req.Errors, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetPreferredCountryLanguageRequest struct { + // A two-letter ISO 3166-1 alpha-2 country code + CountryCode string `json:"country_code"` +} + +// Returns an IETF language tag of the language preferred in the country, which should be used to fill native fields in Telegram Passport personal details. Returns a 404 error if unknown +func (client *Client) GetPreferredCountryLanguage(req *GetPreferredCountryLanguageRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPreferredCountryLanguage", + }, + Data: map[string]interface{}{ + "country_code": req.CountryCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type SendPhoneNumberVerificationCodeRequest struct { + // The phone number of the user, in international format + PhoneNumber string `json:"phone_number"` + // Settings for the authentication of the user's phone number + Settings *PhoneNumberAuthenticationSettings `json:"settings"` +} + +// Sends a code to verify a phone number to be added to a user's Telegram Passport +func (client *Client) SendPhoneNumberVerificationCode(req *SendPhoneNumberVerificationCodeRequest) (*AuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendPhoneNumberVerificationCode", + }, + Data: map[string]interface{}{ + "phone_number": req.PhoneNumber, + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAuthenticationCodeInfo(result.Data) +} + +// Re-sends the code to verify a phone number to be added to a user's Telegram Passport +func (client *Client) ResendPhoneNumberVerificationCode() (*AuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendPhoneNumberVerificationCode", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAuthenticationCodeInfo(result.Data) +} + +type CheckPhoneNumberVerificationCodeRequest struct { + // Verification code + Code string `json:"code"` +} + +// Checks the phone number verification code for Telegram Passport +func (client *Client) CheckPhoneNumberVerificationCode(req *CheckPhoneNumberVerificationCodeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkPhoneNumberVerificationCode", + }, + Data: map[string]interface{}{ + "code": req.Code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendEmailAddressVerificationCodeRequest struct { + // Email address + EmailAddress string `json:"email_address"` +} + +// Sends a code to verify an email address to be added to a user's Telegram Passport +func (client *Client) SendEmailAddressVerificationCode(req *SendEmailAddressVerificationCodeRequest) (*EmailAddressAuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendEmailAddressVerificationCode", + }, + Data: map[string]interface{}{ + "email_address": req.EmailAddress, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmailAddressAuthenticationCodeInfo(result.Data) +} + +// Re-sends the code to verify an email address to be added to a user's Telegram Passport +func (client *Client) ResendEmailAddressVerificationCode() (*EmailAddressAuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendEmailAddressVerificationCode", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmailAddressAuthenticationCodeInfo(result.Data) +} + +type CheckEmailAddressVerificationCodeRequest struct { + // Verification code + Code string `json:"code"` +} + +// Checks the email address verification code for Telegram Passport +func (client *Client) CheckEmailAddressVerificationCode(req *CheckEmailAddressVerificationCodeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkEmailAddressVerificationCode", + }, + Data: map[string]interface{}{ + "code": req.Code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetPassportAuthorizationFormRequest struct { + // User identifier of the service's bot + BotUserId int32 `json:"bot_user_id"` + // Telegram Passport element types requested by the service + Scope string `json:"scope"` + // Service's public_key + PublicKey string `json:"public_key"` + // Authorization form nonce provided by the service + Nonce string `json:"nonce"` +} + +// Returns a Telegram Passport authorization form for sharing data with a service +func (client *Client) GetPassportAuthorizationForm(req *GetPassportAuthorizationFormRequest) (*PassportAuthorizationForm, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPassportAuthorizationForm", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "scope": req.Scope, + "public_key": req.PublicKey, + "nonce": req.Nonce, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPassportAuthorizationForm(result.Data) +} + +type GetPassportAuthorizationFormAvailableElementsRequest struct { + // Authorization form identifier + AutorizationFormId int32 `json:"autorization_form_id"` + // Password of the current user + Password string `json:"password"` +} + +// Returns already available Telegram Passport elements suitable for completing a Telegram Passport authorization form. Result can be received only once for each authorization form +func (client *Client) GetPassportAuthorizationFormAvailableElements(req *GetPassportAuthorizationFormAvailableElementsRequest) (*PassportElementsWithErrors, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPassportAuthorizationFormAvailableElements", + }, + Data: map[string]interface{}{ + "autorization_form_id": req.AutorizationFormId, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPassportElementsWithErrors(result.Data) +} + +type SendPassportAuthorizationFormRequest struct { + // Authorization form identifier + AutorizationFormId int32 `json:"autorization_form_id"` + // Types of Telegram Passport elements chosen by user to complete the authorization form + Types []PassportElementType `json:"types"` +} + +// Sends a Telegram Passport authorization form, effectively sharing data with the service. This method must be called after getPassportAuthorizationFormAvailableElements if some previously available elements are going to be reused +func (client *Client) SendPassportAuthorizationForm(req *SendPassportAuthorizationFormRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendPassportAuthorizationForm", + }, + Data: map[string]interface{}{ + "autorization_form_id": req.AutorizationFormId, + "types": req.Types, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendPhoneNumberConfirmationCodeRequest struct { + // Value of the "hash" parameter from the link + Hash string `json:"hash"` + // Value of the "phone" parameter from the link + PhoneNumber string `json:"phone_number"` + // Settings for the authentication of the user's phone number + Settings *PhoneNumberAuthenticationSettings `json:"settings"` +} + +// Sends phone number confirmation code. Should be called when user presses "https://t.me/confirmphone?phone=*******&hash=**********" or "tg://confirmphone?phone=*******&hash=**********" link +func (client *Client) SendPhoneNumberConfirmationCode(req *SendPhoneNumberConfirmationCodeRequest) (*AuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendPhoneNumberConfirmationCode", + }, + Data: map[string]interface{}{ + "hash": req.Hash, + "phone_number": req.PhoneNumber, + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAuthenticationCodeInfo(result.Data) +} + +// Resends phone number confirmation code +func (client *Client) ResendPhoneNumberConfirmationCode() (*AuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendPhoneNumberConfirmationCode", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAuthenticationCodeInfo(result.Data) +} + +type CheckPhoneNumberConfirmationCodeRequest struct { + // The phone number confirmation code + Code string `json:"code"` +} + +// Checks phone number confirmation code +func (client *Client) CheckPhoneNumberConfirmationCode(req *CheckPhoneNumberConfirmationCodeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkPhoneNumberConfirmationCode", + }, + Data: map[string]interface{}{ + "code": req.Code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBotUpdatesStatusRequest struct { + // The number of pending updates + PendingUpdateCount int32 `json:"pending_update_count"` + // The last error message + ErrorMessage string `json:"error_message"` +} + +// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only +func (client *Client) SetBotUpdatesStatus(req *SetBotUpdatesStatusRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBotUpdatesStatus", + }, + Data: map[string]interface{}{ + "pending_update_count": req.PendingUpdateCount, + "error_message": req.ErrorMessage, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type UploadStickerFileRequest struct { + // Sticker file owner + UserId int32 `json:"user_id"` + // PNG image with the sticker; must be up to 512 KB in size and fit in 512x512 square + PngSticker InputFile `json:"png_sticker"` +} + +// Uploads a PNG image with a sticker; for bots only; returns the uploaded file +func (client *Client) UploadStickerFile(req *UploadStickerFileRequest) (*File, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "uploadStickerFile", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "png_sticker": req.PngSticker, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFile(result.Data) +} + +type CreateNewStickerSetRequest struct { + // Sticker set owner + UserId int32 `json:"user_id"` + // Sticker set title; 1-64 characters + Title string `json:"title"` + // Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive); 1-64 characters + Name string `json:"name"` + // True, if stickers are masks. Animated stickers can't be masks + IsMasks bool `json:"is_masks"` + // List of stickers to be added to the set; must be non-empty. All stickers must be of the same type + Stickers []InputSticker `json:"stickers"` +} + +// Creates a new sticker set; for bots only. Returns the newly created sticker set +func (client *Client) CreateNewStickerSet(req *CreateNewStickerSetRequest) (*StickerSet, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createNewStickerSet", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "title": req.Title, + "name": req.Name, + "is_masks": req.IsMasks, + "stickers": req.Stickers, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSet(result.Data) +} + +type AddStickerToSetRequest struct { + // Sticker set owner + UserId int32 `json:"user_id"` + // Sticker set name + Name string `json:"name"` + // Sticker to add to the set + Sticker InputSticker `json:"sticker"` +} + +// Adds a new sticker to a set; for bots only. Returns the sticker set +func (client *Client) AddStickerToSet(req *AddStickerToSetRequest) (*StickerSet, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addStickerToSet", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "name": req.Name, + "sticker": req.Sticker, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSet(result.Data) +} + +type SetStickerSetThumbnailRequest struct { + // Sticker set owner + UserId int32 `json:"user_id"` + // Sticker set name + Name string `json:"name"` + // Thumbnail to set in PNG or TGS format. Animated thumbnail must be set for animated sticker sets and only for them. Pass a zero InputFileId to delete the thumbnail + Thumbnail InputFile `json:"thumbnail"` +} + +// Sets a sticker set thumbnail; for bots only. Returns the sticker set +func (client *Client) SetStickerSetThumbnail(req *SetStickerSetThumbnailRequest) (*StickerSet, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setStickerSetThumbnail", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "name": req.Name, + "thumbnail": req.Thumbnail, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSet(result.Data) +} + +type SetStickerPositionInSetRequest struct { + // Sticker + Sticker InputFile `json:"sticker"` + // New position of the sticker in the set, zero-based + Position int32 `json:"position"` +} + +// Changes the position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot +func (client *Client) SetStickerPositionInSet(req *SetStickerPositionInSetRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setStickerPositionInSet", + }, + Data: map[string]interface{}{ + "sticker": req.Sticker, + "position": req.Position, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveStickerFromSetRequest struct { + // Sticker + Sticker InputFile `json:"sticker"` +} + +// Removes a sticker from the set to which it belongs; for bots only. The sticker set must have been created by the bot +func (client *Client) RemoveStickerFromSet(req *RemoveStickerFromSetRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeStickerFromSet", + }, + Data: map[string]interface{}{ + "sticker": req.Sticker, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetMapThumbnailFileRequest struct { + // Location of the map center + Location *Location `json:"location"` + // Map zoom level; 13-20 + Zoom int32 `json:"zoom"` + // Map width in pixels before applying scale; 16-1024 + Width int32 `json:"width"` + // Map height in pixels before applying scale; 16-1024 + Height int32 `json:"height"` + // Map scale; 1-3 + Scale int32 `json:"scale"` + // Identifier of a chat, in which the thumbnail will be shown. Use 0 if unknown + ChatId int64 `json:"chat_id"` +} + +// Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded +func (client *Client) GetMapThumbnailFile(req *GetMapThumbnailFileRequest) (*File, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMapThumbnailFile", + }, + Data: map[string]interface{}{ + "location": req.Location, + "zoom": req.Zoom, + "width": req.Width, + "height": req.Height, + "scale": req.Scale, + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFile(result.Data) +} + +type AcceptTermsOfServiceRequest struct { + // Terms of service identifier + TermsOfServiceId string `json:"terms_of_service_id"` +} + +// Accepts Telegram terms of services +func (client *Client) AcceptTermsOfService(req *AcceptTermsOfServiceRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "acceptTermsOfService", + }, + Data: map[string]interface{}{ + "terms_of_service_id": req.TermsOfServiceId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendCustomRequestRequest struct { + // The method name + Method string `json:"method"` + // JSON-serialized method parameters + Parameters string `json:"parameters"` +} + +// Sends a custom request; for bots only +func (client *Client) SendCustomRequest(req *SendCustomRequestRequest) (*CustomRequestResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendCustomRequest", + }, + Data: map[string]interface{}{ + "method": req.Method, + "parameters": req.Parameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCustomRequestResult(result.Data) +} + +type AnswerCustomQueryRequest struct { + // Identifier of a custom query + CustomQueryId JsonInt64 `json:"custom_query_id"` + // JSON-serialized answer to the query + Data string `json:"data"` +} + +// Answers a custom query; for bots only +func (client *Client) AnswerCustomQuery(req *AnswerCustomQueryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "answerCustomQuery", + }, + Data: map[string]interface{}{ + "custom_query_id": req.CustomQueryId, + "data": req.Data, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetAlarmRequest struct { + // Number of seconds before the function returns + Seconds float64 `json:"seconds"` +} + +// Succeeds after a specified amount of time has passed. Can be called before initialization +func (client *Client) SetAlarm(req *SetAlarmRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setAlarm", + }, + Data: map[string]interface{}{ + "seconds": req.Seconds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns information about existing countries. Can be called before authorization +func (client *Client) GetCountries() (*Countries, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getCountries", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCountries(result.Data) +} + +// Uses current user IP address to find their country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization +func (client *Client) GetCountryCode() (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getCountryCode", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type GetPhoneNumberInfoRequest struct { + // The phone number prefix + PhoneNumberPrefix string `json:"phone_number_prefix"` +} + +// Returns information about a phone number by its prefix. Can be called before authorization +func (client *Client) GetPhoneNumberInfo(req *GetPhoneNumberInfoRequest) (*PhoneNumberInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPhoneNumberInfo", + }, + Data: map[string]interface{}{ + "phone_number_prefix": req.PhoneNumberPrefix, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPhoneNumberInfo(result.Data) +} + +// Returns the default text for invitation messages to be used as a placeholder when the current user invites friends to Telegram +func (client *Client) GetInviteText() (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getInviteText", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type GetDeepLinkInfoRequest struct { + // The link + Link string `json:"link"` +} + +// Returns information about a tg:// deep link. Use "tg://need_update_for_some_feature" or "tg:some_unsupported_feature" for testing. Returns a 404 error for unknown links. Can be called before authorization +func (client *Client) GetDeepLinkInfo(req *GetDeepLinkInfoRequest) (*DeepLinkInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDeepLinkInfo", + }, + Data: map[string]interface{}{ + "link": req.Link, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalDeepLinkInfo(result.Data) +} + +// Returns application config, provided by the server. Can be called before authorization +func (client *Client) GetApplicationConfig() (JsonValue, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getApplicationConfig", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeJsonValueNull: + return UnmarshalJsonValueNull(result.Data) + + case TypeJsonValueBoolean: + return UnmarshalJsonValueBoolean(result.Data) + + case TypeJsonValueNumber: + return UnmarshalJsonValueNumber(result.Data) + + case TypeJsonValueString: + return UnmarshalJsonValueString(result.Data) + + case TypeJsonValueArray: + return UnmarshalJsonValueArray(result.Data) + + case TypeJsonValueObject: + return UnmarshalJsonValueObject(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type SaveApplicationLogEventRequest struct { + // Event type + Type string `json:"type"` + // Optional chat identifier, associated with the event + ChatId int64 `json:"chat_id"` + // The log event data + Data JsonValue `json:"data"` +} + +// Saves application log event on the server. Can be called before authorization +func (client *Client) SaveApplicationLogEvent(req *SaveApplicationLogEventRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "saveApplicationLogEvent", + }, + Data: map[string]interface{}{ + "type": req.Type, + "chat_id": req.ChatId, + "data": req.Data, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddProxyRequest struct { + // Proxy server IP address + Server string `json:"server"` + // Proxy server port + Port int32 `json:"port"` + // True, if the proxy should be enabled + Enable bool `json:"enable"` + // Proxy type + Type ProxyType `json:"type"` +} + +// Adds a proxy server for network requests. Can be called before authorization +func (client *Client) AddProxy(req *AddProxyRequest) (*Proxy, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addProxy", + }, + Data: map[string]interface{}{ + "server": req.Server, + "port": req.Port, + "enable": req.Enable, + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalProxy(result.Data) +} + +type EditProxyRequest struct { + // Proxy identifier + ProxyId int32 `json:"proxy_id"` + // Proxy server IP address + Server string `json:"server"` + // Proxy server port + Port int32 `json:"port"` + // True, if the proxy should be enabled + Enable bool `json:"enable"` + // Proxy type + Type ProxyType `json:"type"` +} + +// Edits an existing proxy server for network requests. Can be called before authorization +func (client *Client) EditProxy(req *EditProxyRequest) (*Proxy, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editProxy", + }, + Data: map[string]interface{}{ + "proxy_id": req.ProxyId, + "server": req.Server, + "port": req.Port, + "enable": req.Enable, + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalProxy(result.Data) +} + +type EnableProxyRequest struct { + // Proxy identifier + ProxyId int32 `json:"proxy_id"` +} + +// Enables a proxy. Only one proxy can be enabled at a time. Can be called before authorization +func (client *Client) EnableProxy(req *EnableProxyRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "enableProxy", + }, + Data: map[string]interface{}{ + "proxy_id": req.ProxyId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Disables the currently enabled proxy. Can be called before authorization +func (client *Client) DisableProxy() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "disableProxy", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveProxyRequest struct { + // Proxy identifier + ProxyId int32 `json:"proxy_id"` +} + +// Removes a proxy server. Can be called before authorization +func (client *Client) RemoveProxy(req *RemoveProxyRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeProxy", + }, + Data: map[string]interface{}{ + "proxy_id": req.ProxyId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns list of proxies that are currently set up. Can be called before authorization +func (client *Client) GetProxies() (*Proxies, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getProxies", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalProxies(result.Data) +} + +type GetProxyLinkRequest struct { + // Proxy identifier + ProxyId int32 `json:"proxy_id"` +} + +// Returns an HTTPS link, which can be used to add a proxy. Available only for SOCKS5 and MTProto proxies. Can be called before authorization +func (client *Client) GetProxyLink(req *GetProxyLinkRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getProxyLink", + }, + Data: map[string]interface{}{ + "proxy_id": req.ProxyId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type PingProxyRequest struct { + // Proxy identifier. Use 0 to ping a Telegram server without a proxy + ProxyId int32 `json:"proxy_id"` +} + +// Computes time needed to receive a response from a Telegram server through a proxy. Can be called before authorization +func (client *Client) PingProxy(req *PingProxyRequest) (*Seconds, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "pingProxy", + }, + Data: map[string]interface{}{ + "proxy_id": req.ProxyId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSeconds(result.Data) +} + +type SetLogStreamRequest struct { + // New log stream + LogStream LogStream `json:"log_stream"` +} + +// Sets new log stream for internal logging of TDLib. Can be called synchronously +func (client *Client) SetLogStream(req *SetLogStreamRequest) (*Ok, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "setLogStream", + }, + Data: map[string]interface{}{ + "log_stream": req.LogStream, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns information about currently used log stream for internal logging of TDLib. Can be called synchronously +func (client *Client) GetLogStream() (LogStream, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getLogStream", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeLogStreamDefault: + return UnmarshalLogStreamDefault(result.Data) + + case TypeLogStreamFile: + return UnmarshalLogStreamFile(result.Data) + + case TypeLogStreamEmpty: + return UnmarshalLogStreamEmpty(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type SetLogVerbosityLevelRequest struct { + // New value of the verbosity level for logging. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug, value greater than 5 and up to 1023 can be used to enable even more logging + NewVerbosityLevel int32 `json:"new_verbosity_level"` +} + +// Sets the verbosity level of the internal logging of TDLib. Can be called synchronously +func (client *Client) SetLogVerbosityLevel(req *SetLogVerbosityLevelRequest) (*Ok, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "setLogVerbosityLevel", + }, + Data: map[string]interface{}{ + "new_verbosity_level": req.NewVerbosityLevel, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns current verbosity level of the internal logging of TDLib. Can be called synchronously +func (client *Client) GetLogVerbosityLevel() (*LogVerbosityLevel, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getLogVerbosityLevel", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLogVerbosityLevel(result.Data) +} + +// Returns list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously +func (client *Client) GetLogTags() (*LogTags, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getLogTags", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLogTags(result.Data) +} + +type SetLogTagVerbosityLevelRequest struct { + // Logging tag to change verbosity level + Tag string `json:"tag"` + // New verbosity level; 1-1024 + NewVerbosityLevel int32 `json:"new_verbosity_level"` +} + +// Sets the verbosity level for a specified TDLib internal log tag. Can be called synchronously +func (client *Client) SetLogTagVerbosityLevel(req *SetLogTagVerbosityLevelRequest) (*Ok, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "setLogTagVerbosityLevel", + }, + Data: map[string]interface{}{ + "tag": req.Tag, + "new_verbosity_level": req.NewVerbosityLevel, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetLogTagVerbosityLevelRequest struct { + // Logging tag to change verbosity level + Tag string `json:"tag"` +} + +// Returns current verbosity level for a specified TDLib internal log tag. Can be called synchronously +func (client *Client) GetLogTagVerbosityLevel(req *GetLogTagVerbosityLevelRequest) (*LogVerbosityLevel, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getLogTagVerbosityLevel", + }, + Data: map[string]interface{}{ + "tag": req.Tag, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLogVerbosityLevel(result.Data) +} + +type AddLogMessageRequest struct { + // The minimum verbosity level needed for the message to be logged, 0-1023 + VerbosityLevel int32 `json:"verbosity_level"` + // Text of a message to log + Text string `json:"text"` +} + +// Adds a message to TDLib internal log. Can be called synchronously +func (client *Client) AddLogMessage(req *AddLogMessageRequest) (*Ok, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "addLogMessage", + }, + Data: map[string]interface{}{ + "verbosity_level": req.VerbosityLevel, + "text": req.Text, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Does nothing; for testing only. This is an offline method. Can be called before authorization +func (client *Client) TestCallEmpty() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testCallEmpty", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type TestCallStringRequest struct { + // String to return + X string `json:"x"` +} + +// Returns the received string; for testing only. This is an offline method. Can be called before authorization +func (client *Client) TestCallString(req *TestCallStringRequest) (*TestString, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testCallString", + }, + Data: map[string]interface{}{ + "x": req.X, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTestString(result.Data) +} + +type TestCallBytesRequest struct { + // Bytes to return + X []byte `json:"x"` +} + +// Returns the received bytes; for testing only. This is an offline method. Can be called before authorization +func (client *Client) TestCallBytes(req *TestCallBytesRequest) (*TestBytes, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testCallBytes", + }, + Data: map[string]interface{}{ + "x": req.X, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTestBytes(result.Data) +} + +type TestCallVectorIntRequest struct { + // Vector of numbers to return + X []int32 `json:"x"` +} + +// Returns the received vector of numbers; for testing only. This is an offline method. Can be called before authorization +func (client *Client) TestCallVectorInt(req *TestCallVectorIntRequest) (*TestVectorInt, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testCallVectorInt", + }, + Data: map[string]interface{}{ + "x": req.X, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTestVectorInt(result.Data) +} + +type TestCallVectorIntObjectRequest struct { + // Vector of objects to return + X []*TestInt `json:"x"` +} + +// Returns the received vector of objects containing a number; for testing only. This is an offline method. Can be called before authorization +func (client *Client) TestCallVectorIntObject(req *TestCallVectorIntObjectRequest) (*TestVectorIntObject, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testCallVectorIntObject", + }, + Data: map[string]interface{}{ + "x": req.X, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTestVectorIntObject(result.Data) +} + +type TestCallVectorStringRequest struct { + // Vector of strings to return + X []string `json:"x"` +} + +// Returns the received vector of strings; for testing only. This is an offline method. Can be called before authorization +func (client *Client) TestCallVectorString(req *TestCallVectorStringRequest) (*TestVectorString, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testCallVectorString", + }, + Data: map[string]interface{}{ + "x": req.X, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTestVectorString(result.Data) +} + +type TestCallVectorStringObjectRequest struct { + // Vector of objects to return + X []*TestString `json:"x"` +} + +// Returns the received vector of objects containing a string; for testing only. This is an offline method. Can be called before authorization +func (client *Client) TestCallVectorStringObject(req *TestCallVectorStringObjectRequest) (*TestVectorStringObject, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testCallVectorStringObject", + }, + Data: map[string]interface{}{ + "x": req.X, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTestVectorStringObject(result.Data) +} + +type TestSquareIntRequest struct { + // Number to square + X int32 `json:"x"` +} + +// Returns the squared received number; for testing only. This is an offline method. Can be called before authorization +func (client *Client) TestSquareInt(req *TestSquareIntRequest) (*TestInt, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testSquareInt", + }, + Data: map[string]interface{}{ + "x": req.X, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTestInt(result.Data) +} + +// Sends a simple network request to the Telegram servers; for testing only. Can be called before authorization +func (client *Client) TestNetwork() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testNetwork", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type TestProxyRequest struct { + // Proxy server IP address + Server string `json:"server"` + // Proxy server port + Port int32 `json:"port"` + // Proxy type + Type ProxyType `json:"type"` + // Identifier of a datacenter, with which to test connection + DcId int32 `json:"dc_id"` + // The maximum overall timeout for the request + Timeout float64 `json:"timeout"` +} + +// Sends a simple network request to the Telegram servers via proxy; for testing only. Can be called before authorization +func (client *Client) TestProxy(req *TestProxyRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testProxy", + }, + Data: map[string]interface{}{ + "server": req.Server, + "port": req.Port, + "type": req.Type, + "dc_id": req.DcId, + "timeout": req.Timeout, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Forces an updates.getDifference call to the Telegram servers; for testing only +func (client *Client) TestGetDifference() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testGetDifference", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Does nothing and ensures that the Update object is used; for testing only. This is an offline method. Can be called before authorization +func (client *Client) TestUseUpdate() (Update, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "testUseUpdate", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeUpdateAuthorizationState: + return UnmarshalUpdateAuthorizationState(result.Data) + + case TypeUpdateNewMessage: + return UnmarshalUpdateNewMessage(result.Data) + + case TypeUpdateMessageSendAcknowledged: + return UnmarshalUpdateMessageSendAcknowledged(result.Data) + + case TypeUpdateMessageSendSucceeded: + return UnmarshalUpdateMessageSendSucceeded(result.Data) + + case TypeUpdateMessageSendFailed: + return UnmarshalUpdateMessageSendFailed(result.Data) + + case TypeUpdateMessageContent: + return UnmarshalUpdateMessageContent(result.Data) + + case TypeUpdateMessageEdited: + return UnmarshalUpdateMessageEdited(result.Data) + + case TypeUpdateMessageIsPinned: + return UnmarshalUpdateMessageIsPinned(result.Data) + + case TypeUpdateMessageInteractionInfo: + return UnmarshalUpdateMessageInteractionInfo(result.Data) + + case TypeUpdateMessageContentOpened: + return UnmarshalUpdateMessageContentOpened(result.Data) + + case TypeUpdateMessageMentionRead: + return UnmarshalUpdateMessageMentionRead(result.Data) + + case TypeUpdateMessageLiveLocationViewed: + return UnmarshalUpdateMessageLiveLocationViewed(result.Data) + + case TypeUpdateNewChat: + return UnmarshalUpdateNewChat(result.Data) + + case TypeUpdateChatTitle: + return UnmarshalUpdateChatTitle(result.Data) + + case TypeUpdateChatPhoto: + return UnmarshalUpdateChatPhoto(result.Data) + + case TypeUpdateChatPermissions: + return UnmarshalUpdateChatPermissions(result.Data) + + case TypeUpdateChatLastMessage: + return UnmarshalUpdateChatLastMessage(result.Data) + + case TypeUpdateChatPosition: + return UnmarshalUpdateChatPosition(result.Data) + + case TypeUpdateChatIsMarkedAsUnread: + return UnmarshalUpdateChatIsMarkedAsUnread(result.Data) + + case TypeUpdateChatIsBlocked: + return UnmarshalUpdateChatIsBlocked(result.Data) + + case TypeUpdateChatHasScheduledMessages: + return UnmarshalUpdateChatHasScheduledMessages(result.Data) + + case TypeUpdateChatDefaultDisableNotification: + return UnmarshalUpdateChatDefaultDisableNotification(result.Data) + + case TypeUpdateChatReadInbox: + return UnmarshalUpdateChatReadInbox(result.Data) + + case TypeUpdateChatReadOutbox: + return UnmarshalUpdateChatReadOutbox(result.Data) + + case TypeUpdateChatUnreadMentionCount: + return UnmarshalUpdateChatUnreadMentionCount(result.Data) + + case TypeUpdateChatNotificationSettings: + return UnmarshalUpdateChatNotificationSettings(result.Data) + + case TypeUpdateScopeNotificationSettings: + return UnmarshalUpdateScopeNotificationSettings(result.Data) + + case TypeUpdateChatActionBar: + return UnmarshalUpdateChatActionBar(result.Data) + + case TypeUpdateChatReplyMarkup: + return UnmarshalUpdateChatReplyMarkup(result.Data) + + case TypeUpdateChatDraftMessage: + return UnmarshalUpdateChatDraftMessage(result.Data) + + case TypeUpdateChatFilters: + return UnmarshalUpdateChatFilters(result.Data) + + case TypeUpdateChatOnlineMemberCount: + return UnmarshalUpdateChatOnlineMemberCount(result.Data) + + case TypeUpdateNotification: + return UnmarshalUpdateNotification(result.Data) + + case TypeUpdateNotificationGroup: + return UnmarshalUpdateNotificationGroup(result.Data) + + case TypeUpdateActiveNotifications: + return UnmarshalUpdateActiveNotifications(result.Data) + + case TypeUpdateHavePendingNotifications: + return UnmarshalUpdateHavePendingNotifications(result.Data) + + case TypeUpdateDeleteMessages: + return UnmarshalUpdateDeleteMessages(result.Data) + + case TypeUpdateUserChatAction: + return UnmarshalUpdateUserChatAction(result.Data) + + case TypeUpdateUserStatus: + return UnmarshalUpdateUserStatus(result.Data) + + case TypeUpdateUser: + return UnmarshalUpdateUser(result.Data) + + case TypeUpdateBasicGroup: + return UnmarshalUpdateBasicGroup(result.Data) + + case TypeUpdateSupergroup: + return UnmarshalUpdateSupergroup(result.Data) + + case TypeUpdateSecretChat: + return UnmarshalUpdateSecretChat(result.Data) + + case TypeUpdateUserFullInfo: + return UnmarshalUpdateUserFullInfo(result.Data) + + case TypeUpdateBasicGroupFullInfo: + return UnmarshalUpdateBasicGroupFullInfo(result.Data) + + case TypeUpdateSupergroupFullInfo: + return UnmarshalUpdateSupergroupFullInfo(result.Data) + + case TypeUpdateServiceNotification: + return UnmarshalUpdateServiceNotification(result.Data) + + case TypeUpdateFile: + return UnmarshalUpdateFile(result.Data) + + case TypeUpdateFileGenerationStart: + return UnmarshalUpdateFileGenerationStart(result.Data) + + case TypeUpdateFileGenerationStop: + return UnmarshalUpdateFileGenerationStop(result.Data) + + case TypeUpdateCall: + return UnmarshalUpdateCall(result.Data) + + case TypeUpdateNewCallSignalingData: + return UnmarshalUpdateNewCallSignalingData(result.Data) + + case TypeUpdateUserPrivacySettingRules: + return UnmarshalUpdateUserPrivacySettingRules(result.Data) + + case TypeUpdateUnreadMessageCount: + return UnmarshalUpdateUnreadMessageCount(result.Data) + + case TypeUpdateUnreadChatCount: + return UnmarshalUpdateUnreadChatCount(result.Data) + + case TypeUpdateOption: + return UnmarshalUpdateOption(result.Data) + + case TypeUpdateStickerSet: + return UnmarshalUpdateStickerSet(result.Data) + + case TypeUpdateInstalledStickerSets: + return UnmarshalUpdateInstalledStickerSets(result.Data) + + case TypeUpdateTrendingStickerSets: + return UnmarshalUpdateTrendingStickerSets(result.Data) + + case TypeUpdateRecentStickers: + return UnmarshalUpdateRecentStickers(result.Data) + + case TypeUpdateFavoriteStickers: + return UnmarshalUpdateFavoriteStickers(result.Data) + + case TypeUpdateSavedAnimations: + return UnmarshalUpdateSavedAnimations(result.Data) + + case TypeUpdateSelectedBackground: + return UnmarshalUpdateSelectedBackground(result.Data) + + case TypeUpdateLanguagePackStrings: + return UnmarshalUpdateLanguagePackStrings(result.Data) + + case TypeUpdateConnectionState: + return UnmarshalUpdateConnectionState(result.Data) + + case TypeUpdateTermsOfService: + return UnmarshalUpdateTermsOfService(result.Data) + + case TypeUpdateUsersNearby: + return UnmarshalUpdateUsersNearby(result.Data) + + case TypeUpdateDiceEmojis: + return UnmarshalUpdateDiceEmojis(result.Data) + + case TypeUpdateAnimationSearchParameters: + return UnmarshalUpdateAnimationSearchParameters(result.Data) + + case TypeUpdateSuggestedActions: + return UnmarshalUpdateSuggestedActions(result.Data) + + case TypeUpdateNewInlineQuery: + return UnmarshalUpdateNewInlineQuery(result.Data) + + case TypeUpdateNewChosenInlineResult: + return UnmarshalUpdateNewChosenInlineResult(result.Data) + + case TypeUpdateNewCallbackQuery: + return UnmarshalUpdateNewCallbackQuery(result.Data) + + case TypeUpdateNewInlineCallbackQuery: + return UnmarshalUpdateNewInlineCallbackQuery(result.Data) + + case TypeUpdateNewShippingQuery: + return UnmarshalUpdateNewShippingQuery(result.Data) + + case TypeUpdateNewPreCheckoutQuery: + return UnmarshalUpdateNewPreCheckoutQuery(result.Data) + + case TypeUpdateNewCustomEvent: + return UnmarshalUpdateNewCustomEvent(result.Data) + + case TypeUpdateNewCustomQuery: + return UnmarshalUpdateNewCustomQuery(result.Data) + + case TypeUpdatePoll: + return UnmarshalUpdatePoll(result.Data) + + case TypeUpdatePollAnswer: + return UnmarshalUpdatePollAnswer(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type TestReturnErrorRequest struct { + // The error to be returned + Error *Error `json:"error"` +} + +// Returns the specified error and ensures that the Error object is used; for testing only. Can be called synchronously +func (client *Client) TestReturnError(req *TestReturnErrorRequest) (*Error, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "testReturnError", + }, + Data: map[string]interface{}{ + "error": req.Error, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalError(result.Data) +} diff --git a/client/listener.go b/client/listener.go new file mode 100644 index 0000000..30c122e --- /dev/null +++ b/client/listener.go @@ -0,0 +1,66 @@ +package client + +import ( + "sync" +) + +func newListenerStore() *listenerStore { + return &listenerStore{ + listeners: []*Listener{}, + } +} + +type listenerStore struct { + sync.Mutex + listeners []*Listener +} + +func (store *listenerStore) Add(listener *Listener) { + store.Lock() + defer store.Unlock() + + store.listeners = append(store.listeners, listener) +} + +func (store *listenerStore) Listeners() []*Listener { + store.Lock() + defer store.Unlock() + + return store.listeners +} + +func (store *listenerStore) gc() { + store.Lock() + defer store.Unlock() + + oldListeners := store.listeners + + store.listeners = []*Listener{} + + for _, listener := range oldListeners { + if listener.IsActive() { + store.listeners = append(store.listeners, listener) + } + } +} + +type Listener struct { + mu sync.Mutex + isActive bool + Updates chan Type +} + +func (listener *Listener) Close() { + listener.mu.Lock() + defer listener.mu.Unlock() + + listener.isActive = false + close(listener.Updates) +} + +func (listener *Listener) IsActive() bool { + listener.mu.Lock() + defer listener.mu.Unlock() + + return listener.isActive +} diff --git a/client/puller/chat.go b/client/puller/chat.go new file mode 100644 index 0000000..eb5eb8b --- /dev/null +++ b/client/puller/chat.go @@ -0,0 +1,52 @@ +package puller + +import ( + "github.com/astravexton/go-tdlib/client" +) + +func ChatHistory(tdlibClient *client.Client, chatId int64) (chan *client.Message, chan error) { + messageChan := make(chan *client.Message, 10) + errChan := make(chan error, 1) + + var fromMessageId int64 = 0 + var offset int32 = 0 + var limit int32 = 100 + + go chatHistory(tdlibClient, messageChan, errChan, chatId, fromMessageId, offset, limit, false) + + return messageChan, errChan +} + +func chatHistory(tdlibClient *client.Client, messageChan chan *client.Message, errChan chan error, chatId int64, fromMessageId int64, offset int32, limit int32, onlyLocal bool) { + defer func() { + close(messageChan) + close(errChan) + }() + + for { + messages, err := tdlibClient.GetChatHistory(&client.GetChatHistoryRequest{ + ChatId: chatId, + FromMessageId: fromMessageId, + Offset: offset, + Limit: limit, + OnlyLocal: onlyLocal, + }) + if err != nil { + errChan <- err + + return + } + + if len(messages.Messages) == 0 { + errChan <- EOP + + break + } + + for _, message := range messages.Messages { + fromMessageId = message.Id + + messageChan <- message + } + } +} diff --git a/client/puller/chats.go b/client/puller/chats.go new file mode 100644 index 0000000..88850e4 --- /dev/null +++ b/client/puller/chats.go @@ -0,0 +1,62 @@ +package puller + +import ( + "math" + + "github.com/astravexton/go-tdlib/client" +) + +func Chats(tdlibClient *client.Client) (chan *client.Chat, chan error) { + chatChan := make(chan *client.Chat, 10) + errChan := make(chan error, 1) + + var offsetOrder client.JsonInt64 = math.MaxInt64 + var offsetChatId int64 = 0 + var limit int32 = 100 + + go chats(tdlibClient, chatChan, errChan, offsetOrder, offsetChatId, limit) + + return chatChan, errChan +} + +func chats(tdlibClient *client.Client, chatChan chan *client.Chat, errChan chan error, offsetOrder client.JsonInt64, offsetChatId int64, limit int32) { + defer func() { + close(chatChan) + close(errChan) + }() + + for { + chats, err := tdlibClient.GetChats(&client.GetChatsRequest{ + OffsetOrder: offsetOrder, + OffsetChatId: offsetChatId, + Limit: limit, + }) + if err != nil { + errChan <- err + + return + } + + if len(chats.ChatIds) == 0 { + errChan <- EOP + + break + } + + for _, chatId := range chats.ChatIds { + chat, err := tdlibClient.GetChat(&client.GetChatRequest{ + ChatId: chatId, + }) + if err != nil { + errChan <- err + + return + } + + offsetOrder = chat.Order + offsetChatId = chat.Id + + chatChan <- chat + } + } +} diff --git a/client/puller/error.go b/client/puller/error.go new file mode 100644 index 0000000..b82bd18 --- /dev/null +++ b/client/puller/error.go @@ -0,0 +1,7 @@ +package puller + +import ( + "errors" +) + +var EOP = errors.New("end of pull") diff --git a/client/puller/supergroup.go b/client/puller/supergroup.go new file mode 100644 index 0000000..9be7ebc --- /dev/null +++ b/client/puller/supergroup.go @@ -0,0 +1,53 @@ +package puller + +import ( + "github.com/astravexton/go-tdlib/client" +) + +func SupergroupMembers(tdlibClient *client.Client, supergroupId int32) (chan *client.ChatMember, chan error) { + chatMemberChan := make(chan *client.ChatMember, 10) + errChan := make(chan error, 1) + + var filter client.SupergroupMembersFilter = nil + var offset int32 = 0 + var limit int32 = 200 + + go supergroupMembers(tdlibClient, chatMemberChan, errChan, supergroupId, filter, offset, limit) + + return chatMemberChan, errChan +} + +func supergroupMembers(tdlibClient *client.Client, chatMemberChan chan *client.ChatMember, errChan chan error, supergroupId int32, filter client.SupergroupMembersFilter, offset int32, limit int32) { + defer func() { + close(chatMemberChan) + close(errChan) + }() + + var page int32 = 0 + + for { + chatMembers, err := tdlibClient.GetSupergroupMembers(&client.GetSupergroupMembersRequest{ + SupergroupId: supergroupId, + Filter: filter, + Offset: page*limit + offset, + Limit: limit, + }) + if err != nil { + errChan <- err + + return + } + + if len(chatMembers.Members) == 0 { + errChan <- EOP + + break + } + + for _, member := range chatMembers.Members { + chatMemberChan <- member + } + + page++ + } +} diff --git a/client/tdjson.go b/client/tdjson.go new file mode 100644 index 0000000..a91488e --- /dev/null +++ b/client/tdjson.go @@ -0,0 +1,9 @@ +// +build darwin + +package client + +/* +#cgo darwin CFLAGS: -I/usr/local/include +#cgo darwin LDFLAGS: -L/usr/local/lib -L/usr/local/opt/openssl/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +*/ +import "C" diff --git a/client/tdjson_dynamic.go b/client/tdjson_dynamic.go new file mode 100644 index 0000000..84aaeac --- /dev/null +++ b/client/tdjson_dynamic.go @@ -0,0 +1,14 @@ +// +build libtdjson +// +build linux darwin windows + +package client + +/* +#cgo linux CFLAGS: -I/usr/local/include +#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson -lstdc++ -lssl -lcrypto -ldl -lz -lm +#cgo darwin CFLAGS: -I/usr/local/include +#cgo darwin LDFLAGS: -L/usr/local/lib -ltdjson -lstdc++ -lssl -lcrypto -ldl -lz -lm +#cgo windows CFLAGS: -Ic:/td -Ic:/td/example/csharp/build +#cgo windows LDFLAGS: -Lc:/td/example/csharp/build/Release -ltdjson +*/ +import "C" diff --git a/client/tdjson_static.go b/client/tdjson_static.go new file mode 100644 index 0000000..dcbb662 --- /dev/null +++ b/client/tdjson_static.go @@ -0,0 +1,12 @@ +// +build !libtdjson +// +build linux darwin + +package client + +/* +#cgo linux CFLAGS: -I/usr/local/include +#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdactor -ltdapi -ltddb -ltdsqlite -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +#cgo darwin CFLAGS: -I/usr/local/include +#cgo darwin LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdactor -ltdapi -ltddb -ltdsqlite -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +*/ +import "C" diff --git a/client/tdlib.go b/client/tdlib.go new file mode 100644 index 0000000..9edce04 --- /dev/null +++ b/client/tdlib.go @@ -0,0 +1,164 @@ +package client + +/* +#include +#include +*/ +import "C" + +import ( + "encoding/json" + "errors" + "fmt" + "strconv" + "time" + "unsafe" +) + +type JsonClient struct { + jsonClient unsafe.Pointer +} + +func NewJsonClient() *JsonClient { + return &JsonClient{ + jsonClient: C.td_json_client_create(), + } +} + +// Sends request to the TDLib client. May be called from any thread. +func (jsonClient *JsonClient) Send(req Request) { + data, _ := json.Marshal(req) + + query := C.CString(string(data)) + defer C.free(unsafe.Pointer(query)) + + C.td_json_client_send(jsonClient.jsonClient, query) +} + +// Receives incoming updates and request responses from the TDLib client. May be called from any thread, but +// shouldn't be called simultaneously from two different threads. +// Returned pointer will be deallocated by TDLib during next call to td_json_client_receive or td_json_client_execute +// in the same thread, so it can't be used after that. +func (jsonClient *JsonClient) Receive(timeout time.Duration) (*Response, error) { + result := C.td_json_client_receive(jsonClient.jsonClient, C.double(float64(timeout)/float64(time.Second))) + if result == nil { + return nil, errors.New("update receiving timeout") + } + + data := []byte(C.GoString(result)) + + var resp Response + + err := json.Unmarshal(data, &resp) + if err != nil { + return nil, err + } + + resp.Data = data + + return &resp, nil +} + +// Synchronously executes TDLib request. May be called from any thread. +// Only a few requests can be executed synchronously. +// Returned pointer will be deallocated by TDLib during next call to td_json_client_receive or td_json_client_execute +// in the same thread, so it can't be used after that. +func (jsonClient *JsonClient) Execute(req Request) (*Response, error) { + data, _ := json.Marshal(req) + + query := C.CString(string(data)) + defer C.free(unsafe.Pointer(query)) + + result := C.td_json_client_execute(jsonClient.jsonClient, query) + if result == nil { + return nil, errors.New("request can't be parsed") + } + + data = []byte(C.GoString(result)) + + var resp Response + + err := json.Unmarshal(data, &resp) + if err != nil { + return nil, err + } + + resp.Data = data + + return &resp, nil +} + +// Destroys the TDLib client instance. After this is called the client instance shouldn't be used anymore. +func (jsonClient *JsonClient) Destroy() { + C.td_json_client_destroy(jsonClient.jsonClient) +} + +type meta struct { + Type string `json:"@type"` + Extra string `json:"@extra"` +} + +type Request struct { + meta + Data map[string]interface{} +} + +func (req Request) MarshalJSON() ([]byte, error) { + req.Data["@type"] = req.Type + req.Data["@extra"] = req.Extra + + return json.Marshal(req.Data) +} + +type Response struct { + meta + Data json.RawMessage +} + +type ResponseError struct { + Err *Error +} + +func (responseError ResponseError) Error() string { + return fmt.Sprintf("%d %s", responseError.Err.Code, responseError.Err.Message) +} + +func buildResponseError(data json.RawMessage) error { + respErr, err := UnmarshalError(data) + if err != nil { + return err + } + + return ResponseError{ + Err: respErr, + } +} + +// JsonInt64 alias for int64, in order to deal with json big number problem +type JsonInt64 int64 + +// MarshalJSON marshals to json +func (jsonInt64 JsonInt64) MarshalJSON() ([]byte, error) { + return []byte(`"` + strconv.FormatInt(int64(jsonInt64), 10) + `"`), nil +} + +// UnmarshalJSON unmarshals from json +func (jsonInt64 *JsonInt64) UnmarshalJSON(data []byte) error { + if len(data) > 2 && data[0] == '"' && data[len(data)-1] == '"' { + data = data[1 : len(data)-1] + } + + jsonBigInt, err := strconv.ParseInt(string(data), 10, 64) + if err != nil { + return err + } + + *jsonInt64 = JsonInt64(jsonBigInt) + + return nil +} + +type Type interface { + GetType() string + GetClass() string +} diff --git a/client/type.go b/client/type.go new file mode 100755 index 0000000..996e97a --- /dev/null +++ b/client/type.go @@ -0,0 +1,28587 @@ +// AUTOGENERATED + +package client + +import ( + "encoding/json" +) + +const ( + ClassAuthenticationCodeType = "AuthenticationCodeType" + ClassAuthorizationState = "AuthorizationState" + ClassInputFile = "InputFile" + ClassThumbnailFormat = "ThumbnailFormat" + ClassMaskPoint = "MaskPoint" + ClassPollType = "PollType" + ClassUserType = "UserType" + ClassInputChatPhoto = "InputChatPhoto" + ClassChatMemberStatus = "ChatMemberStatus" + ClassChatMembersFilter = "ChatMembersFilter" + ClassSupergroupMembersFilter = "SupergroupMembersFilter" + ClassSecretChatState = "SecretChatState" + ClassMessageSender = "MessageSender" + ClassMessageForwardOrigin = "MessageForwardOrigin" + ClassMessageSendingState = "MessageSendingState" + ClassNotificationSettingsScope = "NotificationSettingsScope" + ClassChatType = "ChatType" + ClassChatList = "ChatList" + ClassChatSource = "ChatSource" + ClassPublicChatType = "PublicChatType" + ClassChatActionBar = "ChatActionBar" + ClassKeyboardButtonType = "KeyboardButtonType" + ClassInlineKeyboardButtonType = "InlineKeyboardButtonType" + ClassReplyMarkup = "ReplyMarkup" + ClassLoginUrlInfo = "LoginUrlInfo" + ClassRichText = "RichText" + ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" + ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment" + ClassPageBlock = "PageBlock" + ClassInputCredentials = "InputCredentials" + ClassPassportElementType = "PassportElementType" + ClassPassportElement = "PassportElement" + ClassInputPassportElement = "InputPassportElement" + ClassPassportElementErrorSource = "PassportElementErrorSource" + ClassInputPassportElementErrorSource = "InputPassportElementErrorSource" + ClassMessageContent = "MessageContent" + ClassTextEntityType = "TextEntityType" + ClassMessageSchedulingState = "MessageSchedulingState" + ClassInputMessageContent = "InputMessageContent" + ClassSearchMessagesFilter = "SearchMessagesFilter" + ClassChatAction = "ChatAction" + ClassUserStatus = "UserStatus" + ClassCallDiscardReason = "CallDiscardReason" + ClassCallServerType = "CallServerType" + ClassCallState = "CallState" + ClassCallProblem = "CallProblem" + ClassDiceStickers = "DiceStickers" + ClassInputInlineQueryResult = "InputInlineQueryResult" + ClassInlineQueryResult = "InlineQueryResult" + ClassCallbackQueryPayload = "CallbackQueryPayload" + ClassChatEventAction = "ChatEventAction" + ClassLanguagePackStringValue = "LanguagePackStringValue" + ClassDeviceToken = "DeviceToken" + ClassBackgroundFill = "BackgroundFill" + ClassBackgroundType = "BackgroundType" + ClassInputBackground = "InputBackground" + ClassCanTransferOwnershipResult = "CanTransferOwnershipResult" + ClassCheckChatUsernameResult = "CheckChatUsernameResult" + ClassPushMessageContent = "PushMessageContent" + ClassNotificationType = "NotificationType" + ClassNotificationGroupType = "NotificationGroupType" + ClassOptionValue = "OptionValue" + ClassJsonValue = "JsonValue" + ClassUserPrivacySettingRule = "UserPrivacySettingRule" + ClassUserPrivacySetting = "UserPrivacySetting" + ClassChatReportReason = "ChatReportReason" + ClassFileType = "FileType" + ClassNetworkType = "NetworkType" + ClassNetworkStatisticsEntry = "NetworkStatisticsEntry" + ClassConnectionState = "ConnectionState" + ClassTopChatCategory = "TopChatCategory" + ClassTMeUrlType = "TMeUrlType" + ClassSuggestedAction = "SuggestedAction" + ClassTextParseMode = "TextParseMode" + ClassProxyType = "ProxyType" + ClassInputSticker = "InputSticker" + ClassStatisticalGraph = "StatisticalGraph" + ClassChatStatistics = "ChatStatistics" + ClassUpdate = "Update" + ClassLogStream = "LogStream" + 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" + ClassMinithumbnail = "Minithumbnail" + ClassThumbnail = "Thumbnail" + ClassMaskPosition = "MaskPosition" + ClassPollOption = "PollOption" + ClassAnimation = "Animation" + ClassAudio = "Audio" + ClassDocument = "Document" + ClassPhoto = "Photo" + ClassSticker = "Sticker" + ClassVideo = "Video" + ClassVideoNote = "VideoNote" + ClassVoiceNote = "VoiceNote" + ClassContact = "Contact" + ClassLocation = "Location" + ClassVenue = "Venue" + ClassGame = "Game" + ClassPoll = "Poll" + ClassProfilePhoto = "ProfilePhoto" + ClassChatPhotoInfo = "ChatPhotoInfo" + ClassBotCommand = "BotCommand" + ClassBotInfo = "BotInfo" + ClassChatLocation = "ChatLocation" + ClassAnimatedChatPhoto = "AnimatedChatPhoto" + ClassChatPhoto = "ChatPhoto" + ClassChatPhotos = "ChatPhotos" + ClassUser = "User" + ClassUserFullInfo = "UserFullInfo" + ClassUsers = "Users" + ClassChatAdministrator = "ChatAdministrator" + ClassChatAdministrators = "ChatAdministrators" + ClassChatPermissions = "ChatPermissions" + ClassChatMember = "ChatMember" + ClassChatMembers = "ChatMembers" + ClassBasicGroup = "BasicGroup" + ClassBasicGroupFullInfo = "BasicGroupFullInfo" + ClassSupergroup = "Supergroup" + ClassSupergroupFullInfo = "SupergroupFullInfo" + ClassSecretChat = "SecretChat" + ClassMessageSenders = "MessageSenders" + ClassMessageForwardInfo = "MessageForwardInfo" + ClassMessageReplyInfo = "MessageReplyInfo" + ClassMessageInteractionInfo = "MessageInteractionInfo" + ClassMessage = "Message" + ClassMessages = "Messages" + ClassFoundMessages = "FoundMessages" + ClassChatNotificationSettings = "ChatNotificationSettings" + ClassScopeNotificationSettings = "ScopeNotificationSettings" + ClassDraftMessage = "DraftMessage" + ClassChatFilter = "ChatFilter" + ClassChatFilterInfo = "ChatFilterInfo" + ClassRecommendedChatFilter = "RecommendedChatFilter" + ClassRecommendedChatFilters = "RecommendedChatFilters" + ClassChatLists = "ChatLists" + ClassChatPosition = "ChatPosition" + ClassChat = "Chat" + ClassChats = "Chats" + ClassChatNearby = "ChatNearby" + ClassChatsNearby = "ChatsNearby" + ClassChatInviteLink = "ChatInviteLink" + ClassChatInviteLinkInfo = "ChatInviteLinkInfo" + ClassKeyboardButton = "KeyboardButton" + ClassInlineKeyboardButton = "InlineKeyboardButton" + ClassMessageThreadInfo = "MessageThreadInfo" + ClassPageBlockCaption = "PageBlockCaption" + ClassPageBlockListItem = "PageBlockListItem" + ClassPageBlockTableCell = "PageBlockTableCell" + ClassPageBlockRelatedArticle = "PageBlockRelatedArticle" + ClassWebPageInstantView = "WebPageInstantView" + ClassWebPage = "WebPage" + ClassCountryInfo = "CountryInfo" + ClassCountries = "Countries" + ClassPhoneNumberInfo = "PhoneNumberInfo" + ClassBankCardActionOpenUrl = "BankCardActionOpenUrl" + ClassBankCardInfo = "BankCardInfo" + 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" + ClassPassportElementsWithErrors = "PassportElementsWithErrors" + ClassEncryptedCredentials = "EncryptedCredentials" + ClassEncryptedPassportElement = "EncryptedPassportElement" + ClassInputPassportElementError = "InputPassportElementError" + ClassInputThumbnail = "InputThumbnail" + ClassMessageSendOptions = "MessageSendOptions" + ClassMessageCopyOptions = "MessageCopyOptions" + ClassStickers = "Stickers" + ClassEmojis = "Emojis" + ClassStickerSet = "StickerSet" + ClassStickerSetInfo = "StickerSetInfo" + ClassStickerSets = "StickerSets" + ClassCallProtocol = "CallProtocol" + ClassCallServer = "CallServer" + ClassCallId = "CallId" + ClassCall = "Call" + ClassPhoneNumberAuthenticationSettings = "PhoneNumberAuthenticationSettings" + ClassAnimations = "Animations" + ClassImportedContacts = "ImportedContacts" + ClassHttpUrl = "HttpUrl" + ClassInlineQueryResults = "InlineQueryResults" + ClassCallbackQueryAnswer = "CallbackQueryAnswer" + ClassCustomRequestResult = "CustomRequestResult" + ClassGameHighScore = "GameHighScore" + ClassGameHighScores = "GameHighScores" + ClassChatEvent = "ChatEvent" + ClassChatEvents = "ChatEvents" + ClassChatEventLogFilters = "ChatEventLogFilters" + ClassLanguagePackString = "LanguagePackString" + ClassLanguagePackStrings = "LanguagePackStrings" + ClassLanguagePackInfo = "LanguagePackInfo" + ClassLocalizationTargetInfo = "LocalizationTargetInfo" + ClassPushReceiverId = "PushReceiverId" + ClassBackground = "Background" + ClassBackgrounds = "Backgrounds" + ClassHashtags = "Hashtags" + ClassNotification = "Notification" + ClassNotificationGroup = "NotificationGroup" + ClassJsonObjectMember = "JsonObjectMember" + ClassUserPrivacySettingRules = "UserPrivacySettingRules" + ClassAccountTtl = "AccountTtl" + ClassSession = "Session" + ClassSessions = "Sessions" + ClassConnectedWebsite = "ConnectedWebsite" + ClassConnectedWebsites = "ConnectedWebsites" + ClassMessageLink = "MessageLink" + ClassMessageLinkInfo = "MessageLinkInfo" + ClassFilePart = "FilePart" + ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" + ClassStorageStatisticsByChat = "StorageStatisticsByChat" + ClassStorageStatistics = "StorageStatistics" + ClassStorageStatisticsFast = "StorageStatisticsFast" + ClassDatabaseStatistics = "DatabaseStatistics" + ClassNetworkStatistics = "NetworkStatistics" + ClassAutoDownloadSettings = "AutoDownloadSettings" + ClassAutoDownloadSettingsPresets = "AutoDownloadSettingsPresets" + ClassTMeUrl = "TMeUrl" + ClassTMeUrls = "TMeUrls" + ClassCount = "Count" + ClassText = "Text" + ClassSeconds = "Seconds" + ClassDeepLinkInfo = "DeepLinkInfo" + ClassProxy = "Proxy" + ClassProxies = "Proxies" + ClassDateRange = "DateRange" + ClassStatisticalValue = "StatisticalValue" + ClassChatStatisticsMessageInteractionInfo = "ChatStatisticsMessageInteractionInfo" + ClassChatStatisticsMessageSenderInfo = "ChatStatisticsMessageSenderInfo" + ClassChatStatisticsAdministratorActionsInfo = "ChatStatisticsAdministratorActionsInfo" + ClassChatStatisticsInviterInfo = "ChatStatisticsInviterInfo" + ClassMessageStatistics = "MessageStatistics" + ClassUpdates = "Updates" + ClassLogVerbosityLevel = "LogVerbosityLevel" + ClassLogTags = "LogTags" + ClassTestInt = "TestInt" + ClassTestString = "TestString" + ClassTestBytes = "TestBytes" + ClassTestVectorInt = "TestVectorInt" + ClassTestVectorIntObject = "TestVectorIntObject" + ClassTestVectorString = "TestVectorString" + ClassTestVectorStringObject = "TestVectorStringObject" +) + +const ( + 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" + TypeAuthorizationStateWaitOtherDeviceConfirmation = "authorizationStateWaitOtherDeviceConfirmation" + TypeAuthorizationStateWaitRegistration = "authorizationStateWaitRegistration" + 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" + TypeMinithumbnail = "minithumbnail" + TypeThumbnailFormatJpeg = "thumbnailFormatJpeg" + TypeThumbnailFormatPng = "thumbnailFormatPng" + TypeThumbnailFormatWebp = "thumbnailFormatWebp" + TypeThumbnailFormatGif = "thumbnailFormatGif" + TypeThumbnailFormatTgs = "thumbnailFormatTgs" + TypeThumbnailFormatMpeg4 = "thumbnailFormatMpeg4" + TypeThumbnail = "thumbnail" + TypeMaskPointForehead = "maskPointForehead" + TypeMaskPointEyes = "maskPointEyes" + TypeMaskPointMouth = "maskPointMouth" + TypeMaskPointChin = "maskPointChin" + TypeMaskPosition = "maskPosition" + TypePollOption = "pollOption" + TypePollTypeRegular = "pollTypeRegular" + TypePollTypeQuiz = "pollTypeQuiz" + TypeAnimation = "animation" + TypeAudio = "audio" + TypeDocument = "document" + TypePhoto = "photo" + TypeSticker = "sticker" + TypeVideo = "video" + TypeVideoNote = "videoNote" + TypeVoiceNote = "voiceNote" + TypeContact = "contact" + TypeLocation = "location" + TypeVenue = "venue" + TypeGame = "game" + TypePoll = "poll" + TypeProfilePhoto = "profilePhoto" + TypeChatPhotoInfo = "chatPhotoInfo" + TypeUserTypeRegular = "userTypeRegular" + TypeUserTypeDeleted = "userTypeDeleted" + TypeUserTypeBot = "userTypeBot" + TypeUserTypeUnknown = "userTypeUnknown" + TypeBotCommand = "botCommand" + TypeBotInfo = "botInfo" + TypeChatLocation = "chatLocation" + TypeAnimatedChatPhoto = "animatedChatPhoto" + TypeChatPhoto = "chatPhoto" + TypeChatPhotos = "chatPhotos" + TypeInputChatPhotoPrevious = "inputChatPhotoPrevious" + TypeInputChatPhotoStatic = "inputChatPhotoStatic" + TypeInputChatPhotoAnimation = "inputChatPhotoAnimation" + TypeUser = "user" + TypeUserFullInfo = "userFullInfo" + TypeUsers = "users" + TypeChatAdministrator = "chatAdministrator" + TypeChatAdministrators = "chatAdministrators" + TypeChatPermissions = "chatPermissions" + TypeChatMemberStatusCreator = "chatMemberStatusCreator" + TypeChatMemberStatusAdministrator = "chatMemberStatusAdministrator" + TypeChatMemberStatusMember = "chatMemberStatusMember" + TypeChatMemberStatusRestricted = "chatMemberStatusRestricted" + TypeChatMemberStatusLeft = "chatMemberStatusLeft" + TypeChatMemberStatusBanned = "chatMemberStatusBanned" + TypeChatMember = "chatMember" + TypeChatMembers = "chatMembers" + TypeChatMembersFilterContacts = "chatMembersFilterContacts" + TypeChatMembersFilterAdministrators = "chatMembersFilterAdministrators" + TypeChatMembersFilterMembers = "chatMembersFilterMembers" + TypeChatMembersFilterMention = "chatMembersFilterMention" + TypeChatMembersFilterRestricted = "chatMembersFilterRestricted" + TypeChatMembersFilterBanned = "chatMembersFilterBanned" + TypeChatMembersFilterBots = "chatMembersFilterBots" + TypeSupergroupMembersFilterRecent = "supergroupMembersFilterRecent" + TypeSupergroupMembersFilterContacts = "supergroupMembersFilterContacts" + TypeSupergroupMembersFilterAdministrators = "supergroupMembersFilterAdministrators" + TypeSupergroupMembersFilterSearch = "supergroupMembersFilterSearch" + TypeSupergroupMembersFilterRestricted = "supergroupMembersFilterRestricted" + TypeSupergroupMembersFilterBanned = "supergroupMembersFilterBanned" + TypeSupergroupMembersFilterMention = "supergroupMembersFilterMention" + TypeSupergroupMembersFilterBots = "supergroupMembersFilterBots" + TypeBasicGroup = "basicGroup" + TypeBasicGroupFullInfo = "basicGroupFullInfo" + TypeSupergroup = "supergroup" + TypeSupergroupFullInfo = "supergroupFullInfo" + TypeSecretChatStatePending = "secretChatStatePending" + TypeSecretChatStateReady = "secretChatStateReady" + TypeSecretChatStateClosed = "secretChatStateClosed" + TypeSecretChat = "secretChat" + TypeMessageSenderUser = "messageSenderUser" + TypeMessageSenderChat = "messageSenderChat" + TypeMessageSenders = "messageSenders" + TypeMessageForwardOriginUser = "messageForwardOriginUser" + TypeMessageForwardOriginChat = "messageForwardOriginChat" + TypeMessageForwardOriginHiddenUser = "messageForwardOriginHiddenUser" + TypeMessageForwardOriginChannel = "messageForwardOriginChannel" + TypeMessageForwardInfo = "messageForwardInfo" + TypeMessageReplyInfo = "messageReplyInfo" + TypeMessageInteractionInfo = "messageInteractionInfo" + TypeMessageSendingStatePending = "messageSendingStatePending" + TypeMessageSendingStateFailed = "messageSendingStateFailed" + TypeMessage = "message" + TypeMessages = "messages" + TypeFoundMessages = "foundMessages" + TypeNotificationSettingsScopePrivateChats = "notificationSettingsScopePrivateChats" + TypeNotificationSettingsScopeGroupChats = "notificationSettingsScopeGroupChats" + TypeNotificationSettingsScopeChannelChats = "notificationSettingsScopeChannelChats" + TypeChatNotificationSettings = "chatNotificationSettings" + TypeScopeNotificationSettings = "scopeNotificationSettings" + TypeDraftMessage = "draftMessage" + TypeChatTypePrivate = "chatTypePrivate" + TypeChatTypeBasicGroup = "chatTypeBasicGroup" + TypeChatTypeSupergroup = "chatTypeSupergroup" + TypeChatTypeSecret = "chatTypeSecret" + TypeChatFilter = "chatFilter" + TypeChatFilterInfo = "chatFilterInfo" + TypeRecommendedChatFilter = "recommendedChatFilter" + TypeRecommendedChatFilters = "recommendedChatFilters" + TypeChatListMain = "chatListMain" + TypeChatListArchive = "chatListArchive" + TypeChatListFilter = "chatListFilter" + TypeChatLists = "chatLists" + TypeChatSourceMtprotoProxy = "chatSourceMtprotoProxy" + TypeChatSourcePublicServiceAnnouncement = "chatSourcePublicServiceAnnouncement" + TypeChatPosition = "chatPosition" + TypeChat = "chat" + TypeChats = "chats" + TypeChatNearby = "chatNearby" + TypeChatsNearby = "chatsNearby" + TypeChatInviteLink = "chatInviteLink" + TypeChatInviteLinkInfo = "chatInviteLinkInfo" + TypePublicChatTypeHasUsername = "publicChatTypeHasUsername" + TypePublicChatTypeIsLocationBased = "publicChatTypeIsLocationBased" + TypeChatActionBarReportSpam = "chatActionBarReportSpam" + TypeChatActionBarReportUnrelatedLocation = "chatActionBarReportUnrelatedLocation" + TypeChatActionBarReportAddBlock = "chatActionBarReportAddBlock" + TypeChatActionBarAddContact = "chatActionBarAddContact" + TypeChatActionBarSharePhoneNumber = "chatActionBarSharePhoneNumber" + TypeKeyboardButtonTypeText = "keyboardButtonTypeText" + TypeKeyboardButtonTypeRequestPhoneNumber = "keyboardButtonTypeRequestPhoneNumber" + TypeKeyboardButtonTypeRequestLocation = "keyboardButtonTypeRequestLocation" + TypeKeyboardButtonTypeRequestPoll = "keyboardButtonTypeRequestPoll" + TypeKeyboardButton = "keyboardButton" + TypeInlineKeyboardButtonTypeUrl = "inlineKeyboardButtonTypeUrl" + TypeInlineKeyboardButtonTypeLoginUrl = "inlineKeyboardButtonTypeLoginUrl" + TypeInlineKeyboardButtonTypeCallback = "inlineKeyboardButtonTypeCallback" + TypeInlineKeyboardButtonTypeCallbackWithPassword = "inlineKeyboardButtonTypeCallbackWithPassword" + TypeInlineKeyboardButtonTypeCallbackGame = "inlineKeyboardButtonTypeCallbackGame" + TypeInlineKeyboardButtonTypeSwitchInline = "inlineKeyboardButtonTypeSwitchInline" + TypeInlineKeyboardButtonTypeBuy = "inlineKeyboardButtonTypeBuy" + TypeInlineKeyboardButton = "inlineKeyboardButton" + TypeReplyMarkupRemoveKeyboard = "replyMarkupRemoveKeyboard" + TypeReplyMarkupForceReply = "replyMarkupForceReply" + TypeReplyMarkupShowKeyboard = "replyMarkupShowKeyboard" + TypeReplyMarkupInlineKeyboard = "replyMarkupInlineKeyboard" + TypeLoginUrlInfoOpen = "loginUrlInfoOpen" + TypeLoginUrlInfoRequestConfirmation = "loginUrlInfoRequestConfirmation" + TypeMessageThreadInfo = "messageThreadInfo" + TypeRichTextPlain = "richTextPlain" + TypeRichTextBold = "richTextBold" + TypeRichTextItalic = "richTextItalic" + TypeRichTextUnderline = "richTextUnderline" + TypeRichTextStrikethrough = "richTextStrikethrough" + TypeRichTextFixed = "richTextFixed" + TypeRichTextUrl = "richTextUrl" + TypeRichTextEmailAddress = "richTextEmailAddress" + TypeRichTextSubscript = "richTextSubscript" + TypeRichTextSuperscript = "richTextSuperscript" + TypeRichTextMarked = "richTextMarked" + TypeRichTextPhoneNumber = "richTextPhoneNumber" + TypeRichTextIcon = "richTextIcon" + TypeRichTextReference = "richTextReference" + TypeRichTextAnchor = "richTextAnchor" + TypeRichTextAnchorLink = "richTextAnchorLink" + TypeRichTexts = "richTexts" + TypePageBlockCaption = "pageBlockCaption" + TypePageBlockListItem = "pageBlockListItem" + TypePageBlockHorizontalAlignmentLeft = "pageBlockHorizontalAlignmentLeft" + TypePageBlockHorizontalAlignmentCenter = "pageBlockHorizontalAlignmentCenter" + TypePageBlockHorizontalAlignmentRight = "pageBlockHorizontalAlignmentRight" + TypePageBlockVerticalAlignmentTop = "pageBlockVerticalAlignmentTop" + TypePageBlockVerticalAlignmentMiddle = "pageBlockVerticalAlignmentMiddle" + TypePageBlockVerticalAlignmentBottom = "pageBlockVerticalAlignmentBottom" + TypePageBlockTableCell = "pageBlockTableCell" + TypePageBlockRelatedArticle = "pageBlockRelatedArticle" + TypePageBlockTitle = "pageBlockTitle" + TypePageBlockSubtitle = "pageBlockSubtitle" + TypePageBlockAuthorDate = "pageBlockAuthorDate" + TypePageBlockHeader = "pageBlockHeader" + TypePageBlockSubheader = "pageBlockSubheader" + TypePageBlockKicker = "pageBlockKicker" + TypePageBlockParagraph = "pageBlockParagraph" + TypePageBlockPreformatted = "pageBlockPreformatted" + TypePageBlockFooter = "pageBlockFooter" + TypePageBlockDivider = "pageBlockDivider" + TypePageBlockAnchor = "pageBlockAnchor" + TypePageBlockList = "pageBlockList" + TypePageBlockBlockQuote = "pageBlockBlockQuote" + TypePageBlockPullQuote = "pageBlockPullQuote" + TypePageBlockAnimation = "pageBlockAnimation" + TypePageBlockAudio = "pageBlockAudio" + TypePageBlockPhoto = "pageBlockPhoto" + TypePageBlockVideo = "pageBlockVideo" + TypePageBlockVoiceNote = "pageBlockVoiceNote" + TypePageBlockCover = "pageBlockCover" + TypePageBlockEmbedded = "pageBlockEmbedded" + TypePageBlockEmbeddedPost = "pageBlockEmbeddedPost" + TypePageBlockCollage = "pageBlockCollage" + TypePageBlockSlideshow = "pageBlockSlideshow" + TypePageBlockChatLink = "pageBlockChatLink" + TypePageBlockTable = "pageBlockTable" + TypePageBlockDetails = "pageBlockDetails" + TypePageBlockRelatedArticles = "pageBlockRelatedArticles" + TypePageBlockMap = "pageBlockMap" + TypeWebPageInstantView = "webPageInstantView" + TypeWebPage = "webPage" + TypeCountryInfo = "countryInfo" + TypeCountries = "countries" + TypePhoneNumberInfo = "phoneNumberInfo" + TypeBankCardActionOpenUrl = "bankCardActionOpenUrl" + TypeBankCardInfo = "bankCardInfo" + 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" + TypePassportElementsWithErrors = "passportElementsWithErrors" + 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" + TypeMessageDice = "messageDice" + TypeMessageGame = "messageGame" + TypeMessagePoll = "messagePoll" + 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" + TypeMessageProximityAlertTriggered = "messageProximityAlertTriggered" + TypeMessageUnsupported = "messageUnsupported" + TypeTextEntityTypeMention = "textEntityTypeMention" + TypeTextEntityTypeHashtag = "textEntityTypeHashtag" + TypeTextEntityTypeCashtag = "textEntityTypeCashtag" + TypeTextEntityTypeBotCommand = "textEntityTypeBotCommand" + TypeTextEntityTypeUrl = "textEntityTypeUrl" + TypeTextEntityTypeEmailAddress = "textEntityTypeEmailAddress" + TypeTextEntityTypePhoneNumber = "textEntityTypePhoneNumber" + TypeTextEntityTypeBankCardNumber = "textEntityTypeBankCardNumber" + TypeTextEntityTypeBold = "textEntityTypeBold" + TypeTextEntityTypeItalic = "textEntityTypeItalic" + TypeTextEntityTypeUnderline = "textEntityTypeUnderline" + TypeTextEntityTypeStrikethrough = "textEntityTypeStrikethrough" + TypeTextEntityTypeCode = "textEntityTypeCode" + TypeTextEntityTypePre = "textEntityTypePre" + TypeTextEntityTypePreCode = "textEntityTypePreCode" + TypeTextEntityTypeTextUrl = "textEntityTypeTextUrl" + TypeTextEntityTypeMentionName = "textEntityTypeMentionName" + TypeInputThumbnail = "inputThumbnail" + TypeMessageSchedulingStateSendAtDate = "messageSchedulingStateSendAtDate" + TypeMessageSchedulingStateSendWhenOnline = "messageSchedulingStateSendWhenOnline" + TypeMessageSendOptions = "messageSendOptions" + TypeMessageCopyOptions = "messageCopyOptions" + TypeInputMessageText = "inputMessageText" + TypeInputMessageAnimation = "inputMessageAnimation" + TypeInputMessageAudio = "inputMessageAudio" + TypeInputMessageDocument = "inputMessageDocument" + TypeInputMessagePhoto = "inputMessagePhoto" + TypeInputMessageSticker = "inputMessageSticker" + TypeInputMessageVideo = "inputMessageVideo" + TypeInputMessageVideoNote = "inputMessageVideoNote" + TypeInputMessageVoiceNote = "inputMessageVoiceNote" + TypeInputMessageLocation = "inputMessageLocation" + TypeInputMessageVenue = "inputMessageVenue" + TypeInputMessageContact = "inputMessageContact" + TypeInputMessageDice = "inputMessageDice" + TypeInputMessageGame = "inputMessageGame" + TypeInputMessageInvoice = "inputMessageInvoice" + TypeInputMessagePoll = "inputMessagePoll" + 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" + TypeSearchMessagesFilterFailedToSend = "searchMessagesFilterFailedToSend" + TypeSearchMessagesFilterPinned = "searchMessagesFilterPinned" + 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" + TypeEmojis = "emojis" + TypeStickerSet = "stickerSet" + TypeStickerSetInfo = "stickerSetInfo" + TypeStickerSets = "stickerSets" + TypeCallDiscardReasonEmpty = "callDiscardReasonEmpty" + TypeCallDiscardReasonMissed = "callDiscardReasonMissed" + TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" + TypeCallDiscardReasonDisconnected = "callDiscardReasonDisconnected" + TypeCallDiscardReasonHungUp = "callDiscardReasonHungUp" + TypeCallProtocol = "callProtocol" + TypeCallServerTypeTelegramReflector = "callServerTypeTelegramReflector" + TypeCallServerTypeWebrtc = "callServerTypeWebrtc" + TypeCallServer = "callServer" + TypeCallId = "callId" + TypeCallStatePending = "callStatePending" + TypeCallStateExchangingKeys = "callStateExchangingKeys" + TypeCallStateReady = "callStateReady" + TypeCallStateHangingUp = "callStateHangingUp" + TypeCallStateDiscarded = "callStateDiscarded" + TypeCallStateError = "callStateError" + TypeCallProblemEcho = "callProblemEcho" + TypeCallProblemNoise = "callProblemNoise" + TypeCallProblemInterruptions = "callProblemInterruptions" + TypeCallProblemDistortedSpeech = "callProblemDistortedSpeech" + TypeCallProblemSilentLocal = "callProblemSilentLocal" + TypeCallProblemSilentRemote = "callProblemSilentRemote" + TypeCallProblemDropped = "callProblemDropped" + TypeCallProblemDistortedVideo = "callProblemDistortedVideo" + TypeCallProblemPixelatedVideo = "callProblemPixelatedVideo" + TypeCall = "call" + TypePhoneNumberAuthenticationSettings = "phoneNumberAuthenticationSettings" + TypeAnimations = "animations" + TypeDiceStickersRegular = "diceStickersRegular" + TypeDiceStickersSlotMachine = "diceStickersSlotMachine" + TypeImportedContacts = "importedContacts" + TypeHttpUrl = "httpUrl" + TypeInputInlineQueryResultAnimation = "inputInlineQueryResultAnimation" + 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" + TypeCallbackQueryPayloadDataWithPassword = "callbackQueryPayloadDataWithPassword" + TypeCallbackQueryPayloadGame = "callbackQueryPayloadGame" + TypeCallbackQueryAnswer = "callbackQueryAnswer" + TypeCustomRequestResult = "customRequestResult" + TypeGameHighScore = "gameHighScore" + TypeGameHighScores = "gameHighScores" + TypeChatEventMessageEdited = "chatEventMessageEdited" + TypeChatEventMessageDeleted = "chatEventMessageDeleted" + TypeChatEventPollStopped = "chatEventPollStopped" + TypeChatEventMessagePinned = "chatEventMessagePinned" + TypeChatEventMessageUnpinned = "chatEventMessageUnpinned" + TypeChatEventMemberJoined = "chatEventMemberJoined" + TypeChatEventMemberLeft = "chatEventMemberLeft" + TypeChatEventMemberInvited = "chatEventMemberInvited" + TypeChatEventMemberPromoted = "chatEventMemberPromoted" + TypeChatEventMemberRestricted = "chatEventMemberRestricted" + TypeChatEventTitleChanged = "chatEventTitleChanged" + TypeChatEventPermissionsChanged = "chatEventPermissionsChanged" + TypeChatEventDescriptionChanged = "chatEventDescriptionChanged" + TypeChatEventUsernameChanged = "chatEventUsernameChanged" + TypeChatEventPhotoChanged = "chatEventPhotoChanged" + TypeChatEventInvitesToggled = "chatEventInvitesToggled" + TypeChatEventLinkedChatChanged = "chatEventLinkedChatChanged" + TypeChatEventSlowModeDelayChanged = "chatEventSlowModeDelayChanged" + TypeChatEventSignMessagesToggled = "chatEventSignMessagesToggled" + TypeChatEventStickerSetChanged = "chatEventStickerSetChanged" + TypeChatEventLocationChanged = "chatEventLocationChanged" + TypeChatEventIsAllHistoryAvailableToggled = "chatEventIsAllHistoryAvailableToggled" + TypeChatEvent = "chatEvent" + TypeChatEvents = "chatEvents" + TypeChatEventLogFilters = "chatEventLogFilters" + TypeLanguagePackStringValueOrdinary = "languagePackStringValueOrdinary" + TypeLanguagePackStringValuePluralized = "languagePackStringValuePluralized" + TypeLanguagePackStringValueDeleted = "languagePackStringValueDeleted" + TypeLanguagePackString = "languagePackString" + TypeLanguagePackStrings = "languagePackStrings" + TypeLanguagePackInfo = "languagePackInfo" + TypeLocalizationTargetInfo = "localizationTargetInfo" + TypeDeviceTokenFirebaseCloudMessaging = "deviceTokenFirebaseCloudMessaging" + TypeDeviceTokenApplePush = "deviceTokenApplePush" + TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" + TypeDeviceTokenWindowsPush = "deviceTokenWindowsPush" + TypeDeviceTokenMicrosoftPush = "deviceTokenMicrosoftPush" + TypeDeviceTokenMicrosoftPushVoIP = "deviceTokenMicrosoftPushVoIP" + TypeDeviceTokenWebPush = "deviceTokenWebPush" + TypeDeviceTokenSimplePush = "deviceTokenSimplePush" + TypeDeviceTokenUbuntuPush = "deviceTokenUbuntuPush" + TypeDeviceTokenBlackBerryPush = "deviceTokenBlackBerryPush" + TypeDeviceTokenTizenPush = "deviceTokenTizenPush" + TypePushReceiverId = "pushReceiverId" + TypeBackgroundFillSolid = "backgroundFillSolid" + TypeBackgroundFillGradient = "backgroundFillGradient" + TypeBackgroundTypeWallpaper = "backgroundTypeWallpaper" + TypeBackgroundTypePattern = "backgroundTypePattern" + TypeBackgroundTypeFill = "backgroundTypeFill" + TypeBackground = "background" + TypeBackgrounds = "backgrounds" + TypeInputBackgroundLocal = "inputBackgroundLocal" + TypeInputBackgroundRemote = "inputBackgroundRemote" + TypeHashtags = "hashtags" + TypeCanTransferOwnershipResultOk = "canTransferOwnershipResultOk" + TypeCanTransferOwnershipResultPasswordNeeded = "canTransferOwnershipResultPasswordNeeded" + TypeCanTransferOwnershipResultPasswordTooFresh = "canTransferOwnershipResultPasswordTooFresh" + TypeCanTransferOwnershipResultSessionTooFresh = "canTransferOwnershipResultSessionTooFresh" + TypeCheckChatUsernameResultOk = "checkChatUsernameResultOk" + TypeCheckChatUsernameResultUsernameInvalid = "checkChatUsernameResultUsernameInvalid" + TypeCheckChatUsernameResultUsernameOccupied = "checkChatUsernameResultUsernameOccupied" + TypeCheckChatUsernameResultPublicChatsTooMuch = "checkChatUsernameResultPublicChatsTooMuch" + TypeCheckChatUsernameResultPublicGroupsUnavailable = "checkChatUsernameResultPublicGroupsUnavailable" + 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" + TypeOptionValueBoolean = "optionValueBoolean" + TypeOptionValueEmpty = "optionValueEmpty" + TypeOptionValueInteger = "optionValueInteger" + TypeOptionValueString = "optionValueString" + TypeJsonObjectMember = "jsonObjectMember" + TypeJsonValueNull = "jsonValueNull" + TypeJsonValueBoolean = "jsonValueBoolean" + TypeJsonValueNumber = "jsonValueNumber" + TypeJsonValueString = "jsonValueString" + TypeJsonValueArray = "jsonValueArray" + TypeJsonValueObject = "jsonValueObject" + TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll" + TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts" + TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers" + TypeUserPrivacySettingRuleAllowChatMembers = "userPrivacySettingRuleAllowChatMembers" + TypeUserPrivacySettingRuleRestrictAll = "userPrivacySettingRuleRestrictAll" + TypeUserPrivacySettingRuleRestrictContacts = "userPrivacySettingRuleRestrictContacts" + TypeUserPrivacySettingRuleRestrictUsers = "userPrivacySettingRuleRestrictUsers" + TypeUserPrivacySettingRuleRestrictChatMembers = "userPrivacySettingRuleRestrictChatMembers" + TypeUserPrivacySettingRules = "userPrivacySettingRules" + TypeUserPrivacySettingShowStatus = "userPrivacySettingShowStatus" + TypeUserPrivacySettingShowProfilePhoto = "userPrivacySettingShowProfilePhoto" + TypeUserPrivacySettingShowLinkInForwardedMessages = "userPrivacySettingShowLinkInForwardedMessages" + TypeUserPrivacySettingShowPhoneNumber = "userPrivacySettingShowPhoneNumber" + TypeUserPrivacySettingAllowChatInvites = "userPrivacySettingAllowChatInvites" + TypeUserPrivacySettingAllowCalls = "userPrivacySettingAllowCalls" + TypeUserPrivacySettingAllowPeerToPeerCalls = "userPrivacySettingAllowPeerToPeerCalls" + TypeUserPrivacySettingAllowFindingByPhoneNumber = "userPrivacySettingAllowFindingByPhoneNumber" + TypeAccountTtl = "accountTtl" + TypeSession = "session" + TypeSessions = "sessions" + TypeConnectedWebsite = "connectedWebsite" + TypeConnectedWebsites = "connectedWebsites" + TypeChatReportReasonSpam = "chatReportReasonSpam" + TypeChatReportReasonViolence = "chatReportReasonViolence" + TypeChatReportReasonPornography = "chatReportReasonPornography" + TypeChatReportReasonChildAbuse = "chatReportReasonChildAbuse" + TypeChatReportReasonCopyright = "chatReportReasonCopyright" + TypeChatReportReasonUnrelatedLocation = "chatReportReasonUnrelatedLocation" + TypeChatReportReasonCustom = "chatReportReasonCustom" + TypeMessageLink = "messageLink" + TypeMessageLinkInfo = "messageLinkInfo" + TypeFilePart = "filePart" + 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" + TypeDatabaseStatistics = "databaseStatistics" + TypeNetworkTypeNone = "networkTypeNone" + TypeNetworkTypeMobile = "networkTypeMobile" + TypeNetworkTypeMobileRoaming = "networkTypeMobileRoaming" + TypeNetworkTypeWiFi = "networkTypeWiFi" + TypeNetworkTypeOther = "networkTypeOther" + TypeNetworkStatisticsEntryFile = "networkStatisticsEntryFile" + TypeNetworkStatisticsEntryCall = "networkStatisticsEntryCall" + TypeNetworkStatistics = "networkStatistics" + TypeAutoDownloadSettings = "autoDownloadSettings" + TypeAutoDownloadSettingsPresets = "autoDownloadSettingsPresets" + TypeConnectionStateWaitingForNetwork = "connectionStateWaitingForNetwork" + TypeConnectionStateConnectingToProxy = "connectionStateConnectingToProxy" + TypeConnectionStateConnecting = "connectionStateConnecting" + TypeConnectionStateUpdating = "connectionStateUpdating" + TypeConnectionStateReady = "connectionStateReady" + TypeTopChatCategoryUsers = "topChatCategoryUsers" + TypeTopChatCategoryBots = "topChatCategoryBots" + TypeTopChatCategoryGroups = "topChatCategoryGroups" + TypeTopChatCategoryChannels = "topChatCategoryChannels" + TypeTopChatCategoryInlineBots = "topChatCategoryInlineBots" + TypeTopChatCategoryCalls = "topChatCategoryCalls" + TypeTopChatCategoryForwardChats = "topChatCategoryForwardChats" + TypeTMeUrlTypeUser = "tMeUrlTypeUser" + TypeTMeUrlTypeSupergroup = "tMeUrlTypeSupergroup" + TypeTMeUrlTypeChatInvite = "tMeUrlTypeChatInvite" + TypeTMeUrlTypeStickerSet = "tMeUrlTypeStickerSet" + TypeTMeUrl = "tMeUrl" + TypeTMeUrls = "tMeUrls" + TypeSuggestedActionEnableArchiveAndMuteNewChats = "suggestedActionEnableArchiveAndMuteNewChats" + TypeSuggestedActionCheckPhoneNumber = "suggestedActionCheckPhoneNumber" + TypeCount = "count" + TypeText = "text" + TypeSeconds = "seconds" + TypeDeepLinkInfo = "deepLinkInfo" + TypeTextParseModeMarkdown = "textParseModeMarkdown" + TypeTextParseModeHTML = "textParseModeHTML" + TypeProxyTypeSocks5 = "proxyTypeSocks5" + TypeProxyTypeHttp = "proxyTypeHttp" + TypeProxyTypeMtproto = "proxyTypeMtproto" + TypeProxy = "proxy" + TypeProxies = "proxies" + TypeInputStickerStatic = "inputStickerStatic" + TypeInputStickerAnimated = "inputStickerAnimated" + TypeDateRange = "dateRange" + TypeStatisticalValue = "statisticalValue" + TypeStatisticalGraphData = "statisticalGraphData" + TypeStatisticalGraphAsync = "statisticalGraphAsync" + TypeStatisticalGraphError = "statisticalGraphError" + TypeChatStatisticsMessageInteractionInfo = "chatStatisticsMessageInteractionInfo" + TypeChatStatisticsMessageSenderInfo = "chatStatisticsMessageSenderInfo" + TypeChatStatisticsAdministratorActionsInfo = "chatStatisticsAdministratorActionsInfo" + TypeChatStatisticsInviterInfo = "chatStatisticsInviterInfo" + TypeChatStatisticsSupergroup = "chatStatisticsSupergroup" + TypeChatStatisticsChannel = "chatStatisticsChannel" + TypeMessageStatistics = "messageStatistics" + TypeUpdateAuthorizationState = "updateAuthorizationState" + TypeUpdateNewMessage = "updateNewMessage" + TypeUpdateMessageSendAcknowledged = "updateMessageSendAcknowledged" + TypeUpdateMessageSendSucceeded = "updateMessageSendSucceeded" + TypeUpdateMessageSendFailed = "updateMessageSendFailed" + TypeUpdateMessageContent = "updateMessageContent" + TypeUpdateMessageEdited = "updateMessageEdited" + TypeUpdateMessageIsPinned = "updateMessageIsPinned" + TypeUpdateMessageInteractionInfo = "updateMessageInteractionInfo" + TypeUpdateMessageContentOpened = "updateMessageContentOpened" + TypeUpdateMessageMentionRead = "updateMessageMentionRead" + TypeUpdateMessageLiveLocationViewed = "updateMessageLiveLocationViewed" + TypeUpdateNewChat = "updateNewChat" + TypeUpdateChatTitle = "updateChatTitle" + TypeUpdateChatPhoto = "updateChatPhoto" + TypeUpdateChatPermissions = "updateChatPermissions" + TypeUpdateChatLastMessage = "updateChatLastMessage" + TypeUpdateChatPosition = "updateChatPosition" + TypeUpdateChatIsMarkedAsUnread = "updateChatIsMarkedAsUnread" + TypeUpdateChatIsBlocked = "updateChatIsBlocked" + TypeUpdateChatHasScheduledMessages = "updateChatHasScheduledMessages" + TypeUpdateChatDefaultDisableNotification = "updateChatDefaultDisableNotification" + TypeUpdateChatReadInbox = "updateChatReadInbox" + TypeUpdateChatReadOutbox = "updateChatReadOutbox" + TypeUpdateChatUnreadMentionCount = "updateChatUnreadMentionCount" + TypeUpdateChatNotificationSettings = "updateChatNotificationSettings" + TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" + TypeUpdateChatActionBar = "updateChatActionBar" + TypeUpdateChatReplyMarkup = "updateChatReplyMarkup" + TypeUpdateChatDraftMessage = "updateChatDraftMessage" + TypeUpdateChatFilters = "updateChatFilters" + TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" + TypeUpdateNotification = "updateNotification" + TypeUpdateNotificationGroup = "updateNotificationGroup" + TypeUpdateActiveNotifications = "updateActiveNotifications" + TypeUpdateHavePendingNotifications = "updateHavePendingNotifications" + 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" + TypeUpdateNewCallSignalingData = "updateNewCallSignalingData" + TypeUpdateUserPrivacySettingRules = "updateUserPrivacySettingRules" + TypeUpdateUnreadMessageCount = "updateUnreadMessageCount" + TypeUpdateUnreadChatCount = "updateUnreadChatCount" + TypeUpdateOption = "updateOption" + TypeUpdateStickerSet = "updateStickerSet" + TypeUpdateInstalledStickerSets = "updateInstalledStickerSets" + TypeUpdateTrendingStickerSets = "updateTrendingStickerSets" + TypeUpdateRecentStickers = "updateRecentStickers" + TypeUpdateFavoriteStickers = "updateFavoriteStickers" + TypeUpdateSavedAnimations = "updateSavedAnimations" + TypeUpdateSelectedBackground = "updateSelectedBackground" + TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" + TypeUpdateConnectionState = "updateConnectionState" + TypeUpdateTermsOfService = "updateTermsOfService" + TypeUpdateUsersNearby = "updateUsersNearby" + TypeUpdateDiceEmojis = "updateDiceEmojis" + TypeUpdateAnimationSearchParameters = "updateAnimationSearchParameters" + TypeUpdateSuggestedActions = "updateSuggestedActions" + TypeUpdateNewInlineQuery = "updateNewInlineQuery" + TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult" + TypeUpdateNewCallbackQuery = "updateNewCallbackQuery" + TypeUpdateNewInlineCallbackQuery = "updateNewInlineCallbackQuery" + TypeUpdateNewShippingQuery = "updateNewShippingQuery" + TypeUpdateNewPreCheckoutQuery = "updateNewPreCheckoutQuery" + TypeUpdateNewCustomEvent = "updateNewCustomEvent" + TypeUpdateNewCustomQuery = "updateNewCustomQuery" + TypeUpdatePoll = "updatePoll" + TypeUpdatePollAnswer = "updatePollAnswer" + TypeUpdates = "updates" + TypeLogStreamDefault = "logStreamDefault" + TypeLogStreamFile = "logStreamFile" + TypeLogStreamEmpty = "logStreamEmpty" + TypeLogVerbosityLevel = "logVerbosityLevel" + TypeLogTags = "logTags" + TypeTestInt = "testInt" + TypeTestString = "testString" + TypeTestBytes = "testBytes" + TypeTestVectorInt = "testVectorInt" + TypeTestVectorIntObject = "testVectorIntObject" + TypeTestVectorString = "testVectorString" + TypeTestVectorStringObject = "testVectorStringObject" +) + +// Provides information about the method by which an authentication code is delivered to the user +type AuthenticationCodeType interface { + AuthenticationCodeTypeType() string +} + +// Represents the current authorization state of the TDLib client +type AuthorizationState interface { + AuthorizationStateType() string +} + +// Points to a file +type InputFile interface { + InputFileType() string +} + +// Describes format of the thumbnail +type ThumbnailFormat interface { + ThumbnailFormatType() string +} + +// Part of the face, relative to which a mask should be placed +type MaskPoint interface { + MaskPointType() string +} + +// Describes the type of a poll +type PollType interface { + PollTypeType() string +} + +// Represents the type of a user. The following types are possible: regular users, deleted users and bots +type UserType interface { + UserTypeType() string +} + +// Describes a photo to be set as a user profile or chat photo +type InputChatPhoto interface { + InputChatPhotoType() string +} + +// Provides information about the status of a member in a chat +type ChatMemberStatus interface { + ChatMemberStatusType() string +} + +// Specifies the kind of chat members to return in searchChatMembers +type ChatMembersFilter interface { + ChatMembersFilterType() string +} + +// Specifies the kind of chat members to return in getSupergroupMembers +type SupergroupMembersFilter interface { + SupergroupMembersFilterType() string +} + +// Describes the current secret chat state +type SecretChatState interface { + SecretChatStateType() string +} + +// Contains information about the sender of a message +type MessageSender interface { + MessageSenderType() string +} + +// Contains information about the origin of a forwarded message +type MessageForwardOrigin interface { + MessageForwardOriginType() string +} + +// Contains information about the sending state of the message +type MessageSendingState interface { + MessageSendingStateType() string +} + +// Describes the types of chats to which notification settings are applied +type NotificationSettingsScope interface { + NotificationSettingsScopeType() string +} + +// Describes the type of a chat +type ChatType interface { + ChatTypeType() string +} + +// Describes a list of chats +type ChatList interface { + ChatListType() string +} + +// Describes a reason why an external chat is shown in a chat list +type ChatSource interface { + ChatSourceType() string +} + +// Describes a type of public chats +type PublicChatType interface { + PublicChatTypeType() string +} + +// Describes actions which should be possible to do through a chat action bar +type ChatActionBar interface { + ChatActionBarType() string +} + +// Describes a keyboard button type +type KeyboardButtonType interface { + KeyboardButtonTypeType() string +} + +// Describes the type of an inline keyboard button +type InlineKeyboardButtonType interface { + InlineKeyboardButtonTypeType() string +} + +// Contains a description of a custom keyboard and actions that can be done with it to quickly reply to bots +type ReplyMarkup interface { + ReplyMarkupType() string +} + +// Contains information about an inline button of type inlineKeyboardButtonTypeLoginUrl +type LoginUrlInfo interface { + LoginUrlInfoType() string +} + +// Describes a text object inside an instant-view web page +type RichText interface { + RichTextType() string +} + +// 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 +} + +// Describes a block of an instant view web page +type PageBlock interface { + PageBlockType() string +} + +// Contains information about the payment method chosen by the user +type InputCredentials interface { + InputCredentialsType() string +} + +// Contains the type of a Telegram Passport element +type PassportElementType interface { + PassportElementTypeType() string +} + +// Contains information about a Telegram Passport element +type PassportElement interface { + PassportElementType() string +} + +// Contains information about a Telegram Passport element to be saved +type InputPassportElement interface { + InputPassportElementType() string +} + +// Contains the description of an error in a Telegram Passport element +type PassportElementErrorSource interface { + PassportElementErrorSourceType() string +} + +// Contains the description of an error in a Telegram Passport element; for bots only +type InputPassportElementErrorSource interface { + InputPassportElementErrorSourceType() string +} + +// Contains the content of a message +type MessageContent interface { + MessageContentType() string +} + +// Represents a part of the text which must be formatted differently +type TextEntityType interface { + TextEntityTypeType() string +} + +// Contains information about the time when a scheduled message will be sent +type MessageSchedulingState interface { + MessageSchedulingStateType() string +} + +// The content of a message to send +type InputMessageContent interface { + InputMessageContentType() string +} + +// Represents a filter for message search results +type SearchMessagesFilter interface { + SearchMessagesFilterType() string +} + +// Describes the different types of activity in a chat +type ChatAction interface { + ChatActionType() string +} + +// Describes the last time the user was online +type UserStatus interface { + UserStatusType() string +} + +// Describes the reason why a call was discarded +type CallDiscardReason interface { + CallDiscardReasonType() string +} + +// Describes the type of a call server +type CallServerType interface { + CallServerTypeType() string +} + +// Describes the current call state +type CallState interface { + CallStateType() string +} + +// Describes the exact type of a problem with a call +type CallProblem interface { + CallProblemType() string +} + +// Contains animated stickers which should be used for dice animation rendering +type DiceStickers interface { + DiceStickersType() string +} + +// Represents a single result of an inline query; for bots only +type InputInlineQueryResult interface { + InputInlineQueryResultType() string +} + +// Represents a single result of an inline query +type InlineQueryResult interface { + InlineQueryResultType() string +} + +// Represents a payload of a callback query +type CallbackQueryPayload interface { + CallbackQueryPayloadType() string +} + +// Represents a chat event +type ChatEventAction interface { + ChatEventActionType() string +} + +// Represents the value of a string in a language pack +type LanguagePackStringValue interface { + LanguagePackStringValueType() string +} + +// Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org +type DeviceToken interface { + DeviceTokenType() string +} + +// Describes a fill of a background +type BackgroundFill interface { + BackgroundFillType() string +} + +// Describes the type of a background +type BackgroundType interface { + BackgroundTypeType() string +} + +// Contains information about background to set +type InputBackground interface { + InputBackgroundType() string +} + +// Represents result of checking whether the current session can be used to transfer a chat ownership to another user +type CanTransferOwnershipResult interface { + CanTransferOwnershipResultType() string +} + +// Represents result of checking whether a username can be set for a chat +type CheckChatUsernameResult interface { + CheckChatUsernameResultType() string +} + +// Contains content of a push message notification +type PushMessageContent interface { + PushMessageContentType() string +} + +// Contains detailed information about a notification +type NotificationType interface { + NotificationTypeType() string +} + +// Describes the type of notifications in a notification group +type NotificationGroupType interface { + NotificationGroupTypeType() string +} + +// Represents the value of an option +type OptionValue interface { + OptionValueType() string +} + +// Represents a JSON value +type JsonValue interface { + JsonValueType() string +} + +// Represents a single rule for managing privacy settings +type UserPrivacySettingRule interface { + UserPrivacySettingRuleType() string +} + +// Describes available user privacy settings +type UserPrivacySetting interface { + UserPrivacySettingType() string +} + +// Describes the reason why a chat is reported +type ChatReportReason interface { + ChatReportReasonType() string +} + +// Represents the type of a file +type FileType interface { + FileTypeType() string +} + +// Represents the type of a network +type NetworkType interface { + NetworkTypeType() string +} + +// Contains statistics about network usage +type NetworkStatisticsEntry interface { + NetworkStatisticsEntryType() string +} + +// Describes the current state of the connection to Telegram servers +type ConnectionState interface { + ConnectionStateType() string +} + +// Represents the categories of chats for which a list of frequently used chats can be retrieved +type TopChatCategory interface { + TopChatCategoryType() string +} + +// Describes the type of a URL linking to an internal Telegram entity +type TMeUrlType interface { + TMeUrlTypeType() string +} + +// Describes an action suggested to the current user +type SuggestedAction interface { + SuggestedActionType() string +} + +// Describes the way the text should be parsed for TextEntities +type TextParseMode interface { + TextParseModeType() string +} + +// Describes the type of a proxy server +type ProxyType interface { + ProxyTypeType() string +} + +// Describes a sticker that needs to be added to a sticker set +type InputSticker interface { + InputStickerType() string +} + +// Describes a statistical graph +type StatisticalGraph interface { + StatisticalGraphType() string +} + +// Contains a detailed statistics about a chat +type ChatStatistics interface { + ChatStatisticsType() string +} + +// Contains notifications about data changes +type Update interface { + UpdateType() string +} + +// Describes a stream to which TDLib internal log is written +type LogStream interface { + LogStreamType() string +} + +// An object of this type can be returned on every function call, in case of an error +type Error struct { + 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"` +} + +func (entity *Error) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Error + + return json.Marshal((*stub)(entity)) +} + +func (*Error) GetClass() string { + return ClassError +} + +func (*Error) GetType() string { + return TypeError +} + +// An object of this type is returned on a successful function call for certain functions +type Ok struct { + meta +} + +func (entity *Ok) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Ok + + return json.Marshal((*stub)(entity)) +} + +func (*Ok) GetClass() string { + return ClassOk +} + +func (*Ok) GetType() string { + return TypeOk +} + +// Contains parameters for TDLib initialization +type TdlibParameters struct { + 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. If empty, the version is automatically detected by TDLib + 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"` +} + +func (entity *TdlibParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TdlibParameters + + return json.Marshal((*stub)(entity)) +} + +func (*TdlibParameters) GetClass() string { + return ClassTdlibParameters +} + +func (*TdlibParameters) GetType() string { + return TypeTdlibParameters +} + +// An authentication code is delivered via a private Telegram message, which can be viewed from another active session +type AuthenticationCodeTypeTelegramMessage struct { + meta + // Length of the code + Length int32 `json:"length"` +} + +func (entity *AuthenticationCodeTypeTelegramMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeTypeTelegramMessage + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeTypeTelegramMessage) GetClass() string { + return ClassAuthenticationCodeType +} + +func (*AuthenticationCodeTypeTelegramMessage) GetType() string { + return TypeAuthenticationCodeTypeTelegramMessage +} + +func (*AuthenticationCodeTypeTelegramMessage) AuthenticationCodeTypeType() string { + return TypeAuthenticationCodeTypeTelegramMessage +} + +// An authentication code is delivered via an SMS message to the specified phone number +type AuthenticationCodeTypeSms struct { + meta + // Length of the code + Length int32 `json:"length"` +} + +func (entity *AuthenticationCodeTypeSms) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeTypeSms + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeTypeSms) GetClass() string { + return ClassAuthenticationCodeType +} + +func (*AuthenticationCodeTypeSms) GetType() string { + return TypeAuthenticationCodeTypeSms +} + +func (*AuthenticationCodeTypeSms) AuthenticationCodeTypeType() string { + return TypeAuthenticationCodeTypeSms +} + +// An authentication code is delivered via a phone call to the specified phone number +type AuthenticationCodeTypeCall struct { + meta + // Length of the code + Length int32 `json:"length"` +} + +func (entity *AuthenticationCodeTypeCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeTypeCall + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeTypeCall) GetClass() string { + return ClassAuthenticationCodeType +} + +func (*AuthenticationCodeTypeCall) GetType() string { + return TypeAuthenticationCodeTypeCall +} + +func (*AuthenticationCodeTypeCall) AuthenticationCodeTypeType() string { + return TypeAuthenticationCodeTypeCall +} + +// 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 { + meta + // Pattern of the phone number from which the call will be made + Pattern string `json:"pattern"` +} + +func (entity *AuthenticationCodeTypeFlashCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeTypeFlashCall + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeTypeFlashCall) GetClass() string { + return ClassAuthenticationCodeType +} + +func (*AuthenticationCodeTypeFlashCall) GetType() string { + return TypeAuthenticationCodeTypeFlashCall +} + +func (*AuthenticationCodeTypeFlashCall) AuthenticationCodeTypeType() string { + return TypeAuthenticationCodeTypeFlashCall +} + +// Information about the authentication code that was sent +type AuthenticationCodeInfo struct { + 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"` +} + +func (entity *AuthenticationCodeInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeInfo + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeInfo) GetClass() string { + return ClassAuthenticationCodeInfo +} + +func (*AuthenticationCodeInfo) GetType() string { + return TypeAuthenticationCodeInfo +} + +func (authenticationCodeInfo *AuthenticationCodeInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + PhoneNumber string `json:"phone_number"` + Type json.RawMessage `json:"type"` + NextType json.RawMessage `json:"next_type"` + Timeout int32 `json:"timeout"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + authenticationCodeInfo.PhoneNumber = tmp.PhoneNumber + authenticationCodeInfo.Timeout = tmp.Timeout + + fieldType, _ := UnmarshalAuthenticationCodeType(tmp.Type) + authenticationCodeInfo.Type = fieldType + + fieldNextType, _ := UnmarshalAuthenticationCodeType(tmp.NextType) + authenticationCodeInfo.NextType = fieldNextType + + return nil +} + +// Information about the email address authentication code that was sent +type EmailAddressAuthenticationCodeInfo struct { + 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"` +} + +func (entity *EmailAddressAuthenticationCodeInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmailAddressAuthenticationCodeInfo + + return json.Marshal((*stub)(entity)) +} + +func (*EmailAddressAuthenticationCodeInfo) GetClass() string { + return ClassEmailAddressAuthenticationCodeInfo +} + +func (*EmailAddressAuthenticationCodeInfo) GetType() string { + return TypeEmailAddressAuthenticationCodeInfo +} + +// Represents a part of the text that needs to be formatted in some unusual way +type TextEntity struct { + meta + // Offset of the entity, in UTF-16 code units + Offset int32 `json:"offset"` + // Length of the entity, in UTF-16 code units + Length int32 `json:"length"` + // Type of the entity + Type TextEntityType `json:"type"` +} + +func (entity *TextEntity) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntity + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntity) GetClass() string { + return ClassTextEntity +} + +func (*TextEntity) GetType() string { + return TypeTextEntity +} + +func (textEntity *TextEntity) UnmarshalJSON(data []byte) error { + var tmp struct { + Offset int32 `json:"offset"` + Length int32 `json:"length"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + textEntity.Offset = tmp.Offset + textEntity.Length = tmp.Length + + fieldType, _ := UnmarshalTextEntityType(tmp.Type) + textEntity.Type = fieldType + + return nil +} + +// Contains a list of text entities +type TextEntities struct { + meta + // List of text entities + Entities []*TextEntity `json:"entities"` +} + +func (entity *TextEntities) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntities + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntities) GetClass() string { + return ClassTextEntities +} + +func (*TextEntities) GetType() string { + return TypeTextEntities +} + +// A text with some entities +type FormattedText struct { + meta + // The text + Text string `json:"text"` + // Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. Pre, Code and PreCode entities can't contain other entities. Bold, Italic, Underline and Strikethrough entities can contain and to be contained in all other entities. All other entities can't contain each other + Entities []*TextEntity `json:"entities"` +} + +func (entity *FormattedText) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FormattedText + + return json.Marshal((*stub)(entity)) +} + +func (*FormattedText) GetClass() string { + return ClassFormattedText +} + +func (*FormattedText) GetType() string { + return TypeFormattedText +} + +// Contains Telegram terms of service +type TermsOfService struct { + meta + // Text of the terms of service + Text *FormattedText `json:"text"` + // The minimum age of a user to be able to accept the terms; 0 if any + 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"` +} + +func (entity *TermsOfService) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TermsOfService + + return json.Marshal((*stub)(entity)) +} + +func (*TermsOfService) GetClass() string { + return ClassTermsOfService +} + +func (*TermsOfService) GetType() string { + return TypeTermsOfService +} + +// TDLib needs TdlibParameters for initialization +type AuthorizationStateWaitTdlibParameters struct { + meta +} + +func (entity *AuthorizationStateWaitTdlibParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateWaitTdlibParameters + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateWaitTdlibParameters) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateWaitTdlibParameters) GetType() string { + return TypeAuthorizationStateWaitTdlibParameters +} + +func (*AuthorizationStateWaitTdlibParameters) AuthorizationStateType() string { + return TypeAuthorizationStateWaitTdlibParameters +} + +// TDLib needs an encryption key to decrypt the local database +type AuthorizationStateWaitEncryptionKey struct { + meta + // True, if the database is currently encrypted + IsEncrypted bool `json:"is_encrypted"` +} + +func (entity *AuthorizationStateWaitEncryptionKey) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateWaitEncryptionKey + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateWaitEncryptionKey) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateWaitEncryptionKey) GetType() string { + return TypeAuthorizationStateWaitEncryptionKey +} + +func (*AuthorizationStateWaitEncryptionKey) AuthorizationStateType() string { + return TypeAuthorizationStateWaitEncryptionKey +} + +// TDLib needs the user's phone number to authorize. Call `setAuthenticationPhoneNumber` to provide the phone number, or use `requestQrCodeAuthentication`, or `checkAuthenticationBotToken` for other authentication options +type AuthorizationStateWaitPhoneNumber struct { + meta +} + +func (entity *AuthorizationStateWaitPhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateWaitPhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateWaitPhoneNumber) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateWaitPhoneNumber) GetType() string { + return TypeAuthorizationStateWaitPhoneNumber +} + +func (*AuthorizationStateWaitPhoneNumber) AuthorizationStateType() string { + return TypeAuthorizationStateWaitPhoneNumber +} + +// TDLib needs the user's authentication code to authorize +type AuthorizationStateWaitCode struct { + meta + // Information about the authorization code that was sent + CodeInfo *AuthenticationCodeInfo `json:"code_info"` +} + +func (entity *AuthorizationStateWaitCode) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateWaitCode + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateWaitCode) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateWaitCode) GetType() string { + return TypeAuthorizationStateWaitCode +} + +func (*AuthorizationStateWaitCode) AuthorizationStateType() string { + return TypeAuthorizationStateWaitCode +} + +// The user needs to confirm authorization on another logged in device by scanning a QR code with the provided link +type AuthorizationStateWaitOtherDeviceConfirmation struct { + meta + // A tg:// URL for the QR code. The link will be updated frequently + Link string `json:"link"` +} + +func (entity *AuthorizationStateWaitOtherDeviceConfirmation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateWaitOtherDeviceConfirmation + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateWaitOtherDeviceConfirmation) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateWaitOtherDeviceConfirmation) GetType() string { + return TypeAuthorizationStateWaitOtherDeviceConfirmation +} + +func (*AuthorizationStateWaitOtherDeviceConfirmation) AuthorizationStateType() string { + return TypeAuthorizationStateWaitOtherDeviceConfirmation +} + +// 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 +} + +// The user has been authorized, but needs to enter a password to start using the application +type AuthorizationStateWaitPassword struct { + meta + // Hint for the password; may be empty + PasswordHint string `json:"password_hint"` + // True, if a recovery email address has been set up + 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"` +} + +func (entity *AuthorizationStateWaitPassword) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateWaitPassword + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateWaitPassword) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateWaitPassword) GetType() string { + return TypeAuthorizationStateWaitPassword +} + +func (*AuthorizationStateWaitPassword) AuthorizationStateType() string { + return TypeAuthorizationStateWaitPassword +} + +// The user has been successfully authorized. TDLib is now ready to answer queries +type AuthorizationStateReady struct { + meta +} + +func (entity *AuthorizationStateReady) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateReady + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateReady) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateReady) GetType() string { + return TypeAuthorizationStateReady +} + +func (*AuthorizationStateReady) AuthorizationStateType() string { + return TypeAuthorizationStateReady +} + +// The user is currently logging out +type AuthorizationStateLoggingOut struct { + meta +} + +func (entity *AuthorizationStateLoggingOut) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateLoggingOut + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateLoggingOut) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateLoggingOut) GetType() string { + return TypeAuthorizationStateLoggingOut +} + +func (*AuthorizationStateLoggingOut) AuthorizationStateType() string { + return TypeAuthorizationStateLoggingOut +} + +// 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 +type AuthorizationStateClosing struct { + meta +} + +func (entity *AuthorizationStateClosing) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateClosing + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateClosing) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateClosing) GetType() string { + return TypeAuthorizationStateClosing +} + +func (*AuthorizationStateClosing) AuthorizationStateType() string { + return TypeAuthorizationStateClosing +} + +// 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 +type AuthorizationStateClosed struct { + meta +} + +func (entity *AuthorizationStateClosed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateClosed + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateClosed) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateClosed) GetType() string { + return TypeAuthorizationStateClosed +} + +func (*AuthorizationStateClosed) AuthorizationStateType() string { + return TypeAuthorizationStateClosed +} + +// Represents the current state of 2-step verification +type PasswordState struct { + meta + // True, if a 2-step verification password is set + HasPassword bool `json:"has_password"` + // Hint for the password; may be empty + PasswordHint string `json:"password_hint"` + // True, if a recovery email is set + HasRecoveryEmailAddress bool `json:"has_recovery_email_address"` + // True, if some Telegram Passport elements were saved + HasPassportData bool `json:"has_passport_data"` + // Information about the recovery email address to which the confirmation email was sent; may be null + RecoveryEmailAddressCodeInfo *EmailAddressAuthenticationCodeInfo `json:"recovery_email_address_code_info"` +} + +func (entity *PasswordState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PasswordState + + return json.Marshal((*stub)(entity)) +} + +func (*PasswordState) GetClass() string { + return ClassPasswordState +} + +func (*PasswordState) GetType() string { + return TypePasswordState +} + +// Contains information about the current recovery email address +type RecoveryEmailAddress struct { + meta + // Recovery email address + RecoveryEmailAddress string `json:"recovery_email_address"` +} + +func (entity *RecoveryEmailAddress) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RecoveryEmailAddress + + return json.Marshal((*stub)(entity)) +} + +func (*RecoveryEmailAddress) GetClass() string { + return ClassRecoveryEmailAddress +} + +func (*RecoveryEmailAddress) GetType() string { + return TypeRecoveryEmailAddress +} + +// Returns information about the availability of a temporary password, which can be used for payments +type TemporaryPasswordState struct { + 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"` +} + +func (entity *TemporaryPasswordState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TemporaryPasswordState + + return json.Marshal((*stub)(entity)) +} + +func (*TemporaryPasswordState) GetClass() string { + return ClassTemporaryPasswordState +} + +func (*TemporaryPasswordState) GetType() string { + return TypeTemporaryPasswordState +} + +// Represents a local file +type LocalFile struct { + 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"` + // 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 + 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"` +} + +func (entity *LocalFile) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LocalFile + + return json.Marshal((*stub)(entity)) +} + +func (*LocalFile) GetClass() string { + return ClassLocalFile +} + +func (*LocalFile) GetType() string { + return TypeLocalFile +} + +// Represents a remote file +type RemoteFile struct { + meta + // Remote file identifier; may be empty. Can be used by the current user across application restarts or even from other devices. Uniquely identifies a file, but a file can have a lot of different valid identifiers. 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 application with the HTTP URL in the original_path and "#url#" as the conversion string. Application should generate the file by downloading it to the specified location + Id string `json:"id"` + // Unique file identifier; may be empty if unknown. The unique file identifier which is the same for the same file even for different users and is persistent over time + UniqueId string `json:"unique_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"` +} + +func (entity *RemoteFile) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RemoteFile + + return json.Marshal((*stub)(entity)) +} + +func (*RemoteFile) GetClass() string { + return ClassRemoteFile +} + +func (*RemoteFile) GetType() string { + return TypeRemoteFile +} + +// Represents a file +type File struct { + 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"` +} + +func (entity *File) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub File + + return json.Marshal((*stub)(entity)) +} + +func (*File) GetClass() string { + return ClassFile +} + +func (*File) GetType() string { + return TypeFile +} + +// A file defined by its unique ID +type InputFileId struct { + meta + // Unique file identifier + Id int32 `json:"id"` +} + +func (entity *InputFileId) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputFileId + + return json.Marshal((*stub)(entity)) +} + +func (*InputFileId) GetClass() string { + return ClassInputFile +} + +func (*InputFileId) GetType() string { + return TypeInputFileId +} + +func (*InputFileId) InputFileType() string { + return TypeInputFileId +} + +// A file defined by its remote ID. The remote ID is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application +type InputFileRemote struct { + meta + // Remote file identifier + Id string `json:"id"` +} + +func (entity *InputFileRemote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputFileRemote + + return json.Marshal((*stub)(entity)) +} + +func (*InputFileRemote) GetClass() string { + return ClassInputFile +} + +func (*InputFileRemote) GetType() string { + return TypeInputFileRemote +} + +func (*InputFileRemote) InputFileType() string { + return TypeInputFileRemote +} + +// A file defined by a local path +type InputFileLocal struct { + meta + // Local path to the file + Path string `json:"path"` +} + +func (entity *InputFileLocal) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputFileLocal + + return json.Marshal((*stub)(entity)) +} + +func (*InputFileLocal) GetClass() string { + return ClassInputFile +} + +func (*InputFileLocal) GetType() string { + return TypeInputFileLocal +} + +func (*InputFileLocal) InputFileType() string { + return TypeInputFileLocal +} + +// A file generated by the application +type InputFileGenerated struct { + 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"` + // String specifying the conversion applied to the original file; should be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage + Conversion string `json:"conversion"` + // Expected size of the generated file; 0 if unknown + ExpectedSize int32 `json:"expected_size"` +} + +func (entity *InputFileGenerated) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputFileGenerated + + return json.Marshal((*stub)(entity)) +} + +func (*InputFileGenerated) GetClass() string { + return ClassInputFile +} + +func (*InputFileGenerated) GetType() string { + return TypeInputFileGenerated +} + +func (*InputFileGenerated) InputFileType() string { + return TypeInputFileGenerated +} + +// Describes an image in JPEG format +type PhotoSize struct { + meta + // Image type (see https://core.telegram.org/constructor/photoSize) + Type string `json:"type"` + // Information about the image file + Photo *File `json:"photo"` + // Image width + Width int32 `json:"width"` + // Image height + Height int32 `json:"height"` + // Sizes of progressive JPEG file prefixes, which can be used to preliminarily show the image + ProgressiveSizes []int32 `json:"progressive_sizes"` +} + +func (entity *PhotoSize) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PhotoSize + + return json.Marshal((*stub)(entity)) +} + +func (*PhotoSize) GetClass() string { + return ClassPhotoSize +} + +func (*PhotoSize) GetType() string { + return TypePhotoSize +} + +// 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 +} + +// The thumbnail is in JPEG format +type ThumbnailFormatJpeg struct { + meta +} + +func (entity *ThumbnailFormatJpeg) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ThumbnailFormatJpeg + + return json.Marshal((*stub)(entity)) +} + +func (*ThumbnailFormatJpeg) GetClass() string { + return ClassThumbnailFormat +} + +func (*ThumbnailFormatJpeg) GetType() string { + return TypeThumbnailFormatJpeg +} + +func (*ThumbnailFormatJpeg) ThumbnailFormatType() string { + return TypeThumbnailFormatJpeg +} + +// The thumbnail is in PNG format. It will be used only for background patterns +type ThumbnailFormatPng struct { + meta +} + +func (entity *ThumbnailFormatPng) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ThumbnailFormatPng + + return json.Marshal((*stub)(entity)) +} + +func (*ThumbnailFormatPng) GetClass() string { + return ClassThumbnailFormat +} + +func (*ThumbnailFormatPng) GetType() string { + return TypeThumbnailFormatPng +} + +func (*ThumbnailFormatPng) ThumbnailFormatType() string { + return TypeThumbnailFormatPng +} + +// The thumbnail is in WEBP format. It will be used only for some stickers +type ThumbnailFormatWebp struct { + meta +} + +func (entity *ThumbnailFormatWebp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ThumbnailFormatWebp + + return json.Marshal((*stub)(entity)) +} + +func (*ThumbnailFormatWebp) GetClass() string { + return ClassThumbnailFormat +} + +func (*ThumbnailFormatWebp) GetType() string { + return TypeThumbnailFormatWebp +} + +func (*ThumbnailFormatWebp) ThumbnailFormatType() string { + return TypeThumbnailFormatWebp +} + +// The thumbnail is in static GIF format. It will be used only for some bot inline results +type ThumbnailFormatGif struct { + meta +} + +func (entity *ThumbnailFormatGif) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ThumbnailFormatGif + + return json.Marshal((*stub)(entity)) +} + +func (*ThumbnailFormatGif) GetClass() string { + return ClassThumbnailFormat +} + +func (*ThumbnailFormatGif) GetType() string { + return TypeThumbnailFormatGif +} + +func (*ThumbnailFormatGif) ThumbnailFormatType() string { + return TypeThumbnailFormatGif +} + +// The thumbnail is in TGS format. It will be used only for animated sticker sets +type ThumbnailFormatTgs struct { + meta +} + +func (entity *ThumbnailFormatTgs) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ThumbnailFormatTgs + + return json.Marshal((*stub)(entity)) +} + +func (*ThumbnailFormatTgs) GetClass() string { + return ClassThumbnailFormat +} + +func (*ThumbnailFormatTgs) GetType() string { + return TypeThumbnailFormatTgs +} + +func (*ThumbnailFormatTgs) ThumbnailFormatType() string { + return TypeThumbnailFormatTgs +} + +// The thumbnail is in MPEG4 format. It will be used only for some animations and videos +type ThumbnailFormatMpeg4 struct { + meta +} + +func (entity *ThumbnailFormatMpeg4) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ThumbnailFormatMpeg4 + + return json.Marshal((*stub)(entity)) +} + +func (*ThumbnailFormatMpeg4) GetClass() string { + return ClassThumbnailFormat +} + +func (*ThumbnailFormatMpeg4) GetType() string { + return TypeThumbnailFormatMpeg4 +} + +func (*ThumbnailFormatMpeg4) ThumbnailFormatType() string { + return TypeThumbnailFormatMpeg4 +} + +// Represents a thumbnail +type Thumbnail struct { + meta + // Thumbnail format + Format ThumbnailFormat `json:"format"` + // Thumbnail width + Width int32 `json:"width"` + // Thumbnail height + Height int32 `json:"height"` + // The thumbnail + File *File `json:"file"` +} + +func (entity *Thumbnail) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Thumbnail + + return json.Marshal((*stub)(entity)) +} + +func (*Thumbnail) GetClass() string { + return ClassThumbnail +} + +func (*Thumbnail) GetType() string { + return TypeThumbnail +} + +func (thumbnail *Thumbnail) UnmarshalJSON(data []byte) error { + var tmp struct { + Format json.RawMessage `json:"format"` + Width int32 `json:"width"` + Height int32 `json:"height"` + File *File `json:"file"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + thumbnail.Width = tmp.Width + thumbnail.Height = tmp.Height + thumbnail.File = tmp.File + + fieldFormat, _ := UnmarshalThumbnailFormat(tmp.Format) + thumbnail.Format = fieldFormat + + return nil +} + +// A mask should be placed relatively to the forehead +type MaskPointForehead struct { + meta +} + +func (entity *MaskPointForehead) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MaskPointForehead + + return json.Marshal((*stub)(entity)) +} + +func (*MaskPointForehead) GetClass() string { + return ClassMaskPoint +} + +func (*MaskPointForehead) GetType() string { + return TypeMaskPointForehead +} + +func (*MaskPointForehead) MaskPointType() string { + return TypeMaskPointForehead +} + +// A mask should be placed relatively to the eyes +type MaskPointEyes struct { + meta +} + +func (entity *MaskPointEyes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MaskPointEyes + + return json.Marshal((*stub)(entity)) +} + +func (*MaskPointEyes) GetClass() string { + return ClassMaskPoint +} + +func (*MaskPointEyes) GetType() string { + return TypeMaskPointEyes +} + +func (*MaskPointEyes) MaskPointType() string { + return TypeMaskPointEyes +} + +// A mask should be placed relatively to the mouth +type MaskPointMouth struct { + meta +} + +func (entity *MaskPointMouth) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MaskPointMouth + + return json.Marshal((*stub)(entity)) +} + +func (*MaskPointMouth) GetClass() string { + return ClassMaskPoint +} + +func (*MaskPointMouth) GetType() string { + return TypeMaskPointMouth +} + +func (*MaskPointMouth) MaskPointType() string { + return TypeMaskPointMouth +} + +// A mask should be placed relatively to the chin +type MaskPointChin struct { + meta +} + +func (entity *MaskPointChin) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MaskPointChin + + return json.Marshal((*stub)(entity)) +} + +func (*MaskPointChin) GetClass() string { + return ClassMaskPoint +} + +func (*MaskPointChin) GetType() string { + return TypeMaskPointChin +} + +func (*MaskPointChin) MaskPointType() string { + return TypeMaskPointChin +} + +// Position on a photo where a mask should be placed +type MaskPosition struct { + 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"` +} + +func (entity *MaskPosition) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MaskPosition + + return json.Marshal((*stub)(entity)) +} + +func (*MaskPosition) GetClass() string { + return ClassMaskPosition +} + +func (*MaskPosition) GetType() string { + return TypeMaskPosition +} + +func (maskPosition *MaskPosition) UnmarshalJSON(data []byte) error { + var tmp struct { + Point json.RawMessage `json:"point"` + XShift float64 `json:"x_shift"` + YShift float64 `json:"y_shift"` + Scale float64 `json:"scale"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + maskPosition.XShift = tmp.XShift + maskPosition.YShift = tmp.YShift + maskPosition.Scale = tmp.Scale + + fieldPoint, _ := UnmarshalMaskPoint(tmp.Point) + maskPosition.Point = fieldPoint + + return nil +} + +// 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 +} + +// A regular poll +type PollTypeRegular struct { + meta + // True, if multiple answer options can be chosen simultaneously + AllowMultipleAnswers bool `json:"allow_multiple_answers"` +} + +func (entity *PollTypeRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PollTypeRegular + + return json.Marshal((*stub)(entity)) +} + +func (*PollTypeRegular) GetClass() string { + return ClassPollType +} + +func (*PollTypeRegular) GetType() string { + return TypePollTypeRegular +} + +func (*PollTypeRegular) PollTypeType() string { + return TypePollTypeRegular +} + +// A poll in quiz mode, which has exactly one correct answer option and can be answered only once +type PollTypeQuiz struct { + meta + // 0-based identifier of the correct answer option; -1 for a yet unanswered poll + CorrectOptionId int32 `json:"correct_option_id"` + // Text that is shown when the user chooses an incorrect answer or taps on the lamp icon, 0-200 characters with at most 2 line feeds; empty for a yet unanswered poll + Explanation *FormattedText `json:"explanation"` +} + +func (entity *PollTypeQuiz) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PollTypeQuiz + + return json.Marshal((*stub)(entity)) +} + +func (*PollTypeQuiz) GetClass() string { + return ClassPollType +} + +func (*PollTypeQuiz) GetType() string { + return TypePollTypeQuiz +} + +func (*PollTypeQuiz) PollTypeType() string { + return TypePollTypeQuiz +} + +// Describes an animation file. The animation must be encoded in GIF or MPEG4 format +type Animation struct { + 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"` + // True, if stickers were added to the animation. The list of corresponding sticker set can be received using getAttachedStickerSets + HasStickers bool `json:"has_stickers"` + // Animation minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Animation thumbnail in JPEG or MPEG4 format; may be null + Thumbnail *Thumbnail `json:"thumbnail"` + // File containing the animation + Animation *File `json:"animation"` +} + +func (entity *Animation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Animation + + return json.Marshal((*stub)(entity)) +} + +func (*Animation) GetClass() string { + return ClassAnimation +} + +func (*Animation) GetType() string { + return TypeAnimation +} + +// Describes an audio file. Audio is usually in MP3 or M4A format +type Audio struct { + 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"` + // The minithumbnail of the album cover; may be null + AlbumCoverMinithumbnail *Minithumbnail `json:"album_cover_minithumbnail"` + // The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail should be extracted from the downloaded file; may be null + AlbumCoverThumbnail *Thumbnail `json:"album_cover_thumbnail"` + // File containing the audio + Audio *File `json:"audio"` +} + +func (entity *Audio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Audio + + return json.Marshal((*stub)(entity)) +} + +func (*Audio) GetClass() string { + return ClassAudio +} + +func (*Audio) GetType() string { + return TypeAudio +} + +// Describes a document of any type +type Document struct { + 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"` + // 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 + Thumbnail *Thumbnail `json:"thumbnail"` + // File containing the document + Document *File `json:"document"` +} + +func (entity *Document) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Document + + return json.Marshal((*stub)(entity)) +} + +func (*Document) GetClass() string { + return ClassDocument +} + +func (*Document) GetType() string { + return TypeDocument +} + +// Describes a photo +type Photo struct { + meta + // True, if stickers were added to the photo. The list of corresponding sticker sets can be received using getAttachedStickerSets + HasStickers bool `json:"has_stickers"` + // Photo minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Available variants of the photo, in different sizes + Sizes []*PhotoSize `json:"sizes"` +} + +func (entity *Photo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Photo + + return json.Marshal((*stub)(entity)) +} + +func (*Photo) GetClass() string { + return ClassPhoto +} + +func (*Photo) GetType() string { + return TypePhoto +} + +// Describes a sticker +type Sticker struct { + 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"` + // True, if the sticker is an animated sticker in TGS format + IsAnimated bool `json:"is_animated"` + // 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 *Thumbnail `json:"thumbnail"` + // File containing the sticker + Sticker *File `json:"sticker"` +} + +func (entity *Sticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Sticker + + return json.Marshal((*stub)(entity)) +} + +func (*Sticker) GetClass() string { + return ClassSticker +} + +func (*Sticker) GetType() string { + return TypeSticker +} + +// Describes a video file +type Video struct { + 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 video. The list of corresponding sticker sets can be received using getAttachedStickerSets + HasStickers bool `json:"has_stickers"` + // True, if the video should be tried to be streamed + SupportsStreaming bool `json:"supports_streaming"` + // Video minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Video thumbnail in JPEG or MPEG4 format; as defined by the sender; may be null + Thumbnail *Thumbnail `json:"thumbnail"` + // File containing the video + Video *File `json:"video"` +} + +func (entity *Video) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Video + + return json.Marshal((*stub)(entity)) +} + +func (*Video) GetClass() string { + return ClassVideo +} + +func (*Video) GetType() string { + return TypeVideo +} + +// 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 { + 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"` + // Video minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Video thumbnail in JPEG format; as defined by the sender; may be null + Thumbnail *Thumbnail `json:"thumbnail"` + // File containing the video + Video *File `json:"video"` +} + +func (entity *VideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*VideoNote) GetClass() string { + return ClassVideoNote +} + +func (*VideoNote) GetType() string { + return TypeVideoNote +} + +// 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 { + 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"` +} + +func (entity *VoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*VoiceNote) GetClass() string { + return ClassVoiceNote +} + +func (*VoiceNote) GetType() string { + return TypeVoiceNote +} + +// Describes a user contact +type Contact struct { + 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"` +} + +func (entity *Contact) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Contact + + return json.Marshal((*stub)(entity)) +} + +func (*Contact) GetClass() string { + return ClassContact +} + +func (*Contact) GetType() string { + return TypeContact +} + +// Describes a location on planet Earth +type Location struct { + 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"` + // The estimated horizontal accuracy of the location, in meters; as defined by the sender. 0 if unknown + HorizontalAccuracy float64 `json:"horizontal_accuracy"` +} + +func (entity *Location) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Location + + return json.Marshal((*stub)(entity)) +} + +func (*Location) GetClass() string { + return ClassLocation +} + +func (*Location) GetType() string { + return TypeLocation +} + +// Describes a venue +type Venue struct { + 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" and "gplaces" (Google Places) need 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"` +} + +func (entity *Venue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Venue + + return json.Marshal((*stub)(entity)) +} + +func (*Venue) GetClass() string { + return ClassVenue +} + +func (*Venue) GetType() string { + return TypeVenue +} + +// Describes a game +type Game struct { + 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"` +} + +func (entity *Game) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Game + + return json.Marshal((*stub)(entity)) +} + +func (*Game) GetClass() string { + return ClassGame +} + +func (*Game) GetType() string { + return TypeGame +} + +// Describes a poll +type Poll struct { + meta + // Unique poll identifier + Id JsonInt64 `json:"id"` + // Poll question, 1-300 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"` + // User identifiers of recent voters, if the poll is non-anonymous + RecentVoterUserIds []int32 `json:"recent_voter_user_ids"` + // True, if the poll is anonymous + IsAnonymous bool `json:"is_anonymous"` + // Type of the poll + Type PollType `json:"type"` + // Amount of time the poll will be active after creation, in seconds + OpenPeriod int32 `json:"open_period"` + // Point in time (Unix timestamp) when the poll will be automatically closed + CloseDate int32 `json:"close_date"` + // 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 +} + +func (poll *Poll) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + Question string `json:"question"` + Options []*PollOption `json:"options"` + TotalVoterCount int32 `json:"total_voter_count"` + RecentVoterUserIds []int32 `json:"recent_voter_user_ids"` + IsAnonymous bool `json:"is_anonymous"` + Type json.RawMessage `json:"type"` + OpenPeriod int32 `json:"open_period"` + CloseDate int32 `json:"close_date"` + IsClosed bool `json:"is_closed"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + poll.Id = tmp.Id + poll.Question = tmp.Question + poll.Options = tmp.Options + poll.TotalVoterCount = tmp.TotalVoterCount + poll.RecentVoterUserIds = tmp.RecentVoterUserIds + poll.IsAnonymous = tmp.IsAnonymous + poll.OpenPeriod = tmp.OpenPeriod + poll.CloseDate = tmp.CloseDate + poll.IsClosed = tmp.IsClosed + + fieldType, _ := UnmarshalPollType(tmp.Type) + poll.Type = fieldType + + return nil +} + +// Describes a user profile photo +type ProfilePhoto struct { + meta + // Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of user profile photos + Id JsonInt64 `json:"id"` + // A small (160x160) user profile photo. The file can be downloaded only before the photo is changed + Small *File `json:"small"` + // A big (640x640) user profile photo. The file can be downloaded only before the photo is changed + Big *File `json:"big"` + // True, if the photo has animated variant + HasAnimation bool `json:"has_animation"` +} + +func (entity *ProfilePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfilePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*ProfilePhoto) GetClass() string { + return ClassProfilePhoto +} + +func (*ProfilePhoto) GetType() string { + return TypeProfilePhoto +} + +// Contains basic information about the photo of a chat +type ChatPhotoInfo struct { + meta + // A small (160x160) chat photo variant in JPEG format. The file can be downloaded only before the photo is changed + Small *File `json:"small"` + // A big (640x640) chat photo variant in JPEG format. The file can be downloaded only before the photo is changed + Big *File `json:"big"` + // True, if the photo has animated variant + HasAnimation bool `json:"has_animation"` +} + +func (entity *ChatPhotoInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatPhotoInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ChatPhotoInfo) GetClass() string { + return ClassChatPhotoInfo +} + +func (*ChatPhotoInfo) GetType() string { + return TypeChatPhotoInfo +} + +// A regular user +type UserTypeRegular struct { + meta +} + +func (entity *UserTypeRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserTypeRegular + + return json.Marshal((*stub)(entity)) +} + +func (*UserTypeRegular) GetClass() string { + return ClassUserType +} + +func (*UserTypeRegular) GetType() string { + return TypeUserTypeRegular +} + +func (*UserTypeRegular) UserTypeType() string { + return TypeUserTypeRegular +} + +// A deleted user or deleted bot. No information on the user besides the user identifier is available. It is not possible to perform any active actions on this type of user +type UserTypeDeleted struct { + meta +} + +func (entity *UserTypeDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserTypeDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*UserTypeDeleted) GetClass() string { + return ClassUserType +} + +func (*UserTypeDeleted) GetType() string { + return TypeUserTypeDeleted +} + +func (*UserTypeDeleted) UserTypeType() string { + return TypeUserTypeDeleted +} + +// A bot (see https://core.telegram.org/bots) +type UserTypeBot struct { + 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 application 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"` +} + +func (entity *UserTypeBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserTypeBot + + return json.Marshal((*stub)(entity)) +} + +func (*UserTypeBot) GetClass() string { + return ClassUserType +} + +func (*UserTypeBot) GetType() string { + return TypeUserTypeBot +} + +func (*UserTypeBot) UserTypeType() string { + return TypeUserTypeBot +} + +// No information on the user besides the user identifier 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 +type UserTypeUnknown struct { + meta +} + +func (entity *UserTypeUnknown) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserTypeUnknown + + return json.Marshal((*stub)(entity)) +} + +func (*UserTypeUnknown) GetClass() string { + return ClassUserType +} + +func (*UserTypeUnknown) GetType() string { + return TypeUserTypeUnknown +} + +func (*UserTypeUnknown) UserTypeType() string { + return TypeUserTypeUnknown +} + +// Represents a command supported by a bot +type BotCommand struct { + meta + // Text of the bot command + Command string `json:"command"` + // Description of the bot command + Description string `json:"description"` +} + +func (entity *BotCommand) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotCommand + + return json.Marshal((*stub)(entity)) +} + +func (*BotCommand) GetClass() string { + return ClassBotCommand +} + +func (*BotCommand) GetType() string { + return TypeBotCommand +} + +// Provides information about a bot and its supported commands +type BotInfo struct { + 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"` +} + +func (entity *BotInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotInfo + + return json.Marshal((*stub)(entity)) +} + +func (*BotInfo) GetClass() string { + return ClassBotInfo +} + +func (*BotInfo) GetType() string { + return TypeBotInfo +} + +// Represents a location to which a chat is connected +type ChatLocation struct { + meta + // The location + Location *Location `json:"location"` + // Location address; 1-64 characters, as defined by the chat owner + Address string `json:"address"` +} + +func (entity *ChatLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatLocation + + return json.Marshal((*stub)(entity)) +} + +func (*ChatLocation) GetClass() string { + return ClassChatLocation +} + +func (*ChatLocation) GetType() string { + return TypeChatLocation +} + +// Animated variant of a chat photo in MPEG4 format +type AnimatedChatPhoto struct { + meta + // Animation width and height + Length int32 `json:"length"` + // Information about the animation file + File *File `json:"file"` + // Timestamp of the frame, used as a static chat photo + MainFrameTimestamp float64 `json:"main_frame_timestamp"` +} + +func (entity *AnimatedChatPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AnimatedChatPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*AnimatedChatPhoto) GetClass() string { + return ClassAnimatedChatPhoto +} + +func (*AnimatedChatPhoto) GetType() string { + return TypeAnimatedChatPhoto +} + +// Describes a chat or user profile photo +type ChatPhoto struct { + meta + // Unique photo identifier + Id JsonInt64 `json:"id"` + // Point in time (Unix timestamp) when the photo has been added + AddedDate int32 `json:"added_date"` + // Photo minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Available variants of the photo in JPEG format, in different size + Sizes []*PhotoSize `json:"sizes"` + // Animated variant of the photo in MPEG4 format; may be null + Animation *AnimatedChatPhoto `json:"animation"` +} + +func (entity *ChatPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*ChatPhoto) GetClass() string { + return ClassChatPhoto +} + +func (*ChatPhoto) GetType() string { + return TypeChatPhoto +} + +// Contains a list of chat or user profile photos +type ChatPhotos struct { + meta + // Total number of photos + TotalCount int32 `json:"total_count"` + // List of photos + Photos []*ChatPhoto `json:"photos"` +} + +func (entity *ChatPhotos) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatPhotos + + return json.Marshal((*stub)(entity)) +} + +func (*ChatPhotos) GetClass() string { + return ClassChatPhotos +} + +func (*ChatPhotos) GetType() string { + return TypeChatPhotos +} + +// A previously used profile photo of the current user +type InputChatPhotoPrevious struct { + meta + // Identifier of the profile photo to reuse + ChatPhotoId JsonInt64 `json:"chat_photo_id"` +} + +func (entity *InputChatPhotoPrevious) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChatPhotoPrevious + + return json.Marshal((*stub)(entity)) +} + +func (*InputChatPhotoPrevious) GetClass() string { + return ClassInputChatPhoto +} + +func (*InputChatPhotoPrevious) GetType() string { + return TypeInputChatPhotoPrevious +} + +func (*InputChatPhotoPrevious) InputChatPhotoType() string { + return TypeInputChatPhotoPrevious +} + +// A static photo in JPEG format +type InputChatPhotoStatic struct { + meta + // Photo to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed + Photo InputFile `json:"photo"` +} + +func (entity *InputChatPhotoStatic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChatPhotoStatic + + return json.Marshal((*stub)(entity)) +} + +func (*InputChatPhotoStatic) GetClass() string { + return ClassInputChatPhoto +} + +func (*InputChatPhotoStatic) GetType() string { + return TypeInputChatPhotoStatic +} + +func (*InputChatPhotoStatic) InputChatPhotoType() string { + return TypeInputChatPhotoStatic +} + +func (inputChatPhotoStatic *InputChatPhotoStatic) UnmarshalJSON(data []byte) error { + var tmp struct { + Photo json.RawMessage `json:"photo"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldPhoto, _ := UnmarshalInputFile(tmp.Photo) + inputChatPhotoStatic.Photo = fieldPhoto + + return nil +} + +// An animation in MPEG4 format; must be square, at most 10 seconds long, have width between 160 and 800 and be at most 2MB in size +type InputChatPhotoAnimation struct { + meta + // Animation to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed + Animation InputFile `json:"animation"` + // Timestamp of the frame, which will be used as static chat photo + MainFrameTimestamp float64 `json:"main_frame_timestamp"` +} + +func (entity *InputChatPhotoAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChatPhotoAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*InputChatPhotoAnimation) GetClass() string { + return ClassInputChatPhoto +} + +func (*InputChatPhotoAnimation) GetType() string { + return TypeInputChatPhotoAnimation +} + +func (*InputChatPhotoAnimation) InputChatPhotoType() string { + return TypeInputChatPhotoAnimation +} + +func (inputChatPhotoAnimation *InputChatPhotoAnimation) UnmarshalJSON(data []byte) error { + var tmp struct { + Animation json.RawMessage `json:"animation"` + MainFrameTimestamp float64 `json:"main_frame_timestamp"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputChatPhotoAnimation.MainFrameTimestamp = tmp.MainFrameTimestamp + + fieldAnimation, _ := UnmarshalInputFile(tmp.Animation) + inputChatPhotoAnimation.Animation = fieldAnimation + + return nil +} + +// Represents a user +type User struct { + 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"` + // The user is a contact of the current user + IsContact bool `json:"is_contact"` + // The user is a contact of the current user and the current user is a contact of the user + IsMutualContact bool `json:"is_mutual_contact"` + // True, if the user is verified + IsVerified bool `json:"is_verified"` + // True, if the user is Telegram support account + IsSupport bool `json:"is_support"` + // If non-empty, it contains a human-readable description of the reason why access to this user must be restricted + RestrictionReason string `json:"restriction_reason"` + // True, if many users reported this user as a scam + IsScam bool `json:"is_scam"` + // 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"` +} + +func (entity *User) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub User + + return json.Marshal((*stub)(entity)) +} + +func (*User) GetClass() string { + return ClassUser +} + +func (*User) GetType() string { + return TypeUser +} + +func (user *User) UnmarshalJSON(data []byte) error { + 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"` + IsContact bool `json:"is_contact"` + IsMutualContact bool `json:"is_mutual_contact"` + IsVerified bool `json:"is_verified"` + IsSupport bool `json:"is_support"` + RestrictionReason string `json:"restriction_reason"` + IsScam bool `json:"is_scam"` + 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.IsContact = tmp.IsContact + user.IsMutualContact = tmp.IsMutualContact + user.IsVerified = tmp.IsVerified + user.IsSupport = tmp.IsSupport + user.RestrictionReason = tmp.RestrictionReason + user.IsScam = tmp.IsScam + user.HaveAccess = tmp.HaveAccess + user.LanguageCode = tmp.LanguageCode + + fieldStatus, _ := UnmarshalUserStatus(tmp.Status) + user.Status = fieldStatus + + fieldType, _ := UnmarshalUserType(tmp.Type) + user.Type = fieldType + + return nil +} + +// Contains full information about a user +type UserFullInfo struct { + meta + // User profile photo; may be null + Photo *ChatPhoto `json:"photo"` + // True, if the user is blocked by the current user + IsBlocked bool `json:"is_blocked"` + // True, if the user can be called + CanBeCalled bool `json:"can_be_called"` + // True, if a video call can be created with the user + SupportsVideoCalls bool `json:"supports_video_calls"` + // True, if the user can't be called due to their privacy settings + HasPrivateCalls bool `json:"has_private_calls"` + // True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used + NeedPhoneNumberPrivacyException bool `json:"need_phone_number_privacy_exception"` + // 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"` +} + +func (entity *UserFullInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserFullInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UserFullInfo) GetClass() string { + return ClassUserFullInfo +} + +func (*UserFullInfo) GetType() string { + return TypeUserFullInfo +} + +// Represents a list of users +type Users struct { + meta + // Approximate total count of users found + TotalCount int32 `json:"total_count"` + // A list of user identifiers + UserIds []int32 `json:"user_ids"` +} + +func (entity *Users) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Users + + return json.Marshal((*stub)(entity)) +} + +func (*Users) GetClass() string { + return ClassUsers +} + +func (*Users) GetType() string { + return TypeUsers +} + +// Contains information about a chat administrator +type ChatAdministrator struct { + meta + // User identifier of the administrator + UserId int32 `json:"user_id"` + // Custom title of the administrator + CustomTitle string `json:"custom_title"` + // True, if the user is the owner of the chat + IsOwner bool `json:"is_owner"` +} + +func (entity *ChatAdministrator) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatAdministrator + + return json.Marshal((*stub)(entity)) +} + +func (*ChatAdministrator) GetClass() string { + return ClassChatAdministrator +} + +func (*ChatAdministrator) GetType() string { + return TypeChatAdministrator +} + +// Represents a list of chat administrators +type ChatAdministrators struct { + meta + // A list of chat administrators + Administrators []*ChatAdministrator `json:"administrators"` +} + +func (entity *ChatAdministrators) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatAdministrators + + return json.Marshal((*stub)(entity)) +} + +func (*ChatAdministrators) GetClass() string { + return ClassChatAdministrators +} + +func (*ChatAdministrators) GetType() string { + return TypeChatAdministrators +} + +// 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, stickers, and dice 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 +} + +// The user is the owner of a chat and has all the administrator privileges +type ChatMemberStatusCreator struct { + meta + // A custom title of the owner; 0-16 characters without emojis; applicable to supergroups only + CustomTitle string `json:"custom_title"` + // True, if the creator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only + IsAnonymous bool `json:"is_anonymous"` + // True, if the user is a member of the chat + IsMember bool `json:"is_member"` +} + +func (entity *ChatMemberStatusCreator) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMemberStatusCreator + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMemberStatusCreator) GetClass() string { + return ClassChatMemberStatus +} + +func (*ChatMemberStatusCreator) GetType() string { + return TypeChatMemberStatusCreator +} + +func (*ChatMemberStatusCreator) ChatMemberStatusType() string { + return TypeChatMemberStatusCreator +} + +// 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 { + meta + // A custom title of the administrator; 0-16 characters without emojis; applicable to supergroups only + CustomTitle string `json:"custom_title"` + // 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"` + // True, if the administrator can pin messages; applicable to groups only + CanPinMessages bool `json:"can_pin_messages"` + // 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 them + CanPromoteMembers bool `json:"can_promote_members"` + // True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only + IsAnonymous bool `json:"is_anonymous"` +} + +func (entity *ChatMemberStatusAdministrator) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMemberStatusAdministrator + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMemberStatusAdministrator) GetClass() string { + return ClassChatMemberStatus +} + +func (*ChatMemberStatusAdministrator) GetType() string { + return TypeChatMemberStatusAdministrator +} + +func (*ChatMemberStatusAdministrator) ChatMemberStatusType() string { + return TypeChatMemberStatusAdministrator +} + +// The user is a member of a chat, without any additional privileges or restrictions +type ChatMemberStatusMember struct { + meta +} + +func (entity *ChatMemberStatusMember) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMemberStatusMember + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMemberStatusMember) GetClass() string { + return ClassChatMemberStatus +} + +func (*ChatMemberStatusMember) GetType() string { + return TypeChatMemberStatusMember +} + +func (*ChatMemberStatusMember) ChatMemberStatusType() string { + return TypeChatMemberStatusMember +} + +// The user is under certain restrictions in the chat. Not supported in basic groups and channels +type ChatMemberStatusRestricted struct { + 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"` + // User permissions in the chat + Permissions *ChatPermissions `json:"permissions"` +} + +func (entity *ChatMemberStatusRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMemberStatusRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMemberStatusRestricted) GetClass() string { + return ClassChatMemberStatus +} + +func (*ChatMemberStatusRestricted) GetType() string { + return TypeChatMemberStatusRestricted +} + +func (*ChatMemberStatusRestricted) ChatMemberStatusType() string { + return TypeChatMemberStatusRestricted +} + +// The user is not a chat member +type ChatMemberStatusLeft struct { + meta +} + +func (entity *ChatMemberStatusLeft) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMemberStatusLeft + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMemberStatusLeft) GetClass() string { + return ClassChatMemberStatus +} + +func (*ChatMemberStatusLeft) GetType() string { + return TypeChatMemberStatusLeft +} + +func (*ChatMemberStatusLeft) ChatMemberStatusType() string { + return TypeChatMemberStatusLeft +} + +// 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 { + 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"` +} + +func (entity *ChatMemberStatusBanned) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMemberStatusBanned + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMemberStatusBanned) GetClass() string { + return ClassChatMemberStatus +} + +func (*ChatMemberStatusBanned) GetType() string { + return TypeChatMemberStatusBanned +} + +func (*ChatMemberStatusBanned) ChatMemberStatusType() string { + return TypeChatMemberStatusBanned +} + +// A user with information about joining/leaving a chat +type ChatMember struct { + 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 the 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 the chat member + BotInfo *BotInfo `json:"bot_info"` +} + +func (entity *ChatMember) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMember + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMember) GetClass() string { + return ClassChatMember +} + +func (*ChatMember) GetType() string { + return TypeChatMember +} + +func (chatMember *ChatMember) UnmarshalJSON(data []byte) error { + 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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatMember.UserId = tmp.UserId + chatMember.InviterUserId = tmp.InviterUserId + chatMember.JoinedChatDate = tmp.JoinedChatDate + chatMember.BotInfo = tmp.BotInfo + + fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) + chatMember.Status = fieldStatus + + return nil +} + +// Contains a list of chat members +type ChatMembers struct { + meta + // Approximate total count of chat members found + TotalCount int32 `json:"total_count"` + // A list of chat members + Members []*ChatMember `json:"members"` +} + +func (entity *ChatMembers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMembers + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMembers) GetClass() string { + return ClassChatMembers +} + +func (*ChatMembers) GetType() string { + return TypeChatMembers +} + +// 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 +} + +// Returns the owner and administrators +type ChatMembersFilterAdministrators struct { + meta +} + +func (entity *ChatMembersFilterAdministrators) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMembersFilterAdministrators + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMembersFilterAdministrators) GetClass() string { + return ClassChatMembersFilter +} + +func (*ChatMembersFilterAdministrators) GetType() string { + return TypeChatMembersFilterAdministrators +} + +func (*ChatMembersFilterAdministrators) ChatMembersFilterType() string { + return TypeChatMembersFilterAdministrators +} + +// Returns all chat members, including restricted chat members +type ChatMembersFilterMembers struct { + meta +} + +func (entity *ChatMembersFilterMembers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMembersFilterMembers + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMembersFilterMembers) GetClass() string { + return ClassChatMembersFilter +} + +func (*ChatMembersFilterMembers) GetType() string { + return TypeChatMembersFilterMembers +} + +func (*ChatMembersFilterMembers) ChatMembersFilterType() string { + return TypeChatMembersFilterMembers +} + +// Returns users which can be mentioned in the chat +type ChatMembersFilterMention struct { + meta + // If non-zero, the identifier of the current message thread + MessageThreadId int64 `json:"message_thread_id"` +} + +func (entity *ChatMembersFilterMention) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMembersFilterMention + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMembersFilterMention) GetClass() string { + return ClassChatMembersFilter +} + +func (*ChatMembersFilterMention) GetType() string { + return TypeChatMembersFilterMention +} + +func (*ChatMembersFilterMention) ChatMembersFilterType() string { + return TypeChatMembersFilterMention +} + +// Returns users under certain restrictions in the chat; can be used only by administrators in a supergroup +type ChatMembersFilterRestricted struct { + meta +} + +func (entity *ChatMembersFilterRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMembersFilterRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMembersFilterRestricted) GetClass() string { + return ClassChatMembersFilter +} + +func (*ChatMembersFilterRestricted) GetType() string { + return TypeChatMembersFilterRestricted +} + +func (*ChatMembersFilterRestricted) ChatMembersFilterType() string { + return TypeChatMembersFilterRestricted +} + +// Returns users banned from the chat; can be used only by administrators in a supergroup or in a channel +type ChatMembersFilterBanned struct { + meta +} + +func (entity *ChatMembersFilterBanned) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMembersFilterBanned + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMembersFilterBanned) GetClass() string { + return ClassChatMembersFilter +} + +func (*ChatMembersFilterBanned) GetType() string { + return TypeChatMembersFilterBanned +} + +func (*ChatMembersFilterBanned) ChatMembersFilterType() string { + return TypeChatMembersFilterBanned +} + +// Returns bot members of the chat +type ChatMembersFilterBots struct { + meta +} + +func (entity *ChatMembersFilterBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatMembersFilterBots + + return json.Marshal((*stub)(entity)) +} + +func (*ChatMembersFilterBots) GetClass() string { + return ClassChatMembersFilter +} + +func (*ChatMembersFilterBots) GetType() string { + return TypeChatMembersFilterBots +} + +func (*ChatMembersFilterBots) ChatMembersFilterType() string { + return TypeChatMembersFilterBots +} + +// Returns recently active users in reverse chronological order +type SupergroupMembersFilterRecent struct { + meta +} + +func (entity *SupergroupMembersFilterRecent) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SupergroupMembersFilterRecent + + return json.Marshal((*stub)(entity)) +} + +func (*SupergroupMembersFilterRecent) GetClass() string { + return ClassSupergroupMembersFilter +} + +func (*SupergroupMembersFilterRecent) GetType() string { + return TypeSupergroupMembersFilterRecent +} + +func (*SupergroupMembersFilterRecent) SupergroupMembersFilterType() string { + return TypeSupergroupMembersFilterRecent +} + +// 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 +} + +// Returns the owner and administrators +type SupergroupMembersFilterAdministrators struct { + meta +} + +func (entity *SupergroupMembersFilterAdministrators) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SupergroupMembersFilterAdministrators + + return json.Marshal((*stub)(entity)) +} + +func (*SupergroupMembersFilterAdministrators) GetClass() string { + return ClassSupergroupMembersFilter +} + +func (*SupergroupMembersFilterAdministrators) GetType() string { + return TypeSupergroupMembersFilterAdministrators +} + +func (*SupergroupMembersFilterAdministrators) SupergroupMembersFilterType() string { + return TypeSupergroupMembersFilterAdministrators +} + +// Used to search for supergroup or channel members via a (string) query +type SupergroupMembersFilterSearch struct { + meta + // Query to search for + Query string `json:"query"` +} + +func (entity *SupergroupMembersFilterSearch) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SupergroupMembersFilterSearch + + return json.Marshal((*stub)(entity)) +} + +func (*SupergroupMembersFilterSearch) GetClass() string { + return ClassSupergroupMembersFilter +} + +func (*SupergroupMembersFilterSearch) GetType() string { + return TypeSupergroupMembersFilterSearch +} + +func (*SupergroupMembersFilterSearch) SupergroupMembersFilterType() string { + return TypeSupergroupMembersFilterSearch +} + +// Returns restricted supergroup members; can be used only by administrators +type SupergroupMembersFilterRestricted struct { + meta + // Query to search for + Query string `json:"query"` +} + +func (entity *SupergroupMembersFilterRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SupergroupMembersFilterRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*SupergroupMembersFilterRestricted) GetClass() string { + return ClassSupergroupMembersFilter +} + +func (*SupergroupMembersFilterRestricted) GetType() string { + return TypeSupergroupMembersFilterRestricted +} + +func (*SupergroupMembersFilterRestricted) SupergroupMembersFilterType() string { + return TypeSupergroupMembersFilterRestricted +} + +// Returns users banned from the supergroup or channel; can be used only by administrators +type SupergroupMembersFilterBanned struct { + meta + // Query to search for + Query string `json:"query"` +} + +func (entity *SupergroupMembersFilterBanned) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SupergroupMembersFilterBanned + + return json.Marshal((*stub)(entity)) +} + +func (*SupergroupMembersFilterBanned) GetClass() string { + return ClassSupergroupMembersFilter +} + +func (*SupergroupMembersFilterBanned) GetType() string { + return TypeSupergroupMembersFilterBanned +} + +func (*SupergroupMembersFilterBanned) SupergroupMembersFilterType() string { + return TypeSupergroupMembersFilterBanned +} + +// Returns users which can be mentioned in the supergroup +type SupergroupMembersFilterMention struct { + meta + // Query to search for + Query string `json:"query"` + // If non-zero, the identifier of the current message thread + MessageThreadId int64 `json:"message_thread_id"` +} + +func (entity *SupergroupMembersFilterMention) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SupergroupMembersFilterMention + + return json.Marshal((*stub)(entity)) +} + +func (*SupergroupMembersFilterMention) GetClass() string { + return ClassSupergroupMembersFilter +} + +func (*SupergroupMembersFilterMention) GetType() string { + return TypeSupergroupMembersFilterMention +} + +func (*SupergroupMembersFilterMention) SupergroupMembersFilterType() string { + return TypeSupergroupMembersFilterMention +} + +// Returns bot members of the supergroup or channel +type SupergroupMembersFilterBots struct { + meta +} + +func (entity *SupergroupMembersFilterBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SupergroupMembersFilterBots + + return json.Marshal((*stub)(entity)) +} + +func (*SupergroupMembersFilterBots) GetClass() string { + return ClassSupergroupMembersFilter +} + +func (*SupergroupMembersFilterBots) GetType() string { + return TypeSupergroupMembersFilterBots +} + +func (*SupergroupMembersFilterBots) SupergroupMembersFilterType() string { + return TypeSupergroupMembersFilterBots +} + +// Represents a basic group of 0-200 users (must be upgraded to a supergroup to accommodate more than 200 users) +type BasicGroup struct { + 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"` +} + +func (entity *BasicGroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BasicGroup + + return json.Marshal((*stub)(entity)) +} + +func (*BasicGroup) GetClass() string { + return ClassBasicGroup +} + +func (*BasicGroup) GetType() string { + return TypeBasicGroup +} + +func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error { + var tmp struct { + 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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + basicGroup.Id = tmp.Id + basicGroup.MemberCount = tmp.MemberCount + basicGroup.IsActive = tmp.IsActive + basicGroup.UpgradedToSupergroupId = tmp.UpgradedToSupergroupId + + fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) + basicGroup.Status = fieldStatus + + return nil +} + +// Contains full information about a basic group +type BasicGroupFullInfo struct { + meta + // Chat photo; may be null + Photo *ChatPhoto `json:"photo"` + // Group description + Description string `json:"description"` + // 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 after it has been generated at least once and only for the group creator + InviteLink string `json:"invite_link"` +} + +func (entity *BasicGroupFullInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BasicGroupFullInfo + + return json.Marshal((*stub)(entity)) +} + +func (*BasicGroupFullInfo) GetClass() string { + return ClassBasicGroupFullInfo +} + +func (*BasicGroupFullInfo) GetType() string { + return TypeBasicGroupFullInfo +} + +// 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 { + 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; custom title will be always empty + Status ChatMemberStatus `json:"status"` + // Number of members in the supergroup or channel; 0 if unknown. Currently it is guaranteed to be known only if the supergroup or channel was received through searchPublicChats, searchChatsNearby, getInactiveSupergroupChats, getSuitableDiscussionChats, getGroupsInCommon, or getUserPrivacySettingRules + MemberCount int32 `json:"member_count"` + // True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel + HasLinkedChat bool `json:"has_linked_chat"` + // True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup + HasLocation bool `json:"has_location"` + // 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 slow mode is enabled in the supergroup + IsSlowModeEnabled bool `json:"is_slow_mode_enabled"` + // 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 a human-readable description of the reason why access to this supergroup or channel must be restricted + RestrictionReason string `json:"restriction_reason"` + // True, if many users reported this supergroup as a scam + IsScam bool `json:"is_scam"` +} + +func (entity *Supergroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Supergroup + + return json.Marshal((*stub)(entity)) +} + +func (*Supergroup) GetClass() string { + return ClassSupergroup +} + +func (*Supergroup) GetType() string { + return TypeSupergroup +} + +func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { + 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"` + HasLinkedChat bool `json:"has_linked_chat"` + HasLocation bool `json:"has_location"` + SignMessages bool `json:"sign_messages"` + IsSlowModeEnabled bool `json:"is_slow_mode_enabled"` + IsChannel bool `json:"is_channel"` + IsVerified bool `json:"is_verified"` + RestrictionReason string `json:"restriction_reason"` + IsScam bool `json:"is_scam"` + } + + 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.HasLinkedChat = tmp.HasLinkedChat + supergroup.HasLocation = tmp.HasLocation + supergroup.SignMessages = tmp.SignMessages + supergroup.IsSlowModeEnabled = tmp.IsSlowModeEnabled + supergroup.IsChannel = tmp.IsChannel + supergroup.IsVerified = tmp.IsVerified + supergroup.RestrictionReason = tmp.RestrictionReason + supergroup.IsScam = tmp.IsScam + + fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) + supergroup.Status = fieldStatus + + return nil +} + +// Contains full information about a supergroup or channel +type SupergroupFullInfo struct { + meta + // Chat photo; may be null + Photo *ChatPhoto `json:"photo"` + // 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"` + // Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown + LinkedChatId int64 `json:"linked_chat_id"` + // Delay between consecutive sent messages for non-administrator supergroup members, in seconds + SlowModeDelay int32 `json:"slow_mode_delay"` + // Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero + SlowModeDelayExpiresIn float64 `json:"slow_mode_delay_expires_in"` + // True, if members of the chat can be retrieved + CanGetMembers bool `json:"can_get_members"` + // True, if the chat username can be changed + CanSetUsername bool `json:"can_set_username"` + // True, if the supergroup sticker set can be changed + CanSetStickerSet bool `json:"can_set_sticker_set"` + // True, if the supergroup location can be changed + CanSetLocation bool `json:"can_set_location"` + // True, if the supergroup or channel statistics are available + CanGetStatistics bool `json:"can_get_statistics"` + // True, if new chat members will have access to old messages. In public or discussion groups and both public and private channels, old messages are always available, so this option affects only private supergroups without a linked chat. 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"` + // Location to which the supergroup is connected; may be null + Location *ChatLocation `json:"location"` + // 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"` +} + +func (entity *SupergroupFullInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SupergroupFullInfo + + return json.Marshal((*stub)(entity)) +} + +func (*SupergroupFullInfo) GetClass() string { + return ClassSupergroupFullInfo +} + +func (*SupergroupFullInfo) GetType() string { + return TypeSupergroupFullInfo +} + +// The secret chat is not yet created; waiting for the other user to get online +type SecretChatStatePending struct { + meta +} + +func (entity *SecretChatStatePending) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SecretChatStatePending + + return json.Marshal((*stub)(entity)) +} + +func (*SecretChatStatePending) GetClass() string { + return ClassSecretChatState +} + +func (*SecretChatStatePending) GetType() string { + return TypeSecretChatStatePending +} + +func (*SecretChatStatePending) SecretChatStateType() string { + return TypeSecretChatStatePending +} + +// The secret chat is ready to use +type SecretChatStateReady struct { + meta +} + +func (entity *SecretChatStateReady) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SecretChatStateReady + + return json.Marshal((*stub)(entity)) +} + +func (*SecretChatStateReady) GetClass() string { + return ClassSecretChatState +} + +func (*SecretChatStateReady) GetType() string { + return TypeSecretChatStateReady +} + +func (*SecretChatStateReady) SecretChatStateType() string { + return TypeSecretChatStateReady +} + +// The secret chat is closed +type SecretChatStateClosed struct { + meta +} + +func (entity *SecretChatStateClosed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SecretChatStateClosed + + return json.Marshal((*stub)(entity)) +} + +func (*SecretChatStateClosed) GetClass() string { + return ClassSecretChatState +} + +func (*SecretChatStateClosed) GetType() string { + return TypeSecretChatStateClosed +} + +func (*SecretChatStateClosed) SecretChatStateType() string { + return TypeSecretChatStateClosed +} + +// Represents a secret chat +type SecretChat struct { + 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 little-endian bytes, which must be split into groups of 2 bits, each denoting a pixel of one of 4 colors FFFFFF, D5E6F3, 2D5775, and 2F99C9. The pixels must be used to make a 12x12 square image filled from left to right, top to bottom. 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 chat partner's application. Video notes are supported if the layer >= 66; nested text entities and underline and strikethrough entities are supported if the layer >= 101 + Layer int32 `json:"layer"` +} + +func (entity *SecretChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SecretChat + + return json.Marshal((*stub)(entity)) +} + +func (*SecretChat) GetClass() string { + return ClassSecretChat +} + +func (*SecretChat) GetType() string { + return TypeSecretChat +} + +func (secretChat *SecretChat) UnmarshalJSON(data []byte) error { + 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 +} + +// The message was sent by a known user +type MessageSenderUser struct { + meta + // Identifier of the user that sent the message + UserId int32 `json:"user_id"` +} + +func (entity *MessageSenderUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSenderUser + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSenderUser) GetClass() string { + return ClassMessageSender +} + +func (*MessageSenderUser) GetType() string { + return TypeMessageSenderUser +} + +func (*MessageSenderUser) MessageSenderType() string { + return TypeMessageSenderUser +} + +// The message was sent on behalf of a chat +type MessageSenderChat struct { + meta + // Identifier of the chat that sent the message + ChatId int64 `json:"chat_id"` +} + +func (entity *MessageSenderChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSenderChat + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSenderChat) GetClass() string { + return ClassMessageSender +} + +func (*MessageSenderChat) GetType() string { + return TypeMessageSenderChat +} + +func (*MessageSenderChat) MessageSenderType() string { + return TypeMessageSenderChat +} + +// Represents a list of message senders +type MessageSenders struct { + meta + // Approximate total count of messages senders found + TotalCount int32 `json:"total_count"` + // List of message senders + Senders []MessageSender `json:"senders"` +} + +func (entity *MessageSenders) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSenders + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSenders) GetClass() string { + return ClassMessageSenders +} + +func (*MessageSenders) GetType() string { + return TypeMessageSenders +} + +func (messageSenders *MessageSenders) UnmarshalJSON(data []byte) error { + var tmp struct { + TotalCount int32 `json:"total_count"` + Senders []json.RawMessage `json:"senders"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSenders.TotalCount = tmp.TotalCount + + fieldSenders, _ := UnmarshalListOfMessageSender(tmp.Senders) + messageSenders.Senders = fieldSenders + + return nil +} + +// The message was originally sent by a known user +type MessageForwardOriginUser struct { + meta + // Identifier of the user that originally sent the message + SenderUserId int32 `json:"sender_user_id"` +} + +func (entity *MessageForwardOriginUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageForwardOriginUser + + return json.Marshal((*stub)(entity)) +} + +func (*MessageForwardOriginUser) GetClass() string { + return ClassMessageForwardOrigin +} + +func (*MessageForwardOriginUser) GetType() string { + return TypeMessageForwardOriginUser +} + +func (*MessageForwardOriginUser) MessageForwardOriginType() string { + return TypeMessageForwardOriginUser +} + +// The message was originally sent by an anonymous chat administrator on behalf of the chat +type MessageForwardOriginChat struct { + meta + // Identifier of the chat that originally sent the message + SenderChatId int64 `json:"sender_chat_id"` + // Original message author signature + AuthorSignature string `json:"author_signature"` +} + +func (entity *MessageForwardOriginChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageForwardOriginChat + + return json.Marshal((*stub)(entity)) +} + +func (*MessageForwardOriginChat) GetClass() string { + return ClassMessageForwardOrigin +} + +func (*MessageForwardOriginChat) GetType() string { + return TypeMessageForwardOriginChat +} + +func (*MessageForwardOriginChat) MessageForwardOriginType() string { + return TypeMessageForwardOriginChat +} + +// The message was originally sent by a user, which is hidden by their privacy settings +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 +} + +func (*MessageForwardOriginHiddenUser) GetType() string { + return TypeMessageForwardOriginHiddenUser +} + +func (*MessageForwardOriginHiddenUser) MessageForwardOriginType() string { + return TypeMessageForwardOriginHiddenUser +} + +// The message was originally a post in a channel +type MessageForwardOriginChannel struct { + meta + // Identifier of the chat from which the message was originally forwarded + ChatId int64 `json:"chat_id"` + // Message identifier of the original message + MessageId int64 `json:"message_id"` + // Original post author signature + AuthorSignature string `json:"author_signature"` +} + +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"` + // Point in time (Unix timestamp) when the message was originally sent + Date int32 `json:"date"` + // The type of a public service announcement for the forwarded message + PublicServiceAnnouncementType string `json:"public_service_announcement_type"` + // For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the chat from which the message was forwarded last time; 0 if unknown + FromChatId int64 `json:"from_chat_id"` + // For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the original message from which the new message was forwarded last time; 0 if unknown + FromMessageId int64 `json:"from_message_id"` +} + +func (entity *MessageForwardInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageForwardInfo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageForwardInfo) GetClass() string { + return ClassMessageForwardInfo +} + +func (*MessageForwardInfo) GetType() string { + return TypeMessageForwardInfo +} + +func (messageForwardInfo *MessageForwardInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Origin json.RawMessage `json:"origin"` + Date int32 `json:"date"` + PublicServiceAnnouncementType string `json:"public_service_announcement_type"` + 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.PublicServiceAnnouncementType = tmp.PublicServiceAnnouncementType + messageForwardInfo.FromChatId = tmp.FromChatId + messageForwardInfo.FromMessageId = tmp.FromMessageId + + fieldOrigin, _ := UnmarshalMessageForwardOrigin(tmp.Origin) + messageForwardInfo.Origin = fieldOrigin + + return nil +} + +// Contains information about replies to a message +type MessageReplyInfo struct { + meta + // Number of times the message was directly or indirectly replied + ReplyCount int32 `json:"reply_count"` + // Recent repliers to the message; available in channels with a discussion supergroup + RecentRepliers []MessageSender `json:"recent_repliers"` + // Identifier of the last read incoming reply to the message + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` + // Identifier of the last read outgoing reply to the message + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + // Identifier of the last reply to the message + LastMessageId int64 `json:"last_message_id"` +} + +func (entity *MessageReplyInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReplyInfo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReplyInfo) GetClass() string { + return ClassMessageReplyInfo +} + +func (*MessageReplyInfo) GetType() string { + return TypeMessageReplyInfo +} + +func (messageReplyInfo *MessageReplyInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + ReplyCount int32 `json:"reply_count"` + RecentRepliers []json.RawMessage `json:"recent_repliers"` + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + LastMessageId int64 `json:"last_message_id"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageReplyInfo.ReplyCount = tmp.ReplyCount + messageReplyInfo.LastReadInboxMessageId = tmp.LastReadInboxMessageId + messageReplyInfo.LastReadOutboxMessageId = tmp.LastReadOutboxMessageId + messageReplyInfo.LastMessageId = tmp.LastMessageId + + fieldRecentRepliers, _ := UnmarshalListOfMessageSender(tmp.RecentRepliers) + messageReplyInfo.RecentRepliers = fieldRecentRepliers + + return nil +} + +// Contains information about interactions with a message +type MessageInteractionInfo struct { + meta + // Number of times the message was viewed + ViewCount int32 `json:"view_count"` + // Number of times the message was forwarded + ForwardCount int32 `json:"forward_count"` + // Contains information about direct or indirect replies to the message; may be null. Currently, available only in channels with a discussion supergroup and discussion supergroups for messages, which are not replies itself + ReplyInfo *MessageReplyInfo `json:"reply_info"` +} + +func (entity *MessageInteractionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageInteractionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageInteractionInfo) GetClass() string { + return ClassMessageInteractionInfo +} + +func (*MessageInteractionInfo) GetType() string { + return TypeMessageInteractionInfo +} + +// The message is being sent now, but has not yet been delivered to the server +type MessageSendingStatePending struct { + meta +} + +func (entity *MessageSendingStatePending) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSendingStatePending + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSendingStatePending) GetClass() string { + return ClassMessageSendingState +} + +func (*MessageSendingStatePending) GetType() string { + return TypeMessageSendingStatePending +} + +func (*MessageSendingStatePending) MessageSendingStateType() string { + return TypeMessageSendingStatePending +} + +// The message failed to be sent +type MessageSendingStateFailed struct { + meta + // 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"` +} + +func (entity *MessageSendingStateFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSendingStateFailed + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSendingStateFailed) GetClass() string { + return ClassMessageSendingState +} + +func (*MessageSendingStateFailed) GetType() string { + return TypeMessageSendingStateFailed +} + +func (*MessageSendingStateFailed) MessageSendingStateType() string { + return TypeMessageSendingStateFailed +} + +// Describes a message +type Message struct { + meta + // Message identifier; unique for the chat to which the message belongs + Id int64 `json:"id"` + // The sender of the message + Sender MessageSender `json:"sender"` + // Chat identifier + ChatId int64 `json:"chat_id"` + // Information about the sending state of the message; may be null + SendingState MessageSendingState `json:"sending_state"` + // Information about the scheduling state of the message; may be null + SchedulingState MessageSchedulingState `json:"scheduling_state"` + // True, if the message is outgoing + IsOutgoing bool `json:"is_outgoing"` + // True, if the message is pinned + IsPinned bool `json:"is_pinned"` + // 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 application + 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 statistics are available + CanGetStatistics bool `json:"can_get_statistics"` + // True, if the message thread info is available + CanGetMessageThread bool `json:"can_get_message_thread"` + // 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 + ForwardInfo *MessageForwardInfo `json:"forward_info"` + // Information about interactions with the message; may be null + InteractionInfo *MessageInteractionInfo `json:"interaction_info"` + // If non-zero, the identifier of the chat to which the replied message belongs; Currently, only messages in the Replies chat can have different reply_in_chat_id and chat_id + ReplyInChatId int64 `json:"reply_in_chat_id"` + // 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"` + // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs + MessageThreadId int64 `json:"message_thread_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 and anonymous group messages, optional author signature + AuthorSignature string `json:"author_signature"` + // 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"` + // If non-empty, contains a human-readable description of the reason why access to this message must be restricted + RestrictionReason string `json:"restriction_reason"` + // Content of the message + Content MessageContent `json:"content"` + // Reply markup for the message; may be null + ReplyMarkup ReplyMarkup `json:"reply_markup"` +} + +func (entity *Message) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Message + + return json.Marshal((*stub)(entity)) +} + +func (*Message) GetClass() string { + return ClassMessage +} + +func (*Message) GetType() string { + return TypeMessage +} + +func (message *Message) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int64 `json:"id"` + Sender json.RawMessage `json:"sender"` + ChatId int64 `json:"chat_id"` + SendingState json.RawMessage `json:"sending_state"` + SchedulingState json.RawMessage `json:"scheduling_state"` + IsOutgoing bool `json:"is_outgoing"` + IsPinned bool `json:"is_pinned"` + 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"` + CanGetStatistics bool `json:"can_get_statistics"` + CanGetMessageThread bool `json:"can_get_message_thread"` + 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"` + InteractionInfo *MessageInteractionInfo `json:"interaction_info"` + ReplyInChatId int64 `json:"reply_in_chat_id"` + ReplyToMessageId int64 `json:"reply_to_message_id"` + MessageThreadId int64 `json:"message_thread_id"` + Ttl int32 `json:"ttl"` + TtlExpiresIn float64 `json:"ttl_expires_in"` + ViaBotUserId int32 `json:"via_bot_user_id"` + AuthorSignature string `json:"author_signature"` + MediaAlbumId JsonInt64 `json:"media_album_id"` + RestrictionReason string `json:"restriction_reason"` + Content json.RawMessage `json:"content"` + ReplyMarkup json.RawMessage `json:"reply_markup"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + message.Id = tmp.Id + message.ChatId = tmp.ChatId + message.IsOutgoing = tmp.IsOutgoing + message.IsPinned = tmp.IsPinned + message.CanBeEdited = tmp.CanBeEdited + message.CanBeForwarded = tmp.CanBeForwarded + message.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf + message.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers + message.CanGetStatistics = tmp.CanGetStatistics + message.CanGetMessageThread = tmp.CanGetMessageThread + message.IsChannelPost = tmp.IsChannelPost + message.ContainsUnreadMention = tmp.ContainsUnreadMention + message.Date = tmp.Date + message.EditDate = tmp.EditDate + message.ForwardInfo = tmp.ForwardInfo + message.InteractionInfo = tmp.InteractionInfo + message.ReplyInChatId = tmp.ReplyInChatId + message.ReplyToMessageId = tmp.ReplyToMessageId + message.MessageThreadId = tmp.MessageThreadId + message.Ttl = tmp.Ttl + message.TtlExpiresIn = tmp.TtlExpiresIn + message.ViaBotUserId = tmp.ViaBotUserId + message.AuthorSignature = tmp.AuthorSignature + message.MediaAlbumId = tmp.MediaAlbumId + message.RestrictionReason = tmp.RestrictionReason + + fieldSender, _ := UnmarshalMessageSender(tmp.Sender) + message.Sender = fieldSender + + fieldSendingState, _ := UnmarshalMessageSendingState(tmp.SendingState) + message.SendingState = fieldSendingState + + fieldSchedulingState, _ := UnmarshalMessageSchedulingState(tmp.SchedulingState) + message.SchedulingState = fieldSchedulingState + + fieldContent, _ := UnmarshalMessageContent(tmp.Content) + message.Content = fieldContent + + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + message.ReplyMarkup = fieldReplyMarkup + + return nil +} + +// Contains a list of messages +type Messages struct { + meta + // Approximate total count of messages found + TotalCount int32 `json:"total_count"` + // List of messages; messages may be null + Messages []*Message `json:"messages"` +} + +func (entity *Messages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Messages + + return json.Marshal((*stub)(entity)) +} + +func (*Messages) GetClass() string { + return ClassMessages +} + +func (*Messages) GetType() string { + return TypeMessages +} + +// Contains a list of messages found by a search +type FoundMessages struct { + meta + // Approximate total count of messages found; -1 if unknown + TotalCount int32 `json:"total_count"` + // List of messages + Messages []*Message `json:"messages"` + // The offset for the next request. If empty, there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *FoundMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundMessages + + return json.Marshal((*stub)(entity)) +} + +func (*FoundMessages) GetClass() string { + return ClassFoundMessages +} + +func (*FoundMessages) GetType() string { + return TypeFoundMessages +} + +// Notification settings applied to all private and secret chats when the corresponding chat setting has a default value +type NotificationSettingsScopePrivateChats struct { + meta +} + +func (entity *NotificationSettingsScopePrivateChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationSettingsScopePrivateChats + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationSettingsScopePrivateChats) GetClass() string { + return ClassNotificationSettingsScope +} + +func (*NotificationSettingsScopePrivateChats) GetType() string { + return TypeNotificationSettingsScopePrivateChats +} + +func (*NotificationSettingsScopePrivateChats) NotificationSettingsScopeType() string { + return TypeNotificationSettingsScopePrivateChats +} + +// Notification settings applied to all basic groups and supergroups when the corresponding chat setting has a default value +type NotificationSettingsScopeGroupChats struct { + meta +} + +func (entity *NotificationSettingsScopeGroupChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationSettingsScopeGroupChats + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationSettingsScopeGroupChats) GetClass() string { + return ClassNotificationSettingsScope +} + +func (*NotificationSettingsScopeGroupChats) GetType() string { + return TypeNotificationSettingsScopeGroupChats +} + +func (*NotificationSettingsScopeGroupChats) NotificationSettingsScopeType() string { + return TypeNotificationSettingsScopeGroupChats +} + +// 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 +} + +// Contains information about notification settings for a chat +type ChatNotificationSettings struct { + 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"` + // 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"` +} + +func (entity *ChatNotificationSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatNotificationSettings + + return json.Marshal((*stub)(entity)) +} + +func (*ChatNotificationSettings) GetClass() string { + return ClassChatNotificationSettings +} + +func (*ChatNotificationSettings) GetType() string { + return TypeChatNotificationSettings +} + +// Contains information about notification settings for several chats +type ScopeNotificationSettings struct { + 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"` + // 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"` +} + +func (entity *ScopeNotificationSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ScopeNotificationSettings + + return json.Marshal((*stub)(entity)) +} + +func (*ScopeNotificationSettings) GetClass() string { + return ClassScopeNotificationSettings +} + +func (*ScopeNotificationSettings) GetType() string { + return TypeScopeNotificationSettings +} + +// Contains information about a message draft +type DraftMessage struct { + meta + // Identifier of the message to reply to; 0 if none + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Point in time (Unix timestamp) when the draft was created + Date int32 `json:"date"` + // Content of the message draft; this should always be of type inputMessageText + InputMessageText InputMessageContent `json:"input_message_text"` +} + +func (entity *DraftMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DraftMessage + + return json.Marshal((*stub)(entity)) +} + +func (*DraftMessage) GetClass() string { + return ClassDraftMessage +} + +func (*DraftMessage) GetType() string { + return TypeDraftMessage +} + +func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { + var tmp struct { + ReplyToMessageId int64 `json:"reply_to_message_id"` + Date int32 `json:"date"` + InputMessageText json.RawMessage `json:"input_message_text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + draftMessage.ReplyToMessageId = tmp.ReplyToMessageId + draftMessage.Date = tmp.Date + + fieldInputMessageText, _ := UnmarshalInputMessageContent(tmp.InputMessageText) + draftMessage.InputMessageText = fieldInputMessageText + + return nil +} + +// An ordinary chat with a user +type ChatTypePrivate struct { + meta + // User identifier + UserId int32 `json:"user_id"` +} + +func (entity *ChatTypePrivate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatTypePrivate + + return json.Marshal((*stub)(entity)) +} + +func (*ChatTypePrivate) GetClass() string { + return ClassChatType +} + +func (*ChatTypePrivate) GetType() string { + return TypeChatTypePrivate +} + +func (*ChatTypePrivate) ChatTypeType() string { + return TypeChatTypePrivate +} + +// A basic group (i.e., a chat with 0-200 other users) +type ChatTypeBasicGroup struct { + meta + // Basic group identifier + BasicGroupId int32 `json:"basic_group_id"` +} + +func (entity *ChatTypeBasicGroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatTypeBasicGroup + + return json.Marshal((*stub)(entity)) +} + +func (*ChatTypeBasicGroup) GetClass() string { + return ClassChatType +} + +func (*ChatTypeBasicGroup) GetType() string { + return TypeChatTypeBasicGroup +} + +func (*ChatTypeBasicGroup) ChatTypeType() string { + return TypeChatTypeBasicGroup +} + +// A supergroup (i.e. a chat with up to GetOption("supergroup_max_size") other users), or channel (with unlimited members) +type ChatTypeSupergroup struct { + meta + // Supergroup or channel identifier + SupergroupId int32 `json:"supergroup_id"` + // True, if the supergroup is a channel + IsChannel bool `json:"is_channel"` +} + +func (entity *ChatTypeSupergroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatTypeSupergroup + + return json.Marshal((*stub)(entity)) +} + +func (*ChatTypeSupergroup) GetClass() string { + return ClassChatType +} + +func (*ChatTypeSupergroup) GetType() string { + return TypeChatTypeSupergroup +} + +func (*ChatTypeSupergroup) ChatTypeType() string { + return TypeChatTypeSupergroup +} + +// A secret chat with a user +type ChatTypeSecret struct { + meta + // Secret chat identifier + SecretChatId int32 `json:"secret_chat_id"` + // User identifier of the secret chat peer + UserId int32 `json:"user_id"` +} + +func (entity *ChatTypeSecret) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatTypeSecret + + return json.Marshal((*stub)(entity)) +} + +func (*ChatTypeSecret) GetClass() string { + return ClassChatType +} + +func (*ChatTypeSecret) GetType() string { + return TypeChatTypeSecret +} + +func (*ChatTypeSecret) ChatTypeType() string { + return TypeChatTypeSecret +} + +// Represents a filter of user chats +type ChatFilter struct { + meta + // The title of the filter; 1-12 characters without line feeds + Title string `json:"title"` + // The icon name for short filter representation. If non-empty, must be one of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work". If empty, use getChatFilterDefaultIconName to get default icon name for the filter + IconName string `json:"icon_name"` + // The chat identifiers of pinned chats in the filtered chat list + PinnedChatIds []int64 `json:"pinned_chat_ids"` + // The chat identifiers of always included chats in the filtered chat list + IncludedChatIds []int64 `json:"included_chat_ids"` + // The chat identifiers of always excluded chats in the filtered chat list + ExcludedChatIds []int64 `json:"excluded_chat_ids"` + // True, if muted chats need to be excluded + ExcludeMuted bool `json:"exclude_muted"` + // True, if read chats need to be excluded + ExcludeRead bool `json:"exclude_read"` + // True, if archived chats need to be excluded + ExcludeArchived bool `json:"exclude_archived"` + // True, if contacts need to be included + IncludeContacts bool `json:"include_contacts"` + // True, if non-contact users need to be included + IncludeNonContacts bool `json:"include_non_contacts"` + // True, if bots need to be included + IncludeBots bool `json:"include_bots"` + // True, if basic groups and supergroups need to be included + IncludeGroups bool `json:"include_groups"` + // True, if channels need to be included + IncludeChannels bool `json:"include_channels"` +} + +func (entity *ChatFilter) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatFilter + + return json.Marshal((*stub)(entity)) +} + +func (*ChatFilter) GetClass() string { + return ClassChatFilter +} + +func (*ChatFilter) GetType() string { + return TypeChatFilter +} + +// Contains basic information about a chat filter +type ChatFilterInfo struct { + meta + // Unique chat filter identifier + Id int32 `json:"id"` + // The title of the filter; 1-12 characters without line feeds + Title string `json:"title"` + // The icon name for short filter representation. One of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work" + IconName string `json:"icon_name"` +} + +func (entity *ChatFilterInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatFilterInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ChatFilterInfo) GetClass() string { + return ClassChatFilterInfo +} + +func (*ChatFilterInfo) GetType() string { + return TypeChatFilterInfo +} + +// Describes a recommended chat filter +type RecommendedChatFilter struct { + meta + // The chat filter + Filter *ChatFilter `json:"filter"` + // Chat filter description + Description string `json:"description"` +} + +func (entity *RecommendedChatFilter) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RecommendedChatFilter + + return json.Marshal((*stub)(entity)) +} + +func (*RecommendedChatFilter) GetClass() string { + return ClassRecommendedChatFilter +} + +func (*RecommendedChatFilter) GetType() string { + return TypeRecommendedChatFilter +} + +// Contains a list of recommended chat filters +type RecommendedChatFilters struct { + meta + // List of recommended chat filters + ChatFilters []*RecommendedChatFilter `json:"chat_filters"` +} + +func (entity *RecommendedChatFilters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RecommendedChatFilters + + return json.Marshal((*stub)(entity)) +} + +func (*RecommendedChatFilters) GetClass() string { + return ClassRecommendedChatFilters +} + +func (*RecommendedChatFilters) GetType() string { + return TypeRecommendedChatFilters +} + +// A main list of chats +type ChatListMain struct { + meta +} + +func (entity *ChatListMain) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatListMain + + return json.Marshal((*stub)(entity)) +} + +func (*ChatListMain) GetClass() string { + return ClassChatList +} + +func (*ChatListMain) GetType() string { + return TypeChatListMain +} + +func (*ChatListMain) ChatListType() string { + return TypeChatListMain +} + +// A list of chats usually located at the top of the main chat list. Unmuted chats are automatically moved from the Archive to the Main chat list when a new message arrives +type ChatListArchive struct { + meta +} + +func (entity *ChatListArchive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatListArchive + + return json.Marshal((*stub)(entity)) +} + +func (*ChatListArchive) GetClass() string { + return ClassChatList +} + +func (*ChatListArchive) GetType() string { + return TypeChatListArchive +} + +func (*ChatListArchive) ChatListType() string { + return TypeChatListArchive +} + +// A list of chats belonging to a chat filter +type ChatListFilter struct { + meta + // Chat filter identifier + ChatFilterId int32 `json:"chat_filter_id"` +} + +func (entity *ChatListFilter) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatListFilter + + return json.Marshal((*stub)(entity)) +} + +func (*ChatListFilter) GetClass() string { + return ClassChatList +} + +func (*ChatListFilter) GetType() string { + return TypeChatListFilter +} + +func (*ChatListFilter) ChatListType() string { + return TypeChatListFilter +} + +// Contains a list of chat lists +type ChatLists struct { + meta + // List of chat lists + ChatLists []ChatList `json:"chat_lists"` +} + +func (entity *ChatLists) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatLists + + return json.Marshal((*stub)(entity)) +} + +func (*ChatLists) GetClass() string { + return ClassChatLists +} + +func (*ChatLists) GetType() string { + return TypeChatLists +} + +func (chatLists *ChatLists) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatLists []json.RawMessage `json:"chat_lists"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldChatLists, _ := UnmarshalListOfChatList(tmp.ChatLists) + chatLists.ChatLists = fieldChatLists + + return nil +} + +// The chat is sponsored by the user's MTProxy server +type ChatSourceMtprotoProxy struct { + meta +} + +func (entity *ChatSourceMtprotoProxy) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatSourceMtprotoProxy + + return json.Marshal((*stub)(entity)) +} + +func (*ChatSourceMtprotoProxy) GetClass() string { + return ClassChatSource +} + +func (*ChatSourceMtprotoProxy) GetType() string { + return TypeChatSourceMtprotoProxy +} + +func (*ChatSourceMtprotoProxy) ChatSourceType() string { + return TypeChatSourceMtprotoProxy +} + +// The chat contains a public service announcement +type ChatSourcePublicServiceAnnouncement struct { + meta + // The type of the announcement + Type string `json:"type"` + // The text of the announcement + Text string `json:"text"` +} + +func (entity *ChatSourcePublicServiceAnnouncement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatSourcePublicServiceAnnouncement + + return json.Marshal((*stub)(entity)) +} + +func (*ChatSourcePublicServiceAnnouncement) GetClass() string { + return ClassChatSource +} + +func (*ChatSourcePublicServiceAnnouncement) GetType() string { + return TypeChatSourcePublicServiceAnnouncement +} + +func (*ChatSourcePublicServiceAnnouncement) ChatSourceType() string { + return TypeChatSourcePublicServiceAnnouncement +} + +// Describes a position of a chat in a chat list +type ChatPosition struct { + meta + // The chat list + List ChatList `json:"list"` + // A parameter used to determine order of the chat in the chat list. Chats must be sorted by the pair (order, chat.id) in descending order + Order JsonInt64 `json:"order"` + // True, if the chat is pinned in the chat list + IsPinned bool `json:"is_pinned"` + // Source of the chat in the chat list; may be null + Source ChatSource `json:"source"` +} + +func (entity *ChatPosition) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatPosition + + return json.Marshal((*stub)(entity)) +} + +func (*ChatPosition) GetClass() string { + return ClassChatPosition +} + +func (*ChatPosition) GetType() string { + return TypeChatPosition +} + +func (chatPosition *ChatPosition) UnmarshalJSON(data []byte) error { + var tmp struct { + List json.RawMessage `json:"list"` + Order JsonInt64 `json:"order"` + IsPinned bool `json:"is_pinned"` + Source json.RawMessage `json:"source"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatPosition.Order = tmp.Order + chatPosition.IsPinned = tmp.IsPinned + + fieldList, _ := UnmarshalChatList(tmp.List) + chatPosition.List = fieldList + + fieldSource, _ := UnmarshalChatSource(tmp.Source) + chatPosition.Source = fieldSource + + return nil +} + +// A chat. (Can be a private chat, basic group, supergroup, or secret chat) +type Chat struct { + 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 *ChatPhotoInfo `json:"photo"` + // Actions that non-administrator chat members are allowed to take in the chat + Permissions *ChatPermissions `json:"permissions"` + // Last message in the chat; may be null + LastMessage *Message `json:"last_message"` + // Positions of the chat in chat lists + Positions []*ChatPosition `json:"positions"` + // True, if the chat is marked as unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + // True, if the chat is blocked by the current user and private messages from the chat can't be received + IsBlocked bool `json:"is_blocked"` + // True, if the chat has scheduled messages + HasScheduledMessages bool `json:"has_scheduled_messages"` + // 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"` + // 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"` + // Describes actions which should be possible to do through a chat action bar; may be null + ActionBar ChatActionBar `json:"action_bar"` + // 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 application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used + ClientData string `json:"client_data"` +} + +func (entity *Chat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Chat + + return json.Marshal((*stub)(entity)) +} + +func (*Chat) GetClass() string { + return ClassChat +} + +func (*Chat) GetType() string { + return TypeChat +} + +func (chat *Chat) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int64 `json:"id"` + Type json.RawMessage `json:"type"` + Title string `json:"title"` + Photo *ChatPhotoInfo `json:"photo"` + Permissions *ChatPermissions `json:"permissions"` + LastMessage *Message `json:"last_message"` + Positions []*ChatPosition `json:"positions"` + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + IsBlocked bool `json:"is_blocked"` + HasScheduledMessages bool `json:"has_scheduled_messages"` + CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` + CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` + 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"` + ActionBar json.RawMessage `json:"action_bar"` + 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 + chat.Permissions = tmp.Permissions + chat.LastMessage = tmp.LastMessage + chat.Positions = tmp.Positions + chat.IsMarkedAsUnread = tmp.IsMarkedAsUnread + chat.IsBlocked = tmp.IsBlocked + chat.HasScheduledMessages = tmp.HasScheduledMessages + chat.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf + chat.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers + 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 + chat.ReplyMarkupMessageId = tmp.ReplyMarkupMessageId + chat.DraftMessage = tmp.DraftMessage + chat.ClientData = tmp.ClientData + + fieldType, _ := UnmarshalChatType(tmp.Type) + chat.Type = fieldType + + fieldActionBar, _ := UnmarshalChatActionBar(tmp.ActionBar) + chat.ActionBar = fieldActionBar + + return nil +} + +// Represents a list of chats +type Chats struct { + meta + // Approximate total count of chats found + TotalCount int32 `json:"total_count"` + // List of chat identifiers + ChatIds []int64 `json:"chat_ids"` +} + +func (entity *Chats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Chats + + return json.Marshal((*stub)(entity)) +} + +func (*Chats) GetClass() string { + return ClassChats +} + +func (*Chats) GetType() string { + return TypeChats +} + +// Describes a chat located nearby +type ChatNearby struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Distance to the chat location, in meters + Distance int32 `json:"distance"` +} + +func (entity *ChatNearby) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatNearby + + return json.Marshal((*stub)(entity)) +} + +func (*ChatNearby) GetClass() string { + return ClassChatNearby +} + +func (*ChatNearby) GetType() string { + return TypeChatNearby +} + +// Represents a list of chats located nearby +type ChatsNearby struct { + meta + // List of users nearby + UsersNearby []*ChatNearby `json:"users_nearby"` + // List of location-based supergroups nearby + SupergroupsNearby []*ChatNearby `json:"supergroups_nearby"` +} + +func (entity *ChatsNearby) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatsNearby + + return json.Marshal((*stub)(entity)) +} + +func (*ChatsNearby) GetClass() string { + return ClassChatsNearby +} + +func (*ChatsNearby) GetType() string { + return TypeChatsNearby +} + +// Contains a chat invite link +type ChatInviteLink struct { + meta + // Chat invite link + InviteLink string `json:"invite_link"` +} + +func (entity *ChatInviteLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatInviteLink + + return json.Marshal((*stub)(entity)) +} + +func (*ChatInviteLink) GetClass() string { + return ClassChatInviteLink +} + +func (*ChatInviteLink) GetType() string { + return TypeChatInviteLink +} + +// Contains information about a chat invite link +type ChatInviteLinkInfo struct { + meta + // Chat identifier of the invite link; 0 if the user has no access to the chat before joining + ChatId int64 `json:"chat_id"` + // If non-zero, the amount of time for which read access to the chat will remain available, in seconds + AccessibleFor int32 `json:"accessible_for"` + // 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 *ChatPhotoInfo `json:"photo"` + // Number of members in the chat + 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"` + // True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup + IsPublic bool `json:"is_public"` +} + +func (entity *ChatInviteLinkInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatInviteLinkInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ChatInviteLinkInfo) GetClass() string { + return ClassChatInviteLinkInfo +} + +func (*ChatInviteLinkInfo) GetType() string { + return TypeChatInviteLinkInfo +} + +func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + AccessibleFor int32 `json:"accessible_for"` + Type json.RawMessage `json:"type"` + Title string `json:"title"` + Photo *ChatPhotoInfo `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.AccessibleFor = tmp.AccessibleFor + 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 +} + +// The chat is public, because it has username +type PublicChatTypeHasUsername struct { + meta +} + +func (entity *PublicChatTypeHasUsername) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PublicChatTypeHasUsername + + return json.Marshal((*stub)(entity)) +} + +func (*PublicChatTypeHasUsername) GetClass() string { + return ClassPublicChatType +} + +func (*PublicChatTypeHasUsername) GetType() string { + return TypePublicChatTypeHasUsername +} + +func (*PublicChatTypeHasUsername) PublicChatTypeType() string { + return TypePublicChatTypeHasUsername +} + +// The chat is public, because it is a location-based supergroup +type PublicChatTypeIsLocationBased struct { + meta +} + +func (entity *PublicChatTypeIsLocationBased) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PublicChatTypeIsLocationBased + + return json.Marshal((*stub)(entity)) +} + +func (*PublicChatTypeIsLocationBased) GetClass() string { + return ClassPublicChatType +} + +func (*PublicChatTypeIsLocationBased) GetType() string { + return TypePublicChatTypeIsLocationBased +} + +func (*PublicChatTypeIsLocationBased) PublicChatTypeType() string { + return TypePublicChatTypeIsLocationBased +} + +// The chat can be reported as spam using the method reportChat with the reason chatReportReasonSpam +type ChatActionBarReportSpam struct { + meta + // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings + CanUnarchive bool `json:"can_unarchive"` +} + +func (entity *ChatActionBarReportSpam) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatActionBarReportSpam + + return json.Marshal((*stub)(entity)) +} + +func (*ChatActionBarReportSpam) GetClass() string { + return ClassChatActionBar +} + +func (*ChatActionBarReportSpam) GetType() string { + return TypeChatActionBarReportSpam +} + +func (*ChatActionBarReportSpam) ChatActionBarType() string { + return TypeChatActionBarReportSpam +} + +// The chat is a location-based supergroup, which can be reported as having unrelated location using the method reportChat with the reason chatReportReasonUnrelatedLocation +type ChatActionBarReportUnrelatedLocation struct { + meta +} + +func (entity *ChatActionBarReportUnrelatedLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatActionBarReportUnrelatedLocation + + return json.Marshal((*stub)(entity)) +} + +func (*ChatActionBarReportUnrelatedLocation) GetClass() string { + return ClassChatActionBar +} + +func (*ChatActionBarReportUnrelatedLocation) GetType() string { + return TypeChatActionBarReportUnrelatedLocation +} + +func (*ChatActionBarReportUnrelatedLocation) ChatActionBarType() string { + return TypeChatActionBarReportUnrelatedLocation +} + +// The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method blockUser, or the other user can be added to the contact list using the method addContact +type ChatActionBarReportAddBlock struct { + meta + // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings + CanUnarchive bool `json:"can_unarchive"` + // If non-negative, the current user was found by the peer through searchChatsNearby and this is the distance between the users + Distance int32 `json:"distance"` +} + +func (entity *ChatActionBarReportAddBlock) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatActionBarReportAddBlock + + return json.Marshal((*stub)(entity)) +} + +func (*ChatActionBarReportAddBlock) GetClass() string { + return ClassChatActionBar +} + +func (*ChatActionBarReportAddBlock) GetType() string { + return TypeChatActionBarReportAddBlock +} + +func (*ChatActionBarReportAddBlock) ChatActionBarType() string { + return TypeChatActionBarReportAddBlock +} + +// The chat is a private or secret chat and the other user can be added to the contact list using the method addContact +type ChatActionBarAddContact struct { + meta +} + +func (entity *ChatActionBarAddContact) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatActionBarAddContact + + return json.Marshal((*stub)(entity)) +} + +func (*ChatActionBarAddContact) GetClass() string { + return ClassChatActionBar +} + +func (*ChatActionBarAddContact) GetType() string { + return TypeChatActionBarAddContact +} + +func (*ChatActionBarAddContact) ChatActionBarType() string { + return TypeChatActionBarAddContact +} + +// The chat is a private or secret chat with a mutual contact and the user's phone number can be shared with the other user using the method sharePhoneNumber +type ChatActionBarSharePhoneNumber struct { + meta +} + +func (entity *ChatActionBarSharePhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatActionBarSharePhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*ChatActionBarSharePhoneNumber) GetClass() string { + return ClassChatActionBar +} + +func (*ChatActionBarSharePhoneNumber) GetType() string { + return TypeChatActionBarSharePhoneNumber +} + +func (*ChatActionBarSharePhoneNumber) ChatActionBarType() string { + return TypeChatActionBarSharePhoneNumber +} + +// A simple button, with text that should be sent when the button is pressed +type KeyboardButtonTypeText struct { + meta +} + +func (entity *KeyboardButtonTypeText) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub KeyboardButtonTypeText + + return json.Marshal((*stub)(entity)) +} + +func (*KeyboardButtonTypeText) GetClass() string { + return ClassKeyboardButtonType +} + +func (*KeyboardButtonTypeText) GetType() string { + return TypeKeyboardButtonTypeText +} + +func (*KeyboardButtonTypeText) KeyboardButtonTypeType() string { + return TypeKeyboardButtonTypeText +} + +// A button that sends the user's phone number when pressed; available only in private chats +type KeyboardButtonTypeRequestPhoneNumber struct { + meta +} + +func (entity *KeyboardButtonTypeRequestPhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub KeyboardButtonTypeRequestPhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*KeyboardButtonTypeRequestPhoneNumber) GetClass() string { + return ClassKeyboardButtonType +} + +func (*KeyboardButtonTypeRequestPhoneNumber) GetType() string { + return TypeKeyboardButtonTypeRequestPhoneNumber +} + +func (*KeyboardButtonTypeRequestPhoneNumber) KeyboardButtonTypeType() string { + return TypeKeyboardButtonTypeRequestPhoneNumber +} + +// A button that sends the user's location when pressed; available only in private chats +type KeyboardButtonTypeRequestLocation struct { + meta +} + +func (entity *KeyboardButtonTypeRequestLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub KeyboardButtonTypeRequestLocation + + return json.Marshal((*stub)(entity)) +} + +func (*KeyboardButtonTypeRequestLocation) GetClass() string { + return ClassKeyboardButtonType +} + +func (*KeyboardButtonTypeRequestLocation) GetType() string { + return TypeKeyboardButtonTypeRequestLocation +} + +func (*KeyboardButtonTypeRequestLocation) KeyboardButtonTypeType() string { + return TypeKeyboardButtonTypeRequestLocation +} + +// A button that allows the user to create and send a poll when pressed; available only in private chats +type KeyboardButtonTypeRequestPoll struct { + meta + // If true, only regular polls must be allowed to create + ForceRegular bool `json:"force_regular"` + // If true, only polls in quiz mode must be allowed to create + ForceQuiz bool `json:"force_quiz"` +} + +func (entity *KeyboardButtonTypeRequestPoll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub KeyboardButtonTypeRequestPoll + + return json.Marshal((*stub)(entity)) +} + +func (*KeyboardButtonTypeRequestPoll) GetClass() string { + return ClassKeyboardButtonType +} + +func (*KeyboardButtonTypeRequestPoll) GetType() string { + return TypeKeyboardButtonTypeRequestPoll +} + +func (*KeyboardButtonTypeRequestPoll) KeyboardButtonTypeType() string { + return TypeKeyboardButtonTypeRequestPoll +} + +// Represents a single button in a bot keyboard +type KeyboardButton struct { + meta + // Text of the button + Text string `json:"text"` + // Type of the button + Type KeyboardButtonType `json:"type"` +} + +func (entity *KeyboardButton) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub KeyboardButton + + return json.Marshal((*stub)(entity)) +} + +func (*KeyboardButton) GetClass() string { + return ClassKeyboardButton +} + +func (*KeyboardButton) GetType() string { + return TypeKeyboardButton +} + +func (keyboardButton *KeyboardButton) UnmarshalJSON(data []byte) error { + var tmp struct { + Text string `json:"text"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + keyboardButton.Text = tmp.Text + + fieldType, _ := UnmarshalKeyboardButtonType(tmp.Type) + keyboardButton.Type = fieldType + + return nil +} + +// A button that opens a specified URL +type InlineKeyboardButtonTypeUrl struct { + meta + // HTTP or tg:// URL to open + Url string `json:"url"` +} + +func (entity *InlineKeyboardButtonTypeUrl) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineKeyboardButtonTypeUrl + + return json.Marshal((*stub)(entity)) +} + +func (*InlineKeyboardButtonTypeUrl) GetClass() string { + return ClassInlineKeyboardButtonType +} + +func (*InlineKeyboardButtonTypeUrl) GetType() string { + return TypeInlineKeyboardButtonTypeUrl +} + +func (*InlineKeyboardButtonTypeUrl) InlineKeyboardButtonTypeType() string { + return TypeInlineKeyboardButtonTypeUrl +} + +// A button that opens a specified URL and automatically logs in in current user if they allowed to do that +type InlineKeyboardButtonTypeLoginUrl struct { + meta + // An 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 +} + +// A button that sends a callback query to a bot +type InlineKeyboardButtonTypeCallback struct { + meta + // Data to be sent to the bot via a callback query + Data []byte `json:"data"` +} + +func (entity *InlineKeyboardButtonTypeCallback) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineKeyboardButtonTypeCallback + + return json.Marshal((*stub)(entity)) +} + +func (*InlineKeyboardButtonTypeCallback) GetClass() string { + return ClassInlineKeyboardButtonType +} + +func (*InlineKeyboardButtonTypeCallback) GetType() string { + return TypeInlineKeyboardButtonTypeCallback +} + +func (*InlineKeyboardButtonTypeCallback) InlineKeyboardButtonTypeType() string { + return TypeInlineKeyboardButtonTypeCallback +} + +// A button that asks for password of the current user and then sends a callback query to a bot +type InlineKeyboardButtonTypeCallbackWithPassword struct { + meta + // Data to be sent to the bot via a callback query + Data []byte `json:"data"` +} + +func (entity *InlineKeyboardButtonTypeCallbackWithPassword) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineKeyboardButtonTypeCallbackWithPassword + + return json.Marshal((*stub)(entity)) +} + +func (*InlineKeyboardButtonTypeCallbackWithPassword) GetClass() string { + return ClassInlineKeyboardButtonType +} + +func (*InlineKeyboardButtonTypeCallbackWithPassword) GetType() string { + return TypeInlineKeyboardButtonTypeCallbackWithPassword +} + +func (*InlineKeyboardButtonTypeCallbackWithPassword) InlineKeyboardButtonTypeType() string { + return TypeInlineKeyboardButtonTypeCallbackWithPassword +} + +// A button with a game that sends a 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 +type InlineKeyboardButtonTypeCallbackGame struct { + meta +} + +func (entity *InlineKeyboardButtonTypeCallbackGame) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineKeyboardButtonTypeCallbackGame + + return json.Marshal((*stub)(entity)) +} + +func (*InlineKeyboardButtonTypeCallbackGame) GetClass() string { + return ClassInlineKeyboardButtonType +} + +func (*InlineKeyboardButtonTypeCallbackGame) GetType() string { + return TypeInlineKeyboardButtonTypeCallbackGame +} + +func (*InlineKeyboardButtonTypeCallbackGame) InlineKeyboardButtonTypeType() string { + return TypeInlineKeyboardButtonTypeCallbackGame +} + +// A button that forces an inline query to the bot to be inserted in the input field +type InlineKeyboardButtonTypeSwitchInline struct { + 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"` +} + +func (entity *InlineKeyboardButtonTypeSwitchInline) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineKeyboardButtonTypeSwitchInline + + return json.Marshal((*stub)(entity)) +} + +func (*InlineKeyboardButtonTypeSwitchInline) GetClass() string { + return ClassInlineKeyboardButtonType +} + +func (*InlineKeyboardButtonTypeSwitchInline) GetType() string { + return TypeInlineKeyboardButtonTypeSwitchInline +} + +func (*InlineKeyboardButtonTypeSwitchInline) InlineKeyboardButtonTypeType() string { + return TypeInlineKeyboardButtonTypeSwitchInline +} + +// 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 +type InlineKeyboardButtonTypeBuy struct { + meta +} + +func (entity *InlineKeyboardButtonTypeBuy) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineKeyboardButtonTypeBuy + + return json.Marshal((*stub)(entity)) +} + +func (*InlineKeyboardButtonTypeBuy) GetClass() string { + return ClassInlineKeyboardButtonType +} + +func (*InlineKeyboardButtonTypeBuy) GetType() string { + return TypeInlineKeyboardButtonTypeBuy +} + +func (*InlineKeyboardButtonTypeBuy) InlineKeyboardButtonTypeType() string { + return TypeInlineKeyboardButtonTypeBuy +} + +// Represents a single button in an inline keyboard +type InlineKeyboardButton struct { + meta + // Text of the button + Text string `json:"text"` + // Type of the button + Type InlineKeyboardButtonType `json:"type"` +} + +func (entity *InlineKeyboardButton) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineKeyboardButton + + return json.Marshal((*stub)(entity)) +} + +func (*InlineKeyboardButton) GetClass() string { + return ClassInlineKeyboardButton +} + +func (*InlineKeyboardButton) GetType() string { + return TypeInlineKeyboardButton +} + +func (inlineKeyboardButton *InlineKeyboardButton) UnmarshalJSON(data []byte) error { + var tmp struct { + Text string `json:"text"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inlineKeyboardButton.Text = tmp.Text + + fieldType, _ := UnmarshalInlineKeyboardButtonType(tmp.Type) + inlineKeyboardButton.Type = fieldType + + return nil +} + +// Instructs application 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 { + meta + // True, if the keyboard is removed only for the mentioned users or the target user of a reply + IsPersonal bool `json:"is_personal"` +} + +func (entity *ReplyMarkupRemoveKeyboard) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReplyMarkupRemoveKeyboard + + return json.Marshal((*stub)(entity)) +} + +func (*ReplyMarkupRemoveKeyboard) GetClass() string { + return ClassReplyMarkup +} + +func (*ReplyMarkupRemoveKeyboard) GetType() string { + return TypeReplyMarkupRemoveKeyboard +} + +func (*ReplyMarkupRemoveKeyboard) ReplyMarkupType() string { + return TypeReplyMarkupRemoveKeyboard +} + +// Instructs application to force a reply to this message +type ReplyMarkupForceReply struct { + 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"` +} + +func (entity *ReplyMarkupForceReply) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReplyMarkupForceReply + + return json.Marshal((*stub)(entity)) +} + +func (*ReplyMarkupForceReply) GetClass() string { + return ClassReplyMarkup +} + +func (*ReplyMarkupForceReply) GetType() string { + return TypeReplyMarkupForceReply +} + +func (*ReplyMarkupForceReply) ReplyMarkupType() string { + return TypeReplyMarkupForceReply +} + +// Contains a custom keyboard layout to quickly reply to bots +type ReplyMarkupShowKeyboard struct { + meta + // A list of rows of bot keyboard buttons + Rows [][]*KeyboardButton `json:"rows"` + // True, if the application needs to resize the keyboard vertically + ResizeKeyboard bool `json:"resize_keyboard"` + // True, if the application 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"` +} + +func (entity *ReplyMarkupShowKeyboard) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReplyMarkupShowKeyboard + + return json.Marshal((*stub)(entity)) +} + +func (*ReplyMarkupShowKeyboard) GetClass() string { + return ClassReplyMarkup +} + +func (*ReplyMarkupShowKeyboard) GetType() string { + return TypeReplyMarkupShowKeyboard +} + +func (*ReplyMarkupShowKeyboard) ReplyMarkupType() string { + return TypeReplyMarkupShowKeyboard +} + +// Contains an inline keyboard layout +type ReplyMarkupInlineKeyboard struct { + meta + // A list of rows of inline keyboard buttons + Rows [][]*InlineKeyboardButton `json:"rows"` +} + +func (entity *ReplyMarkupInlineKeyboard) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReplyMarkupInlineKeyboard + + return json.Marshal((*stub)(entity)) +} + +func (*ReplyMarkupInlineKeyboard) GetClass() string { + return ClassReplyMarkup +} + +func (*ReplyMarkupInlineKeyboard) GetType() string { + return TypeReplyMarkupInlineKeyboard +} + +func (*ReplyMarkupInlineKeyboard) ReplyMarkupType() string { + return TypeReplyMarkupInlineKeyboard +} + +// An HTTP url needs to be open +type LoginUrlInfoOpen struct { + meta + // The URL to open + Url string `json:"url"` + // True, if there is no need to show an ordinary open URL confirm + SkipConfirm bool `json:"skip_confirm"` +} + +func (entity *LoginUrlInfoOpen) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LoginUrlInfoOpen + + return json.Marshal((*stub)(entity)) +} + +func (*LoginUrlInfoOpen) GetClass() string { + return ClassLoginUrlInfo +} + +func (*LoginUrlInfoOpen) GetType() string { + return TypeLoginUrlInfoOpen +} + +func (*LoginUrlInfoOpen) LoginUrlInfoType() string { + return TypeLoginUrlInfoOpen +} + +// An authorization confirmation dialog needs to be shown to the user +type LoginUrlInfoRequestConfirmation struct { + meta + // An HTTP URL to be opened + Url string `json:"url"` + // A domain of the URL + Domain string `json:"domain"` + // User identifier of a bot linked with the website + BotUserId int32 `json:"bot_user_id"` + // True, if the user needs to be requested to give the permission to the bot to send them messages + RequestWriteAccess bool `json:"request_write_access"` +} + +func (entity *LoginUrlInfoRequestConfirmation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LoginUrlInfoRequestConfirmation + + return json.Marshal((*stub)(entity)) +} + +func (*LoginUrlInfoRequestConfirmation) GetClass() string { + return ClassLoginUrlInfo +} + +func (*LoginUrlInfoRequestConfirmation) GetType() string { + return TypeLoginUrlInfoRequestConfirmation +} + +func (*LoginUrlInfoRequestConfirmation) LoginUrlInfoType() string { + return TypeLoginUrlInfoRequestConfirmation +} + +// Contains information about a message thread +type MessageThreadInfo struct { + meta + // Identifier of the chat to which the message thread belongs + ChatId int64 `json:"chat_id"` + // Message thread identifier, unique within the chat + MessageThreadId int64 `json:"message_thread_id"` + // Contains information about the message thread + ReplyInfo *MessageReplyInfo `json:"reply_info"` + // The messages from which the thread starts. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) + Messages []*Message `json:"messages"` + // A draft of a message in the message thread; may be null + DraftMessage *DraftMessage `json:"draft_message"` +} + +func (entity *MessageThreadInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageThreadInfo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageThreadInfo) GetClass() string { + return ClassMessageThreadInfo +} + +func (*MessageThreadInfo) GetType() string { + return TypeMessageThreadInfo +} + +// A plain text +type RichTextPlain struct { + meta + // Text + Text string `json:"text"` +} + +func (entity *RichTextPlain) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextPlain + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextPlain) GetClass() string { + return ClassRichText +} + +func (*RichTextPlain) GetType() string { + return TypeRichTextPlain +} + +func (*RichTextPlain) RichTextType() string { + return TypeRichTextPlain +} + +// A bold rich text +type RichTextBold struct { + meta + // Text + Text RichText `json:"text"` +} + +func (entity *RichTextBold) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextBold + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextBold) GetClass() string { + return ClassRichText +} + +func (*RichTextBold) GetType() string { + return TypeRichTextBold +} + +func (*RichTextBold) RichTextType() string { + return TypeRichTextBold +} + +func (richTextBold *RichTextBold) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextBold.Text = fieldText + + return nil +} + +// An italicized rich text +type RichTextItalic struct { + meta + // Text + Text RichText `json:"text"` +} + +func (entity *RichTextItalic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextItalic + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextItalic) GetClass() string { + return ClassRichText +} + +func (*RichTextItalic) GetType() string { + return TypeRichTextItalic +} + +func (*RichTextItalic) RichTextType() string { + return TypeRichTextItalic +} + +func (richTextItalic *RichTextItalic) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextItalic.Text = fieldText + + return nil +} + +// An underlined rich text +type RichTextUnderline struct { + meta + // Text + Text RichText `json:"text"` +} + +func (entity *RichTextUnderline) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextUnderline + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextUnderline) GetClass() string { + return ClassRichText +} + +func (*RichTextUnderline) GetType() string { + return TypeRichTextUnderline +} + +func (*RichTextUnderline) RichTextType() string { + return TypeRichTextUnderline +} + +func (richTextUnderline *RichTextUnderline) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextUnderline.Text = fieldText + + return nil +} + +// A strikethrough rich text +type RichTextStrikethrough struct { + meta + // Text + Text RichText `json:"text"` +} + +func (entity *RichTextStrikethrough) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextStrikethrough + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextStrikethrough) GetClass() string { + return ClassRichText +} + +func (*RichTextStrikethrough) GetType() string { + return TypeRichTextStrikethrough +} + +func (*RichTextStrikethrough) RichTextType() string { + return TypeRichTextStrikethrough +} + +func (richTextStrikethrough *RichTextStrikethrough) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextStrikethrough.Text = fieldText + + return nil +} + +// A fixed-width rich text +type RichTextFixed struct { + meta + // Text + Text RichText `json:"text"` +} + +func (entity *RichTextFixed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextFixed + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextFixed) GetClass() string { + return ClassRichText +} + +func (*RichTextFixed) GetType() string { + return TypeRichTextFixed +} + +func (*RichTextFixed) RichTextType() string { + return TypeRichTextFixed +} + +func (richTextFixed *RichTextFixed) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextFixed.Text = fieldText + + return nil +} + +// A rich text URL link +type RichTextUrl struct { + meta + // Text + Text RichText `json:"text"` + // URL + Url string `json:"url"` + // True, if the URL has cached instant view server-side + IsCached bool `json:"is_cached"` +} + +func (entity *RichTextUrl) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextUrl + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextUrl) GetClass() string { + return ClassRichText +} + +func (*RichTextUrl) GetType() string { + return TypeRichTextUrl +} + +func (*RichTextUrl) RichTextType() string { + return TypeRichTextUrl +} + +func (richTextUrl *RichTextUrl) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + Url string `json:"url"` + IsCached bool `json:"is_cached"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + richTextUrl.Url = tmp.Url + richTextUrl.IsCached = tmp.IsCached + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextUrl.Text = fieldText + + return nil +} + +// A rich text email link +type RichTextEmailAddress struct { + meta + // Text + Text RichText `json:"text"` + // Email address + EmailAddress string `json:"email_address"` +} + +func (entity *RichTextEmailAddress) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextEmailAddress + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextEmailAddress) GetClass() string { + return ClassRichText +} + +func (*RichTextEmailAddress) GetType() string { + return TypeRichTextEmailAddress +} + +func (*RichTextEmailAddress) RichTextType() string { + return TypeRichTextEmailAddress +} + +func (richTextEmailAddress *RichTextEmailAddress) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + EmailAddress string `json:"email_address"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + richTextEmailAddress.EmailAddress = tmp.EmailAddress + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextEmailAddress.Text = fieldText + + return nil +} + +// A subscript rich text +type RichTextSubscript struct { + meta + // Text + Text RichText `json:"text"` +} + +func (entity *RichTextSubscript) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextSubscript + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextSubscript) GetClass() string { + return ClassRichText +} + +func (*RichTextSubscript) GetType() string { + return TypeRichTextSubscript +} + +func (*RichTextSubscript) RichTextType() string { + return TypeRichTextSubscript +} + +func (richTextSubscript *RichTextSubscript) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextSubscript.Text = fieldText + + return nil +} + +// A superscript rich text +type RichTextSuperscript struct { + meta + // Text + Text RichText `json:"text"` +} + +func (entity *RichTextSuperscript) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextSuperscript + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextSuperscript) GetClass() string { + return ClassRichText +} + +func (*RichTextSuperscript) GetType() string { + return TypeRichTextSuperscript +} + +func (*RichTextSuperscript) RichTextType() string { + return TypeRichTextSuperscript +} + +func (richTextSuperscript *RichTextSuperscript) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextSuperscript.Text = fieldText + + return nil +} + +// A marked rich text +type RichTextMarked struct { + meta + // Text + Text RichText `json:"text"` +} + +func (entity *RichTextMarked) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextMarked + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextMarked) GetClass() string { + return ClassRichText +} + +func (*RichTextMarked) GetType() string { + return TypeRichTextMarked +} + +func (*RichTextMarked) RichTextType() string { + return TypeRichTextMarked +} + +func (richTextMarked *RichTextMarked) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextMarked.Text = fieldText + + return nil +} + +// A rich text phone number +type RichTextPhoneNumber struct { + meta + // Text + Text RichText `json:"text"` + // Phone number + PhoneNumber string `json:"phone_number"` +} + +func (entity *RichTextPhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextPhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextPhoneNumber) GetClass() string { + return ClassRichText +} + +func (*RichTextPhoneNumber) GetType() string { + return TypeRichTextPhoneNumber +} + +func (*RichTextPhoneNumber) RichTextType() string { + return TypeRichTextPhoneNumber +} + +func (richTextPhoneNumber *RichTextPhoneNumber) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + PhoneNumber string `json:"phone_number"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + richTextPhoneNumber.PhoneNumber = tmp.PhoneNumber + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextPhoneNumber.Text = fieldText + + return nil +} + +// A small image inside the text +type RichTextIcon struct { + meta + // The image represented as a document. The image can be in GIF, JPEG or PNG format + Document *Document `json:"document"` + // Width of a bounding box in which the image should be shown; 0 if unknown + Width int32 `json:"width"` + // Height of a bounding box in which the image should be shown; 0 if unknown + Height int32 `json:"height"` +} + +func (entity *RichTextIcon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextIcon + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextIcon) GetClass() string { + return ClassRichText +} + +func (*RichTextIcon) GetType() string { + return TypeRichTextIcon +} + +func (*RichTextIcon) RichTextType() string { + return TypeRichTextIcon +} + +// A reference to a richTexts object on the same web page +type RichTextReference struct { + meta + // The text + Text RichText `json:"text"` + // The name of a richTextAnchor object, which is the first element of the target richTexts object + AnchorName string `json:"anchor_name"` + // An HTTP URL, opening the reference + Url string `json:"url"` +} + +func (entity *RichTextReference) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextReference + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextReference) GetClass() string { + return ClassRichText +} + +func (*RichTextReference) GetType() string { + return TypeRichTextReference +} + +func (*RichTextReference) RichTextType() string { + return TypeRichTextReference +} + +func (richTextReference *RichTextReference) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + AnchorName string `json:"anchor_name"` + Url string `json:"url"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + richTextReference.AnchorName = tmp.AnchorName + richTextReference.Url = tmp.Url + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextReference.Text = fieldText + + return nil +} + +// An anchor +type RichTextAnchor struct { + meta + // Anchor name + Name string `json:"name"` +} + +func (entity *RichTextAnchor) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextAnchor + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextAnchor) GetClass() string { + return ClassRichText +} + +func (*RichTextAnchor) GetType() string { + return TypeRichTextAnchor +} + +func (*RichTextAnchor) RichTextType() string { + return TypeRichTextAnchor +} + +// A link to an anchor on the same web page +type RichTextAnchorLink struct { + meta + // The link text + Text RichText `json:"text"` + // The anchor name. If the name is empty, the link should bring back to top + AnchorName string `json:"anchor_name"` + // An HTTP URL, opening the anchor + Url string `json:"url"` +} + +func (entity *RichTextAnchorLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextAnchorLink + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextAnchorLink) GetClass() string { + return ClassRichText +} + +func (*RichTextAnchorLink) GetType() string { + return TypeRichTextAnchorLink +} + +func (*RichTextAnchorLink) RichTextType() string { + return TypeRichTextAnchorLink +} + +func (richTextAnchorLink *RichTextAnchorLink) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + AnchorName string `json:"anchor_name"` + Url string `json:"url"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + richTextAnchorLink.AnchorName = tmp.AnchorName + richTextAnchorLink.Url = tmp.Url + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextAnchorLink.Text = fieldText + + return nil +} + +// A concatenation of rich texts +type RichTexts struct { + meta + // Texts + Texts []RichText `json:"texts"` +} + +func (entity *RichTexts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTexts + + return json.Marshal((*stub)(entity)) +} + +func (*RichTexts) GetClass() string { + return ClassRichText +} + +func (*RichTexts) GetType() string { + return TypeRichTexts +} + +func (*RichTexts) RichTextType() string { + return TypeRichTexts +} + +func (richTexts *RichTexts) UnmarshalJSON(data []byte) error { + var tmp struct { + Texts []json.RawMessage `json:"texts"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldTexts, _ := UnmarshalListOfRichText(tmp.Texts) + richTexts.Texts = fieldTexts + + return nil +} + +// 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 ) + 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 { + var tmp struct { + Text json.RawMessage `json:"text"` + Credit json.RawMessage `json:"credit"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + pageBlockCaption.Text = fieldText + + fieldCredit, _ := UnmarshalRichText(tmp.Credit) + pageBlockCaption.Credit = fieldCredit + + return nil +} + +// Describes an item of a list page block +type PageBlockListItem struct { + meta + // Item label + Label string `json:"label"` + // Item blocks + PageBlocks []PageBlock `json:"page_blocks"` +} + +func (entity *PageBlockListItem) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockListItem + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockListItem) GetClass() string { + return ClassPageBlockListItem +} + +func (*PageBlockListItem) GetType() string { + return TypePageBlockListItem +} + +func (pageBlockListItem *PageBlockListItem) UnmarshalJSON(data []byte) error { + var tmp struct { + Label string `json:"label"` + PageBlocks []json.RawMessage `json:"page_blocks"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockListItem.Label = tmp.Label + + fieldPageBlocks, _ := UnmarshalListOfPageBlock(tmp.PageBlocks) + pageBlockListItem.PageBlocks = fieldPageBlocks + + return nil +} + +// The content should be left-aligned +type PageBlockHorizontalAlignmentLeft struct { + meta +} + +func (entity *PageBlockHorizontalAlignmentLeft) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockHorizontalAlignmentLeft + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockHorizontalAlignmentLeft) GetClass() string { + return ClassPageBlockHorizontalAlignment +} + +func (*PageBlockHorizontalAlignmentLeft) GetType() string { + return TypePageBlockHorizontalAlignmentLeft +} + +func (*PageBlockHorizontalAlignmentLeft) PageBlockHorizontalAlignmentType() string { + return TypePageBlockHorizontalAlignmentLeft +} + +// The content should be center-aligned +type PageBlockHorizontalAlignmentCenter struct { + meta +} + +func (entity *PageBlockHorizontalAlignmentCenter) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockHorizontalAlignmentCenter + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockHorizontalAlignmentCenter) GetClass() string { + return ClassPageBlockHorizontalAlignment +} + +func (*PageBlockHorizontalAlignmentCenter) GetType() string { + return TypePageBlockHorizontalAlignmentCenter +} + +func (*PageBlockHorizontalAlignmentCenter) PageBlockHorizontalAlignmentType() string { + return TypePageBlockHorizontalAlignmentCenter +} + +// The content should be right-aligned +type PageBlockHorizontalAlignmentRight struct { + meta +} + +func (entity *PageBlockHorizontalAlignmentRight) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockHorizontalAlignmentRight + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockHorizontalAlignmentRight) GetClass() string { + return ClassPageBlockHorizontalAlignment +} + +func (*PageBlockHorizontalAlignmentRight) GetType() string { + return TypePageBlockHorizontalAlignmentRight +} + +func (*PageBlockHorizontalAlignmentRight) PageBlockHorizontalAlignmentType() string { + return TypePageBlockHorizontalAlignmentRight +} + +// The content should be top-aligned +type PageBlockVerticalAlignmentTop struct { + meta +} + +func (entity *PageBlockVerticalAlignmentTop) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockVerticalAlignmentTop + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockVerticalAlignmentTop) GetClass() string { + return ClassPageBlockVerticalAlignment +} + +func (*PageBlockVerticalAlignmentTop) GetType() string { + return TypePageBlockVerticalAlignmentTop +} + +func (*PageBlockVerticalAlignmentTop) PageBlockVerticalAlignmentType() string { + return TypePageBlockVerticalAlignmentTop +} + +// The content should be middle-aligned +type PageBlockVerticalAlignmentMiddle struct { + meta +} + +func (entity *PageBlockVerticalAlignmentMiddle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockVerticalAlignmentMiddle + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockVerticalAlignmentMiddle) GetClass() string { + return ClassPageBlockVerticalAlignment +} + +func (*PageBlockVerticalAlignmentMiddle) GetType() string { + return TypePageBlockVerticalAlignmentMiddle +} + +func (*PageBlockVerticalAlignmentMiddle) PageBlockVerticalAlignmentType() string { + return TypePageBlockVerticalAlignmentMiddle +} + +// The content should be bottom-aligned +type PageBlockVerticalAlignmentBottom struct { + meta +} + +func (entity *PageBlockVerticalAlignmentBottom) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockVerticalAlignmentBottom + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockVerticalAlignmentBottom) GetClass() string { + return ClassPageBlockVerticalAlignment +} + +func (*PageBlockVerticalAlignmentBottom) GetType() string { + return TypePageBlockVerticalAlignmentBottom +} + +func (*PageBlockVerticalAlignmentBottom) PageBlockVerticalAlignmentType() string { + return TypePageBlockVerticalAlignmentBottom +} + +// Represents a cell of a table +type PageBlockTableCell struct { + meta + // Cell text; may be null. If the text is null, then the cell should be invisible + Text RichText `json:"text"` + // 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"` +} + +func (entity *PageBlockTableCell) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockTableCell + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockTableCell) GetClass() string { + return ClassPageBlockTableCell +} + +func (*PageBlockTableCell) GetType() string { + return TypePageBlockTableCell +} + +func (pageBlockTableCell *PageBlockTableCell) UnmarshalJSON(data []byte) error { + var tmp struct { + 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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockTableCell.IsHeader = tmp.IsHeader + pageBlockTableCell.Colspan = tmp.Colspan + pageBlockTableCell.Rowspan = tmp.Rowspan + + fieldText, _ := UnmarshalRichText(tmp.Text) + pageBlockTableCell.Text = fieldText + + fieldAlign, _ := UnmarshalPageBlockHorizontalAlignment(tmp.Align) + pageBlockTableCell.Align = fieldAlign + + fieldValign, _ := UnmarshalPageBlockVerticalAlignment(tmp.Valign) + pageBlockTableCell.Valign = fieldValign + + return nil +} + +// Contains information about a related article +type PageBlockRelatedArticle struct { + meta + // 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"` +} + +func (entity *PageBlockRelatedArticle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockRelatedArticle + + return json.Marshal((*stub)(entity)) +} + +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 { + return ClassPageBlock +} + +func (*PageBlockTitle) GetType() string { + return TypePageBlockTitle +} + +func (*PageBlockTitle) PageBlockType() string { + return TypePageBlockTitle +} + +func (pageBlockTitle *PageBlockTitle) UnmarshalJSON(data []byte) error { + var tmp struct { + Title json.RawMessage `json:"title"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldTitle, _ := UnmarshalRichText(tmp.Title) + pageBlockTitle.Title = fieldTitle + + return nil +} + +// The subtitle of a page +type PageBlockSubtitle struct { + meta + // Subtitle + Subtitle RichText `json:"subtitle"` +} + +func (entity *PageBlockSubtitle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockSubtitle + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockSubtitle) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockSubtitle) GetType() string { + return TypePageBlockSubtitle +} + +func (*PageBlockSubtitle) PageBlockType() string { + return TypePageBlockSubtitle +} + +func (pageBlockSubtitle *PageBlockSubtitle) UnmarshalJSON(data []byte) error { + var tmp struct { + Subtitle json.RawMessage `json:"subtitle"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldSubtitle, _ := UnmarshalRichText(tmp.Subtitle) + pageBlockSubtitle.Subtitle = fieldSubtitle + + return nil +} + +// The author and publishing date of a page +type PageBlockAuthorDate struct { + meta + // Author + Author RichText `json:"author"` + // Point in time (Unix timestamp) when the article was published; 0 if unknown + PublishDate int32 `json:"publish_date"` +} + +func (entity *PageBlockAuthorDate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockAuthorDate + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockAuthorDate) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockAuthorDate) GetType() string { + return TypePageBlockAuthorDate +} + +func (*PageBlockAuthorDate) PageBlockType() string { + return TypePageBlockAuthorDate +} + +func (pageBlockAuthorDate *PageBlockAuthorDate) UnmarshalJSON(data []byte) error { + var tmp struct { + Author json.RawMessage `json:"author"` + PublishDate int32 `json:"publish_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockAuthorDate.PublishDate = tmp.PublishDate + + fieldAuthor, _ := UnmarshalRichText(tmp.Author) + pageBlockAuthorDate.Author = fieldAuthor + + return nil +} + +// A header +type PageBlockHeader struct { + meta + // Header + Header RichText `json:"header"` +} + +func (entity *PageBlockHeader) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockHeader + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockHeader) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockHeader) GetType() string { + return TypePageBlockHeader +} + +func (*PageBlockHeader) PageBlockType() string { + return TypePageBlockHeader +} + +func (pageBlockHeader *PageBlockHeader) UnmarshalJSON(data []byte) error { + var tmp struct { + Header json.RawMessage `json:"header"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldHeader, _ := UnmarshalRichText(tmp.Header) + pageBlockHeader.Header = fieldHeader + + return nil +} + +// A subheader +type PageBlockSubheader struct { + meta + // Subheader + Subheader RichText `json:"subheader"` +} + +func (entity *PageBlockSubheader) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockSubheader + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockSubheader) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockSubheader) GetType() string { + return TypePageBlockSubheader +} + +func (*PageBlockSubheader) PageBlockType() string { + return TypePageBlockSubheader +} + +func (pageBlockSubheader *PageBlockSubheader) UnmarshalJSON(data []byte) error { + var tmp struct { + Subheader json.RawMessage `json:"subheader"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldSubheader, _ := UnmarshalRichText(tmp.Subheader) + pageBlockSubheader.Subheader = fieldSubheader + + return nil +} + +// A kicker +type PageBlockKicker struct { + meta + // Kicker + Kicker RichText `json:"kicker"` +} + +func (entity *PageBlockKicker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockKicker + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockKicker) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockKicker) GetType() string { + return TypePageBlockKicker +} + +func (*PageBlockKicker) PageBlockType() string { + return TypePageBlockKicker +} + +func (pageBlockKicker *PageBlockKicker) UnmarshalJSON(data []byte) error { + var tmp struct { + Kicker json.RawMessage `json:"kicker"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldKicker, _ := UnmarshalRichText(tmp.Kicker) + pageBlockKicker.Kicker = fieldKicker + + return nil +} + +// A text paragraph +type PageBlockParagraph struct { + meta + // Paragraph text + Text RichText `json:"text"` +} + +func (entity *PageBlockParagraph) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockParagraph + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockParagraph) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockParagraph) GetType() string { + return TypePageBlockParagraph +} + +func (*PageBlockParagraph) PageBlockType() string { + return TypePageBlockParagraph +} + +func (pageBlockParagraph *PageBlockParagraph) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + pageBlockParagraph.Text = fieldText + + return nil +} + +// A preformatted text paragraph +type PageBlockPreformatted struct { + meta + // Paragraph text + Text RichText `json:"text"` + // Programming language for which the text should be formatted + Language string `json:"language"` +} + +func (entity *PageBlockPreformatted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockPreformatted + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockPreformatted) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockPreformatted) GetType() string { + return TypePageBlockPreformatted +} + +func (*PageBlockPreformatted) PageBlockType() string { + return TypePageBlockPreformatted +} + +func (pageBlockPreformatted *PageBlockPreformatted) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + Language string `json:"language"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockPreformatted.Language = tmp.Language + + fieldText, _ := UnmarshalRichText(tmp.Text) + pageBlockPreformatted.Text = fieldText + + return nil +} + +// The footer of a page +type PageBlockFooter struct { + meta + // Footer + Footer RichText `json:"footer"` +} + +func (entity *PageBlockFooter) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockFooter + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockFooter) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockFooter) GetType() string { + return TypePageBlockFooter +} + +func (*PageBlockFooter) PageBlockType() string { + return TypePageBlockFooter +} + +func (pageBlockFooter *PageBlockFooter) UnmarshalJSON(data []byte) error { + var tmp struct { + Footer json.RawMessage `json:"footer"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldFooter, _ := UnmarshalRichText(tmp.Footer) + pageBlockFooter.Footer = fieldFooter + + return nil +} + +// An empty block separating a page +type PageBlockDivider struct { + meta +} + +func (entity *PageBlockDivider) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockDivider + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockDivider) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockDivider) GetType() string { + return TypePageBlockDivider +} + +func (*PageBlockDivider) PageBlockType() string { + return TypePageBlockDivider +} + +// An invisible anchor on a page, which can be used in a URL to open the page from the specified anchor +type PageBlockAnchor struct { + meta + // Name of the anchor + Name string `json:"name"` +} + +func (entity *PageBlockAnchor) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockAnchor + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockAnchor) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockAnchor) GetType() string { + return TypePageBlockAnchor +} + +func (*PageBlockAnchor) PageBlockType() string { + return TypePageBlockAnchor +} + +// A list of data blocks +type PageBlockList struct { + meta + // The items of the list + Items []*PageBlockListItem `json:"items"` +} + +func (entity *PageBlockList) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockList + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockList) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockList) GetType() string { + return TypePageBlockList +} + +func (*PageBlockList) PageBlockType() string { + return TypePageBlockList +} + +// A block quote +type PageBlockBlockQuote struct { + meta + // Quote text + Text RichText `json:"text"` + // Quote credit + Credit RichText `json:"credit"` +} + +func (entity *PageBlockBlockQuote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockBlockQuote + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockBlockQuote) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockBlockQuote) GetType() string { + return TypePageBlockBlockQuote +} + +func (*PageBlockBlockQuote) PageBlockType() string { + return TypePageBlockBlockQuote +} + +func (pageBlockBlockQuote *PageBlockBlockQuote) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + Credit json.RawMessage `json:"credit"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + pageBlockBlockQuote.Text = fieldText + + fieldCredit, _ := UnmarshalRichText(tmp.Credit) + pageBlockBlockQuote.Credit = fieldCredit + + return nil +} + +// A pull quote +type PageBlockPullQuote struct { + meta + // Quote text + Text RichText `json:"text"` + // Quote credit + Credit RichText `json:"credit"` +} + +func (entity *PageBlockPullQuote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockPullQuote + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockPullQuote) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockPullQuote) GetType() string { + return TypePageBlockPullQuote +} + +func (*PageBlockPullQuote) PageBlockType() string { + return TypePageBlockPullQuote +} + +func (pageBlockPullQuote *PageBlockPullQuote) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + Credit json.RawMessage `json:"credit"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + pageBlockPullQuote.Text = fieldText + + fieldCredit, _ := UnmarshalRichText(tmp.Credit) + pageBlockPullQuote.Credit = fieldCredit + + return nil +} + +// An animation +type PageBlockAnimation struct { + meta + // 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"` +} + +func (entity *PageBlockAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockAnimation) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockAnimation) GetType() string { + return TypePageBlockAnimation +} + +func (*PageBlockAnimation) PageBlockType() string { + return TypePageBlockAnimation +} + +// An audio file +type PageBlockAudio struct { + meta + // Audio file; may be null + Audio *Audio `json:"audio"` + // Audio file caption + Caption *PageBlockCaption `json:"caption"` +} + +func (entity *PageBlockAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockAudio + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockAudio) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockAudio) GetType() string { + return TypePageBlockAudio +} + +func (*PageBlockAudio) PageBlockType() string { + return TypePageBlockAudio +} + +// A photo +type PageBlockPhoto struct { + meta + // 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"` +} + +func (entity *PageBlockPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockPhoto) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockPhoto) GetType() string { + return TypePageBlockPhoto +} + +func (*PageBlockPhoto) PageBlockType() string { + return TypePageBlockPhoto +} + +// A video +type PageBlockVideo struct { + meta + // 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"` +} + +func (entity *PageBlockVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockVideo + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockVideo) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockVideo) GetType() string { + return TypePageBlockVideo +} + +func (*PageBlockVideo) PageBlockType() string { + return TypePageBlockVideo +} + +// A voice note +type PageBlockVoiceNote struct { + meta + // Voice note; may be null + VoiceNote *VoiceNote `json:"voice_note"` + // Voice note caption + Caption *PageBlockCaption `json:"caption"` +} + +func (entity *PageBlockVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockVoiceNote) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockVoiceNote) GetType() string { + return TypePageBlockVoiceNote +} + +func (*PageBlockVoiceNote) PageBlockType() string { + return TypePageBlockVoiceNote +} + +// A page cover +type PageBlockCover struct { + meta + // Cover + Cover PageBlock `json:"cover"` +} + +func (entity *PageBlockCover) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockCover + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockCover) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockCover) GetType() string { + return TypePageBlockCover +} + +func (*PageBlockCover) PageBlockType() string { + return TypePageBlockCover +} + +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 { + meta + // 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"` + // Block width; 0 if unknown + Width int32 `json:"width"` + // Block height; 0 if unknown + 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"` +} + +func (entity *PageBlockEmbedded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockEmbedded + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockEmbedded) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockEmbedded) GetType() string { + return TypePageBlockEmbedded +} + +func (*PageBlockEmbedded) PageBlockType() string { + return TypePageBlockEmbedded +} + +// An embedded post +type PageBlockEmbeddedPost struct { + meta + // Web page URL + Url string `json:"url"` + // Post author + Author string `json:"author"` + // Post author photo; may be null + 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"` +} + +func (entity *PageBlockEmbeddedPost) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockEmbeddedPost + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockEmbeddedPost) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockEmbeddedPost) GetType() string { + return TypePageBlockEmbeddedPost +} + +func (*PageBlockEmbeddedPost) PageBlockType() string { + return TypePageBlockEmbeddedPost +} + +func (pageBlockEmbeddedPost *PageBlockEmbeddedPost) UnmarshalJSON(data []byte) error { + var tmp struct { + Url string `json:"url"` + Author string `json:"author"` + AuthorPhoto *Photo `json:"author_photo"` + Date int32 `json:"date"` + PageBlocks []json.RawMessage `json:"page_blocks"` + Caption *PageBlockCaption `json:"caption"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockEmbeddedPost.Url = tmp.Url + pageBlockEmbeddedPost.Author = tmp.Author + pageBlockEmbeddedPost.AuthorPhoto = tmp.AuthorPhoto + pageBlockEmbeddedPost.Date = tmp.Date + pageBlockEmbeddedPost.Caption = tmp.Caption + + fieldPageBlocks, _ := UnmarshalListOfPageBlock(tmp.PageBlocks) + pageBlockEmbeddedPost.PageBlocks = fieldPageBlocks + + return nil +} + +// A collage +type PageBlockCollage struct { + meta + // Collage item contents + PageBlocks []PageBlock `json:"page_blocks"` + // Block caption + Caption *PageBlockCaption `json:"caption"` +} + +func (entity *PageBlockCollage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockCollage + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockCollage) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockCollage) GetType() string { + return TypePageBlockCollage +} + +func (*PageBlockCollage) PageBlockType() string { + return TypePageBlockCollage +} + +func (pageBlockCollage *PageBlockCollage) UnmarshalJSON(data []byte) error { + var tmp struct { + PageBlocks []json.RawMessage `json:"page_blocks"` + Caption *PageBlockCaption `json:"caption"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockCollage.Caption = tmp.Caption + + fieldPageBlocks, _ := UnmarshalListOfPageBlock(tmp.PageBlocks) + pageBlockCollage.PageBlocks = fieldPageBlocks + + return nil +} + +// A slideshow +type PageBlockSlideshow struct { + meta + // Slideshow item contents + PageBlocks []PageBlock `json:"page_blocks"` + // Block caption + Caption *PageBlockCaption `json:"caption"` +} + +func (entity *PageBlockSlideshow) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockSlideshow + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockSlideshow) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockSlideshow) GetType() string { + return TypePageBlockSlideshow +} + +func (*PageBlockSlideshow) PageBlockType() string { + return TypePageBlockSlideshow +} + +func (pageBlockSlideshow *PageBlockSlideshow) UnmarshalJSON(data []byte) error { + var tmp struct { + PageBlocks []json.RawMessage `json:"page_blocks"` + Caption *PageBlockCaption `json:"caption"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockSlideshow.Caption = tmp.Caption + + fieldPageBlocks, _ := UnmarshalListOfPageBlock(tmp.PageBlocks) + pageBlockSlideshow.PageBlocks = fieldPageBlocks + + return nil +} + +// A link to a chat +type PageBlockChatLink struct { + meta + // Chat title + Title string `json:"title"` + // Chat photo; may be null + Photo *ChatPhotoInfo `json:"photo"` + // Chat username, by which all other information about the chat should be resolved + Username string `json:"username"` +} + +func (entity *PageBlockChatLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockChatLink + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockChatLink) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockChatLink) GetType() string { + return TypePageBlockChatLink +} + +func (*PageBlockChatLink) PageBlockType() string { + return TypePageBlockChatLink +} + +// A table +type PageBlockTable struct { + meta + // 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"` +} + +func (entity *PageBlockTable) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockTable + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockTable) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockTable) GetType() string { + return TypePageBlockTable +} + +func (*PageBlockTable) PageBlockType() string { + return TypePageBlockTable +} + +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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockTable.Cells = tmp.Cells + pageBlockTable.IsBordered = tmp.IsBordered + pageBlockTable.IsStriped = tmp.IsStriped + + fieldCaption, _ := UnmarshalRichText(tmp.Caption) + pageBlockTable.Caption = fieldCaption + + return nil +} + +// A collapsible block +type PageBlockDetails struct { + meta + // 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"` +} + +func (entity *PageBlockDetails) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockDetails + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockDetails) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockDetails) GetType() string { + return TypePageBlockDetails +} + +func (*PageBlockDetails) PageBlockType() string { + return TypePageBlockDetails +} + +func (pageBlockDetails *PageBlockDetails) UnmarshalJSON(data []byte) error { + var tmp struct { + Header json.RawMessage `json:"header"` + PageBlocks []json.RawMessage `json:"page_blocks"` + IsOpen bool `json:"is_open"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockDetails.IsOpen = tmp.IsOpen + + fieldHeader, _ := UnmarshalRichText(tmp.Header) + pageBlockDetails.Header = fieldHeader + + fieldPageBlocks, _ := UnmarshalListOfPageBlock(tmp.PageBlocks) + pageBlockDetails.PageBlocks = fieldPageBlocks + + return nil +} + +// Related articles +type PageBlockRelatedArticles struct { + meta + // Block header + Header RichText `json:"header"` + // List of related articles + Articles []*PageBlockRelatedArticle `json:"articles"` +} + +func (entity *PageBlockRelatedArticles) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockRelatedArticles + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockRelatedArticles) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockRelatedArticles) GetType() string { + return TypePageBlockRelatedArticles +} + +func (*PageBlockRelatedArticles) PageBlockType() string { + return TypePageBlockRelatedArticles +} + +func (pageBlockRelatedArticles *PageBlockRelatedArticles) UnmarshalJSON(data []byte) error { + var tmp struct { + Header json.RawMessage `json:"header"` + Articles []*PageBlockRelatedArticle `json:"articles"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockRelatedArticles.Articles = tmp.Articles + + fieldHeader, _ := UnmarshalRichText(tmp.Header) + pageBlockRelatedArticles.Header = fieldHeader + + return nil +} + +// A map +type PageBlockMap struct { + meta + // 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"` +} + +func (entity *PageBlockMap) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockMap + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockMap) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockMap) GetType() string { + return TypePageBlockMap +} + +func (*PageBlockMap) PageBlockType() string { + return TypePageBlockMap +} + +// Describes an instant view page for a web page +type WebPageInstantView struct { + meta + // Content of the web page + PageBlocks []PageBlock `json:"page_blocks"` + // Number of the instant view views; 0 if unknown + ViewCount int32 `json:"view_count"` + // Version of the instant view, currently can be 1 or 2 + Version int32 `json:"version"` + // 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"` +} + +func (entity *WebPageInstantView) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebPageInstantView + + return json.Marshal((*stub)(entity)) +} + +func (*WebPageInstantView) GetClass() string { + return ClassWebPageInstantView +} + +func (*WebPageInstantView) GetType() string { + return TypeWebPageInstantView +} + +func (webPageInstantView *WebPageInstantView) UnmarshalJSON(data []byte) error { + var tmp struct { + PageBlocks []json.RawMessage `json:"page_blocks"` + ViewCount int32 `json:"view_count"` + Version int32 `json:"version"` + IsRtl bool `json:"is_rtl"` + IsFull bool `json:"is_full"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + webPageInstantView.ViewCount = tmp.ViewCount + webPageInstantView.Version = tmp.Version + webPageInstantView.IsRtl = tmp.IsRtl + webPageInstantView.IsFull = tmp.IsFull + + fieldPageBlocks, _ := UnmarshalListOfPageBlock(tmp.PageBlocks) + webPageInstantView.PageBlocks = fieldPageBlocks + + return nil +} + +// Describes a web page preview +type WebPage struct { + meta + // 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 *FormattedText `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"` +} + +func (entity *WebPage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebPage + + return json.Marshal((*stub)(entity)) +} + +func (*WebPage) GetClass() string { + return ClassWebPage +} + +func (*WebPage) GetType() string { + return TypeWebPage +} + +// Contains information about a country +type CountryInfo struct { + meta + // A two-letter ISO 3166-1 alpha-2 country code + CountryCode string `json:"country_code"` + // Native name of the country + Name string `json:"name"` + // English name of the country + EnglishName string `json:"english_name"` + // True, if the country should be hidden from the list of all countries + IsHidden bool `json:"is_hidden"` + // List of country calling codes + CallingCodes []string `json:"calling_codes"` +} + +func (entity *CountryInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CountryInfo + + return json.Marshal((*stub)(entity)) +} + +func (*CountryInfo) GetClass() string { + return ClassCountryInfo +} + +func (*CountryInfo) GetType() string { + return TypeCountryInfo +} + +// Contains information about countries +type Countries struct { + meta + // The list of countries + Countries []*CountryInfo `json:"countries"` +} + +func (entity *Countries) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Countries + + return json.Marshal((*stub)(entity)) +} + +func (*Countries) GetClass() string { + return ClassCountries +} + +func (*Countries) GetType() string { + return TypeCountries +} + +// Contains information about a phone number +type PhoneNumberInfo struct { + meta + // Information about the country to which the phone number belongs; may be null + Country *CountryInfo `json:"country"` + // The part of the phone number denoting country calling code or its part + CountryCallingCode string `json:"country_calling_code"` + // The phone number without country calling code formatted accordingly to local rules + FormattedPhoneNumber string `json:"formatted_phone_number"` +} + +func (entity *PhoneNumberInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PhoneNumberInfo + + return json.Marshal((*stub)(entity)) +} + +func (*PhoneNumberInfo) GetClass() string { + return ClassPhoneNumberInfo +} + +func (*PhoneNumberInfo) GetType() string { + return TypePhoneNumberInfo +} + +// Describes an action associated with a bank card number +type BankCardActionOpenUrl struct { + meta + // Action text + Text string `json:"text"` + // The URL to be opened + Url string `json:"url"` +} + +func (entity *BankCardActionOpenUrl) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BankCardActionOpenUrl + + return json.Marshal((*stub)(entity)) +} + +func (*BankCardActionOpenUrl) GetClass() string { + return ClassBankCardActionOpenUrl +} + +func (*BankCardActionOpenUrl) GetType() string { + return TypeBankCardActionOpenUrl +} + +// Information about a bank card +type BankCardInfo struct { + meta + // Title of the bank card description + Title string `json:"title"` + // Actions that can be done with the bank card number + Actions []*BankCardActionOpenUrl `json:"actions"` +} + +func (entity *BankCardInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BankCardInfo + + return json.Marshal((*stub)(entity)) +} + +func (*BankCardInfo) GetClass() string { + return ClassBankCardInfo +} + +func (*BankCardInfo) GetType() string { + return TypeBankCardInfo +} + +// Describes an address +type Address struct { + meta + // 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"` +} + +func (entity *Address) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Address + + return json.Marshal((*stub)(entity)) +} + +func (*Address) GetClass() string { + return ClassAddress +} + +func (*Address) GetType() string { + return TypeAddress +} + +// Portion of the price of a product (e.g., "delivery cost", "tax amount") +type LabeledPricePart struct { + meta + // Label for this portion of the product price + Label string `json:"label"` + // Currency amount in minimal quantity of the currency + Amount int64 `json:"amount"` +} + +func (entity *LabeledPricePart) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LabeledPricePart + + return json.Marshal((*stub)(entity)) +} + +func (*LabeledPricePart) GetClass() string { + return ClassLabeledPricePart +} + +func (*LabeledPricePart) GetType() string { + return TypeLabeledPricePart +} + +// Product invoice +type Invoice struct { + meta + // 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"` +} + +func (entity *Invoice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Invoice + + return json.Marshal((*stub)(entity)) +} + +func (*Invoice) GetClass() string { + return ClassInvoice +} + +func (*Invoice) GetType() string { + return TypeInvoice +} + +// Order information +type OrderInfo struct { + meta + // 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"` +} + +func (entity *OrderInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub OrderInfo + + return json.Marshal((*stub)(entity)) +} + +func (*OrderInfo) GetClass() string { + return ClassOrderInfo +} + +func (*OrderInfo) GetType() string { + return TypeOrderInfo +} + +// One shipping option +type ShippingOption struct { + meta + // 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"` +} + +func (entity *ShippingOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ShippingOption + + return json.Marshal((*stub)(entity)) +} + +func (*ShippingOption) GetClass() string { + return ClassShippingOption +} + +func (*ShippingOption) GetType() string { + return TypeShippingOption +} + +// Contains information about saved card credentials +type SavedCredentials struct { + meta + // Unique identifier of the saved credentials + Id string `json:"id"` + // Title of the saved credentials + Title string `json:"title"` +} + +func (entity *SavedCredentials) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedCredentials + + return json.Marshal((*stub)(entity)) +} + +func (*SavedCredentials) GetClass() string { + return ClassSavedCredentials +} + +func (*SavedCredentials) GetType() string { + return TypeSavedCredentials +} + +// 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 { + meta + // Identifier of the saved credentials + SavedCredentialsId string `json:"saved_credentials_id"` +} + +func (entity *InputCredentialsSaved) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputCredentialsSaved + + return json.Marshal((*stub)(entity)) +} + +func (*InputCredentialsSaved) GetClass() string { + return ClassInputCredentials +} + +func (*InputCredentialsSaved) GetType() string { + return TypeInputCredentialsSaved +} + +func (*InputCredentialsSaved) InputCredentialsType() string { + return TypeInputCredentialsSaved +} + +// Applies if a user enters new credentials on a payment provider website +type InputCredentialsNew struct { + meta + // 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"` +} + +func (entity *InputCredentialsNew) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputCredentialsNew + + return json.Marshal((*stub)(entity)) +} + +func (*InputCredentialsNew) GetClass() string { + return ClassInputCredentials +} + +func (*InputCredentialsNew) GetType() string { + return TypeInputCredentialsNew +} + +func (*InputCredentialsNew) InputCredentialsType() string { + return TypeInputCredentialsNew +} + +// Applies if a user enters new credentials using Android Pay +type InputCredentialsAndroidPay struct { + meta + // JSON-encoded data with the credential identifier + Data string `json:"data"` +} + +func (entity *InputCredentialsAndroidPay) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputCredentialsAndroidPay + + return json.Marshal((*stub)(entity)) +} + +func (*InputCredentialsAndroidPay) GetClass() string { + return ClassInputCredentials +} + +func (*InputCredentialsAndroidPay) GetType() string { + return TypeInputCredentialsAndroidPay +} + +func (*InputCredentialsAndroidPay) InputCredentialsType() string { + return TypeInputCredentialsAndroidPay +} + +// Applies if a user enters new credentials using Apple Pay +type InputCredentialsApplePay struct { + meta + // JSON-encoded data with the credential identifier + Data string `json:"data"` +} + +func (entity *InputCredentialsApplePay) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputCredentialsApplePay + + return json.Marshal((*stub)(entity)) +} + +func (*InputCredentialsApplePay) GetClass() string { + return ClassInputCredentials +} + +func (*InputCredentialsApplePay) GetType() string { + return TypeInputCredentialsApplePay +} + +func (*InputCredentialsApplePay) InputCredentialsType() string { + return TypeInputCredentialsApplePay +} + +// Stripe payment provider +type PaymentsProviderStripe struct { + meta + // 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"` +} + +func (entity *PaymentsProviderStripe) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentsProviderStripe + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentsProviderStripe) GetClass() string { + return ClassPaymentsProviderStripe +} + +func (*PaymentsProviderStripe) GetType() string { + return TypePaymentsProviderStripe +} + +// Contains information about an invoice payment form +type PaymentForm struct { + meta + // 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"` +} + +func (entity *PaymentForm) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentForm + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentForm) GetClass() string { + return ClassPaymentForm +} + +func (*PaymentForm) GetType() string { + return TypePaymentForm +} + +// Contains a temporary identifier of validated order information, which is stored for one hour. Also contains the available shipping options +type ValidatedOrderInfo struct { + meta + // Temporary identifier of the order information + OrderInfoId string `json:"order_info_id"` + // Available shipping options + ShippingOptions []*ShippingOption `json:"shipping_options"` +} + +func (entity *ValidatedOrderInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ValidatedOrderInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ValidatedOrderInfo) GetClass() string { + return ClassValidatedOrderInfo +} + +func (*ValidatedOrderInfo) GetType() string { + return TypeValidatedOrderInfo +} + +// Contains the result of a payment request +type PaymentResult struct { + meta + // 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"` +} + +func (entity *PaymentResult) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentResult + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentResult) GetClass() string { + return ClassPaymentResult +} + +func (*PaymentResult) GetType() string { + return TypePaymentResult +} + +// Contains information about a successful payment +type PaymentReceipt struct { + meta + // 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"` +} + +func (entity *PaymentReceipt) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentReceipt + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentReceipt) GetClass() string { + return ClassPaymentReceipt +} + +func (*PaymentReceipt) GetType() string { + return TypePaymentReceipt +} + +// File with the date it was uploaded +type DatedFile struct { + meta + // The file + File *File `json:"file"` + // Point in time (Unix timestamp) when the file was uploaded + Date int32 `json:"date"` +} + +func (entity *DatedFile) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DatedFile + + return json.Marshal((*stub)(entity)) +} + +func (*DatedFile) GetClass() string { + return ClassDatedFile +} + +func (*DatedFile) GetType() string { + return TypeDatedFile +} + +// A Telegram Passport element containing the user's personal details +type PassportElementTypePersonalDetails struct { + meta +} + +func (entity *PassportElementTypePersonalDetails) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypePersonalDetails + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypePersonalDetails) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypePersonalDetails) GetType() string { + return TypePassportElementTypePersonalDetails +} + +func (*PassportElementTypePersonalDetails) PassportElementTypeType() string { + return TypePassportElementTypePersonalDetails +} + +// A Telegram Passport element containing the user's passport +type PassportElementTypePassport struct { + meta +} + +func (entity *PassportElementTypePassport) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypePassport + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypePassport) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypePassport) GetType() string { + return TypePassportElementTypePassport +} + +func (*PassportElementTypePassport) PassportElementTypeType() string { + return TypePassportElementTypePassport +} + +// A Telegram Passport element containing the user's driver license +type PassportElementTypeDriverLicense struct { + meta +} + +func (entity *PassportElementTypeDriverLicense) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypeDriverLicense + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypeDriverLicense) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypeDriverLicense) GetType() string { + return TypePassportElementTypeDriverLicense +} + +func (*PassportElementTypeDriverLicense) PassportElementTypeType() string { + return TypePassportElementTypeDriverLicense +} + +// A Telegram Passport element containing the user's identity card +type PassportElementTypeIdentityCard struct { + meta +} + +func (entity *PassportElementTypeIdentityCard) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypeIdentityCard + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypeIdentityCard) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypeIdentityCard) GetType() string { + return TypePassportElementTypeIdentityCard +} + +func (*PassportElementTypeIdentityCard) PassportElementTypeType() string { + return TypePassportElementTypeIdentityCard +} + +// A Telegram Passport element containing the user's internal passport +type PassportElementTypeInternalPassport struct { + meta +} + +func (entity *PassportElementTypeInternalPassport) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypeInternalPassport + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypeInternalPassport) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypeInternalPassport) GetType() string { + return TypePassportElementTypeInternalPassport +} + +func (*PassportElementTypeInternalPassport) PassportElementTypeType() string { + return TypePassportElementTypeInternalPassport +} + +// A Telegram Passport element containing the user's address +type PassportElementTypeAddress struct { + meta +} + +func (entity *PassportElementTypeAddress) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypeAddress + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypeAddress) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypeAddress) GetType() string { + return TypePassportElementTypeAddress +} + +func (*PassportElementTypeAddress) PassportElementTypeType() string { + return TypePassportElementTypeAddress +} + +// A Telegram Passport element containing the user's utility bill +type PassportElementTypeUtilityBill struct { + meta +} + +func (entity *PassportElementTypeUtilityBill) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypeUtilityBill + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypeUtilityBill) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypeUtilityBill) GetType() string { + return TypePassportElementTypeUtilityBill +} + +func (*PassportElementTypeUtilityBill) PassportElementTypeType() string { + return TypePassportElementTypeUtilityBill +} + +// A Telegram Passport element containing the user's bank statement +type PassportElementTypeBankStatement struct { + meta +} + +func (entity *PassportElementTypeBankStatement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypeBankStatement + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypeBankStatement) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypeBankStatement) GetType() string { + return TypePassportElementTypeBankStatement +} + +func (*PassportElementTypeBankStatement) PassportElementTypeType() string { + return TypePassportElementTypeBankStatement +} + +// A Telegram Passport element containing the user's rental agreement +type PassportElementTypeRentalAgreement struct { + meta +} + +func (entity *PassportElementTypeRentalAgreement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypeRentalAgreement + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypeRentalAgreement) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypeRentalAgreement) GetType() string { + return TypePassportElementTypeRentalAgreement +} + +func (*PassportElementTypeRentalAgreement) PassportElementTypeType() string { + return TypePassportElementTypeRentalAgreement +} + +// A Telegram Passport element containing the registration page of the user's passport +type PassportElementTypePassportRegistration struct { + meta +} + +func (entity *PassportElementTypePassportRegistration) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypePassportRegistration + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypePassportRegistration) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypePassportRegistration) GetType() string { + return TypePassportElementTypePassportRegistration +} + +func (*PassportElementTypePassportRegistration) PassportElementTypeType() string { + return TypePassportElementTypePassportRegistration +} + +// A Telegram Passport element containing the user's temporary registration +type PassportElementTypeTemporaryRegistration struct { + meta +} + +func (entity *PassportElementTypeTemporaryRegistration) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypeTemporaryRegistration + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypeTemporaryRegistration) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypeTemporaryRegistration) GetType() string { + return TypePassportElementTypeTemporaryRegistration +} + +func (*PassportElementTypeTemporaryRegistration) PassportElementTypeType() string { + return TypePassportElementTypeTemporaryRegistration +} + +// A Telegram Passport element containing the user's phone number +type PassportElementTypePhoneNumber struct { + meta +} + +func (entity *PassportElementTypePhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypePhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypePhoneNumber) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypePhoneNumber) GetType() string { + return TypePassportElementTypePhoneNumber +} + +func (*PassportElementTypePhoneNumber) PassportElementTypeType() string { + return TypePassportElementTypePhoneNumber +} + +// A Telegram Passport element containing the user's email address +type PassportElementTypeEmailAddress struct { + meta +} + +func (entity *PassportElementTypeEmailAddress) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTypeEmailAddress + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTypeEmailAddress) GetClass() string { + return ClassPassportElementType +} + +func (*PassportElementTypeEmailAddress) GetType() string { + return TypePassportElementTypeEmailAddress +} + +func (*PassportElementTypeEmailAddress) PassportElementTypeType() string { + return TypePassportElementTypeEmailAddress +} + +// Represents a date according to the Gregorian calendar +type Date struct { + meta + // Day of the month, 1-31 + Day int32 `json:"day"` + // Month, 1-12 + Month int32 `json:"month"` + // Year, 1-9999 + Year int32 `json:"year"` +} + +func (entity *Date) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Date + + return json.Marshal((*stub)(entity)) +} + +func (*Date) GetClass() string { + return ClassDate +} + +func (*Date) GetType() string { + return TypeDate +} + +// Contains the user's personal details +type PersonalDetails struct { + meta + // 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"` +} + +func (entity *PersonalDetails) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PersonalDetails + + return json.Marshal((*stub)(entity)) +} + +func (*PersonalDetails) GetClass() string { + return ClassPersonalDetails +} + +func (*PersonalDetails) GetType() string { + return TypePersonalDetails +} + +// An identity document +type IdentityDocument struct { + meta + // 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"` +} + +func (entity *IdentityDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub IdentityDocument + + return json.Marshal((*stub)(entity)) +} + +func (*IdentityDocument) GetClass() string { + return ClassIdentityDocument +} + +func (*IdentityDocument) GetType() string { + return TypeIdentityDocument +} + +// An identity document to be saved to Telegram Passport +type InputIdentityDocument struct { + meta + // 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"` +} + +func (entity *InputIdentityDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputIdentityDocument + + return json.Marshal((*stub)(entity)) +} + +func (*InputIdentityDocument) GetClass() string { + return ClassInputIdentityDocument +} + +func (*InputIdentityDocument) GetType() string { + return TypeInputIdentityDocument +} + +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 []json.RawMessage `json:"translation"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputIdentityDocument.Number = tmp.Number + inputIdentityDocument.ExpiryDate = tmp.ExpiryDate + + fieldFrontSide, _ := UnmarshalInputFile(tmp.FrontSide) + inputIdentityDocument.FrontSide = fieldFrontSide + + fieldReverseSide, _ := UnmarshalInputFile(tmp.ReverseSide) + inputIdentityDocument.ReverseSide = fieldReverseSide + + fieldSelfie, _ := UnmarshalInputFile(tmp.Selfie) + inputIdentityDocument.Selfie = fieldSelfie + + fieldTranslation, _ := UnmarshalListOfInputFile(tmp.Translation) + inputIdentityDocument.Translation = fieldTranslation + + return nil +} + +// A personal document, containing some information about a user +type PersonalDocument struct { + meta + // 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"` +} + +func (entity *PersonalDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PersonalDocument + + return json.Marshal((*stub)(entity)) +} + +func (*PersonalDocument) GetClass() string { + return ClassPersonalDocument +} + +func (*PersonalDocument) GetType() string { + return TypePersonalDocument +} + +// A personal document to be saved to Telegram Passport +type InputPersonalDocument struct { + meta + // 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"` +} + +func (entity *InputPersonalDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPersonalDocument + + return json.Marshal((*stub)(entity)) +} + +func (*InputPersonalDocument) GetClass() string { + return ClassInputPersonalDocument +} + +func (*InputPersonalDocument) GetType() string { + return TypeInputPersonalDocument +} + +func (inputPersonalDocument *InputPersonalDocument) UnmarshalJSON(data []byte) error { + var tmp struct { + Files []json.RawMessage `json:"files"` + Translation []json.RawMessage `json:"translation"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldFiles, _ := UnmarshalListOfInputFile(tmp.Files) + inputPersonalDocument.Files = fieldFiles + + fieldTranslation, _ := UnmarshalListOfInputFile(tmp.Translation) + inputPersonalDocument.Translation = fieldTranslation + + return nil +} + +// A Telegram Passport element containing the user's personal details +type PassportElementPersonalDetails struct { + meta + // Personal details of the user + PersonalDetails *PersonalDetails `json:"personal_details"` +} + +func (entity *PassportElementPersonalDetails) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementPersonalDetails + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementPersonalDetails) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementPersonalDetails) GetType() string { + return TypePassportElementPersonalDetails +} + +func (*PassportElementPersonalDetails) PassportElementType() string { + return TypePassportElementPersonalDetails +} + +// A Telegram Passport element containing the user's passport +type PassportElementPassport struct { + meta + // Passport + Passport *IdentityDocument `json:"passport"` +} + +func (entity *PassportElementPassport) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementPassport + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementPassport) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementPassport) GetType() string { + return TypePassportElementPassport +} + +func (*PassportElementPassport) PassportElementType() string { + return TypePassportElementPassport +} + +// A Telegram Passport element containing the user's driver license +type PassportElementDriverLicense struct { + meta + // Driver license + DriverLicense *IdentityDocument `json:"driver_license"` +} + +func (entity *PassportElementDriverLicense) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementDriverLicense + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementDriverLicense) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementDriverLicense) GetType() string { + return TypePassportElementDriverLicense +} + +func (*PassportElementDriverLicense) PassportElementType() string { + return TypePassportElementDriverLicense +} + +// A Telegram Passport element containing the user's identity card +type PassportElementIdentityCard struct { + meta + // Identity card + IdentityCard *IdentityDocument `json:"identity_card"` +} + +func (entity *PassportElementIdentityCard) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementIdentityCard + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementIdentityCard) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementIdentityCard) GetType() string { + return TypePassportElementIdentityCard +} + +func (*PassportElementIdentityCard) PassportElementType() string { + return TypePassportElementIdentityCard +} + +// A Telegram Passport element containing the user's internal passport +type PassportElementInternalPassport struct { + meta + // Internal passport + InternalPassport *IdentityDocument `json:"internal_passport"` +} + +func (entity *PassportElementInternalPassport) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementInternalPassport + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementInternalPassport) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementInternalPassport) GetType() string { + return TypePassportElementInternalPassport +} + +func (*PassportElementInternalPassport) PassportElementType() string { + return TypePassportElementInternalPassport +} + +// A Telegram Passport element containing the user's address +type PassportElementAddress struct { + meta + // Address + Address *Address `json:"address"` +} + +func (entity *PassportElementAddress) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementAddress + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementAddress) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementAddress) GetType() string { + return TypePassportElementAddress +} + +func (*PassportElementAddress) PassportElementType() string { + return TypePassportElementAddress +} + +// A Telegram Passport element containing the user's utility bill +type PassportElementUtilityBill struct { + meta + // Utility bill + UtilityBill *PersonalDocument `json:"utility_bill"` +} + +func (entity *PassportElementUtilityBill) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementUtilityBill + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementUtilityBill) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementUtilityBill) GetType() string { + return TypePassportElementUtilityBill +} + +func (*PassportElementUtilityBill) PassportElementType() string { + return TypePassportElementUtilityBill +} + +// A Telegram Passport element containing the user's bank statement +type PassportElementBankStatement struct { + meta + // Bank statement + BankStatement *PersonalDocument `json:"bank_statement"` +} + +func (entity *PassportElementBankStatement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementBankStatement + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementBankStatement) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementBankStatement) GetType() string { + return TypePassportElementBankStatement +} + +func (*PassportElementBankStatement) PassportElementType() string { + return TypePassportElementBankStatement +} + +// A Telegram Passport element containing the user's rental agreement +type PassportElementRentalAgreement struct { + meta + // Rental agreement + RentalAgreement *PersonalDocument `json:"rental_agreement"` +} + +func (entity *PassportElementRentalAgreement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementRentalAgreement + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementRentalAgreement) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementRentalAgreement) GetType() string { + return TypePassportElementRentalAgreement +} + +func (*PassportElementRentalAgreement) PassportElementType() string { + return TypePassportElementRentalAgreement +} + +// A Telegram Passport element containing the user's passport registration pages +type PassportElementPassportRegistration struct { + meta + // Passport registration pages + PassportRegistration *PersonalDocument `json:"passport_registration"` +} + +func (entity *PassportElementPassportRegistration) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementPassportRegistration + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementPassportRegistration) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementPassportRegistration) GetType() string { + return TypePassportElementPassportRegistration +} + +func (*PassportElementPassportRegistration) PassportElementType() string { + return TypePassportElementPassportRegistration +} + +// A Telegram Passport element containing the user's temporary registration +type PassportElementTemporaryRegistration struct { + meta + // Temporary registration + TemporaryRegistration *PersonalDocument `json:"temporary_registration"` +} + +func (entity *PassportElementTemporaryRegistration) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementTemporaryRegistration + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementTemporaryRegistration) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementTemporaryRegistration) GetType() string { + return TypePassportElementTemporaryRegistration +} + +func (*PassportElementTemporaryRegistration) PassportElementType() string { + return TypePassportElementTemporaryRegistration +} + +// A Telegram Passport element containing the user's phone number +type PassportElementPhoneNumber struct { + meta + // Phone number + PhoneNumber string `json:"phone_number"` +} + +func (entity *PassportElementPhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementPhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementPhoneNumber) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementPhoneNumber) GetType() string { + return TypePassportElementPhoneNumber +} + +func (*PassportElementPhoneNumber) PassportElementType() string { + return TypePassportElementPhoneNumber +} + +// A Telegram Passport element containing the user's email address +type PassportElementEmailAddress struct { + meta + // Email address + EmailAddress string `json:"email_address"` +} + +func (entity *PassportElementEmailAddress) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementEmailAddress + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementEmailAddress) GetClass() string { + return ClassPassportElement +} + +func (*PassportElementEmailAddress) GetType() string { + return TypePassportElementEmailAddress +} + +func (*PassportElementEmailAddress) PassportElementType() string { + return TypePassportElementEmailAddress +} + +// A Telegram Passport element to be saved containing the user's personal details +type InputPassportElementPersonalDetails struct { + meta + // Personal details of the user + PersonalDetails *PersonalDetails `json:"personal_details"` +} + +func (entity *InputPassportElementPersonalDetails) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementPersonalDetails + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementPersonalDetails) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementPersonalDetails) GetType() string { + return TypeInputPassportElementPersonalDetails +} + +func (*InputPassportElementPersonalDetails) InputPassportElementType() string { + return TypeInputPassportElementPersonalDetails +} + +// A Telegram Passport element to be saved containing the user's passport +type InputPassportElementPassport struct { + meta + // The passport to be saved + Passport *InputIdentityDocument `json:"passport"` +} + +func (entity *InputPassportElementPassport) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementPassport + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementPassport) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementPassport) GetType() string { + return TypeInputPassportElementPassport +} + +func (*InputPassportElementPassport) InputPassportElementType() string { + return TypeInputPassportElementPassport +} + +// A Telegram Passport element to be saved containing the user's driver license +type InputPassportElementDriverLicense struct { + meta + // The driver license to be saved + DriverLicense *InputIdentityDocument `json:"driver_license"` +} + +func (entity *InputPassportElementDriverLicense) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementDriverLicense + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementDriverLicense) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementDriverLicense) GetType() string { + return TypeInputPassportElementDriverLicense +} + +func (*InputPassportElementDriverLicense) InputPassportElementType() string { + return TypeInputPassportElementDriverLicense +} + +// A Telegram Passport element to be saved containing the user's identity card +type InputPassportElementIdentityCard struct { + meta + // The identity card to be saved + IdentityCard *InputIdentityDocument `json:"identity_card"` +} + +func (entity *InputPassportElementIdentityCard) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementIdentityCard + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementIdentityCard) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementIdentityCard) GetType() string { + return TypeInputPassportElementIdentityCard +} + +func (*InputPassportElementIdentityCard) InputPassportElementType() string { + return TypeInputPassportElementIdentityCard +} + +// A Telegram Passport element to be saved containing the user's internal passport +type InputPassportElementInternalPassport struct { + meta + // The internal passport to be saved + InternalPassport *InputIdentityDocument `json:"internal_passport"` +} + +func (entity *InputPassportElementInternalPassport) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementInternalPassport + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementInternalPassport) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementInternalPassport) GetType() string { + return TypeInputPassportElementInternalPassport +} + +func (*InputPassportElementInternalPassport) InputPassportElementType() string { + return TypeInputPassportElementInternalPassport +} + +// A Telegram Passport element to be saved containing the user's address +type InputPassportElementAddress struct { + meta + // The address to be saved + Address *Address `json:"address"` +} + +func (entity *InputPassportElementAddress) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementAddress + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementAddress) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementAddress) GetType() string { + return TypeInputPassportElementAddress +} + +func (*InputPassportElementAddress) InputPassportElementType() string { + return TypeInputPassportElementAddress +} + +// A Telegram Passport element to be saved containing the user's utility bill +type InputPassportElementUtilityBill struct { + meta + // The utility bill to be saved + UtilityBill *InputPersonalDocument `json:"utility_bill"` +} + +func (entity *InputPassportElementUtilityBill) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementUtilityBill + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementUtilityBill) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementUtilityBill) GetType() string { + return TypeInputPassportElementUtilityBill +} + +func (*InputPassportElementUtilityBill) InputPassportElementType() string { + return TypeInputPassportElementUtilityBill +} + +// A Telegram Passport element to be saved containing the user's bank statement +type InputPassportElementBankStatement struct { + meta + // The bank statement to be saved + BankStatement *InputPersonalDocument `json:"bank_statement"` +} + +func (entity *InputPassportElementBankStatement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementBankStatement + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementBankStatement) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementBankStatement) GetType() string { + return TypeInputPassportElementBankStatement +} + +func (*InputPassportElementBankStatement) InputPassportElementType() string { + return TypeInputPassportElementBankStatement +} + +// A Telegram Passport element to be saved containing the user's rental agreement +type InputPassportElementRentalAgreement struct { + meta + // The rental agreement to be saved + RentalAgreement *InputPersonalDocument `json:"rental_agreement"` +} + +func (entity *InputPassportElementRentalAgreement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementRentalAgreement + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementRentalAgreement) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementRentalAgreement) GetType() string { + return TypeInputPassportElementRentalAgreement +} + +func (*InputPassportElementRentalAgreement) InputPassportElementType() string { + return TypeInputPassportElementRentalAgreement +} + +// A Telegram Passport element to be saved containing the user's passport registration +type InputPassportElementPassportRegistration struct { + meta + // The passport registration page to be saved + PassportRegistration *InputPersonalDocument `json:"passport_registration"` +} + +func (entity *InputPassportElementPassportRegistration) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementPassportRegistration + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementPassportRegistration) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementPassportRegistration) GetType() string { + return TypeInputPassportElementPassportRegistration +} + +func (*InputPassportElementPassportRegistration) InputPassportElementType() string { + return TypeInputPassportElementPassportRegistration +} + +// A Telegram Passport element to be saved containing the user's temporary registration +type InputPassportElementTemporaryRegistration struct { + meta + // The temporary registration document to be saved + TemporaryRegistration *InputPersonalDocument `json:"temporary_registration"` +} + +func (entity *InputPassportElementTemporaryRegistration) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementTemporaryRegistration + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementTemporaryRegistration) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementTemporaryRegistration) GetType() string { + return TypeInputPassportElementTemporaryRegistration +} + +func (*InputPassportElementTemporaryRegistration) InputPassportElementType() string { + return TypeInputPassportElementTemporaryRegistration +} + +// A Telegram Passport element to be saved containing the user's phone number +type InputPassportElementPhoneNumber struct { + meta + // The phone number to be saved + PhoneNumber string `json:"phone_number"` +} + +func (entity *InputPassportElementPhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementPhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementPhoneNumber) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementPhoneNumber) GetType() string { + return TypeInputPassportElementPhoneNumber +} + +func (*InputPassportElementPhoneNumber) InputPassportElementType() string { + return TypeInputPassportElementPhoneNumber +} + +// 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"` +} + +func (entity *InputPassportElementEmailAddress) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementEmailAddress + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementEmailAddress) GetClass() string { + return ClassInputPassportElement +} + +func (*InputPassportElementEmailAddress) GetType() string { + return TypeInputPassportElementEmailAddress +} + +func (*InputPassportElementEmailAddress) InputPassportElementType() string { + return TypeInputPassportElementEmailAddress +} + +// Contains information about saved Telegram Passport elements +type PassportElements struct { + meta + // Telegram Passport elements + Elements []PassportElement `json:"elements"` +} + +func (entity *PassportElements) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElements + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElements) GetClass() string { + return ClassPassportElements +} + +func (*PassportElements) GetType() string { + return TypePassportElements +} + +func (passportElements *PassportElements) UnmarshalJSON(data []byte) error { + var tmp struct { + Elements []json.RawMessage `json:"elements"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldElements, _ := UnmarshalListOfPassportElement(tmp.Elements) + passportElements.Elements = fieldElements + + return nil +} + +// The element contains an error in an unspecified place. The error will be considered resolved when new data is added +type PassportElementErrorSourceUnspecified struct { + meta +} + +func (entity *PassportElementErrorSourceUnspecified) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementErrorSourceUnspecified + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementErrorSourceUnspecified) GetClass() string { + return ClassPassportElementErrorSource +} + +func (*PassportElementErrorSourceUnspecified) GetType() string { + return TypePassportElementErrorSourceUnspecified +} + +func (*PassportElementErrorSourceUnspecified) PassportElementErrorSourceType() string { + return TypePassportElementErrorSourceUnspecified +} + +// One of the data fields contains an error. The error will be considered resolved when the value of the field changes +type PassportElementErrorSourceDataField struct { + meta + // Field name + FieldName string `json:"field_name"` +} + +func (entity *PassportElementErrorSourceDataField) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementErrorSourceDataField + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementErrorSourceDataField) GetClass() string { + return ClassPassportElementErrorSource +} + +func (*PassportElementErrorSourceDataField) GetType() string { + return TypePassportElementErrorSourceDataField +} + +func (*PassportElementErrorSourceDataField) PassportElementErrorSourceType() string { + return TypePassportElementErrorSourceDataField +} + +// 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 { + meta +} + +func (entity *PassportElementErrorSourceFrontSide) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementErrorSourceFrontSide + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementErrorSourceFrontSide) GetClass() string { + return ClassPassportElementErrorSource +} + +func (*PassportElementErrorSourceFrontSide) GetType() string { + return TypePassportElementErrorSourceFrontSide +} + +func (*PassportElementErrorSourceFrontSide) PassportElementErrorSourceType() string { + return TypePassportElementErrorSourceFrontSide +} + +// 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 { + meta +} + +func (entity *PassportElementErrorSourceReverseSide) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementErrorSourceReverseSide + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementErrorSourceReverseSide) GetClass() string { + return ClassPassportElementErrorSource +} + +func (*PassportElementErrorSourceReverseSide) GetType() string { + return TypePassportElementErrorSourceReverseSide +} + +func (*PassportElementErrorSourceReverseSide) PassportElementErrorSourceType() string { + return TypePassportElementErrorSourceReverseSide +} + +// The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes +type PassportElementErrorSourceSelfie struct { + meta +} + +func (entity *PassportElementErrorSourceSelfie) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementErrorSourceSelfie + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementErrorSourceSelfie) GetClass() string { + return ClassPassportElementErrorSource +} + +func (*PassportElementErrorSourceSelfie) GetType() string { + return TypePassportElementErrorSourceSelfie +} + +func (*PassportElementErrorSourceSelfie) PassportElementErrorSourceType() string { + return TypePassportElementErrorSourceSelfie +} + +// 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 { + meta + // Index of a file with the error + FileIndex int32 `json:"file_index"` +} + +func (entity *PassportElementErrorSourceTranslationFile) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementErrorSourceTranslationFile + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementErrorSourceTranslationFile) GetClass() string { + return ClassPassportElementErrorSource +} + +func (*PassportElementErrorSourceTranslationFile) GetType() string { + return TypePassportElementErrorSourceTranslationFile +} + +func (*PassportElementErrorSourceTranslationFile) PassportElementErrorSourceType() string { + return TypePassportElementErrorSourceTranslationFile +} + +// The translation of the document contains an error. The error will be considered resolved when the list of translation files changes +type PassportElementErrorSourceTranslationFiles struct { + meta +} + +func (entity *PassportElementErrorSourceTranslationFiles) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementErrorSourceTranslationFiles + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementErrorSourceTranslationFiles) GetClass() string { + return ClassPassportElementErrorSource +} + +func (*PassportElementErrorSourceTranslationFiles) GetType() string { + return TypePassportElementErrorSourceTranslationFiles +} + +func (*PassportElementErrorSourceTranslationFiles) PassportElementErrorSourceType() string { + return TypePassportElementErrorSourceTranslationFiles +} + +// The file contains an error. The error will be considered resolved when the file changes +type PassportElementErrorSourceFile struct { + meta + // Index of a file with the error + FileIndex int32 `json:"file_index"` +} + +func (entity *PassportElementErrorSourceFile) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementErrorSourceFile + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementErrorSourceFile) GetClass() string { + return ClassPassportElementErrorSource +} + +func (*PassportElementErrorSourceFile) GetType() string { + return TypePassportElementErrorSourceFile +} + +func (*PassportElementErrorSourceFile) PassportElementErrorSourceType() string { + return TypePassportElementErrorSourceFile +} + +// The list of attached files contains an error. The error will be considered resolved when the list of files changes +type PassportElementErrorSourceFiles struct { + meta +} + +func (entity *PassportElementErrorSourceFiles) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementErrorSourceFiles + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementErrorSourceFiles) GetClass() string { + return ClassPassportElementErrorSource +} + +func (*PassportElementErrorSourceFiles) GetType() string { + return TypePassportElementErrorSourceFiles +} + +func (*PassportElementErrorSourceFiles) PassportElementErrorSourceType() string { + return TypePassportElementErrorSourceFiles +} + +// Contains the description of an error in a Telegram Passport element +type PassportElementError struct { + meta + // 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"` +} + +func (entity *PassportElementError) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementError + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementError) GetClass() string { + return ClassPassportElementError +} + +func (*PassportElementError) GetType() string { + return TypePassportElementError +} + +func (passportElementError *PassportElementError) 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 + } + + passportElementError.Message = tmp.Message + + fieldType, _ := UnmarshalPassportElementType(tmp.Type) + passportElementError.Type = fieldType + + fieldSource, _ := UnmarshalPassportElementErrorSource(tmp.Source) + passportElementError.Source = fieldSource + + return nil +} + +// Contains information about a Telegram Passport element that was requested by a service +type PassportSuitableElement struct { + meta + // 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"` +} + +func (entity *PassportSuitableElement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportSuitableElement + + return json.Marshal((*stub)(entity)) +} + +func (*PassportSuitableElement) GetClass() string { + return ClassPassportSuitableElement +} + +func (*PassportSuitableElement) GetType() string { + return TypePassportSuitableElement +} + +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 +} + +// Contains a description of the required Telegram Passport element that was requested by a service +type PassportRequiredElement struct { + meta + // List of Telegram Passport elements any of which is enough to provide + SuitableElements []*PassportSuitableElement `json:"suitable_elements"` +} + +func (entity *PassportRequiredElement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportRequiredElement + + return json.Marshal((*stub)(entity)) +} + +func (*PassportRequiredElement) GetClass() string { + return ClassPassportRequiredElement +} + +func (*PassportRequiredElement) GetType() string { + return TypePassportRequiredElement +} + +// Contains information about a Telegram Passport authorization form that was requested +type PassportAuthorizationForm struct { + meta + // Unique identifier of the authorization form + Id int32 `json:"id"` + // Information about the Telegram Passport elements that must 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"` +} + +func (entity *PassportAuthorizationForm) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportAuthorizationForm + + return json.Marshal((*stub)(entity)) +} + +func (*PassportAuthorizationForm) GetClass() string { + return ClassPassportAuthorizationForm +} + +func (*PassportAuthorizationForm) GetType() string { + return TypePassportAuthorizationForm +} + +// Contains information about a Telegram Passport elements and corresponding errors +type PassportElementsWithErrors struct { + meta + // Telegram Passport elements + Elements []PassportElement `json:"elements"` + // Errors in the elements that are already available + Errors []*PassportElementError `json:"errors"` +} + +func (entity *PassportElementsWithErrors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementsWithErrors + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementsWithErrors) GetClass() string { + return ClassPassportElementsWithErrors +} + +func (*PassportElementsWithErrors) GetType() string { + return TypePassportElementsWithErrors +} + +func (passportElementsWithErrors *PassportElementsWithErrors) UnmarshalJSON(data []byte) error { + var tmp struct { + Elements []json.RawMessage `json:"elements"` + Errors []*PassportElementError `json:"errors"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + passportElementsWithErrors.Errors = tmp.Errors + + fieldElements, _ := UnmarshalListOfPassportElement(tmp.Elements) + passportElementsWithErrors.Elements = fieldElements + + return nil +} + +// Contains encrypted Telegram Passport data credentials +type EncryptedCredentials struct { + meta + // 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"` +} + +func (entity *EncryptedCredentials) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EncryptedCredentials + + return json.Marshal((*stub)(entity)) +} + +func (*EncryptedCredentials) GetClass() string { + return ClassEncryptedCredentials +} + +func (*EncryptedCredentials) GetType() string { + return TypeEncryptedCredentials +} + +// 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"` +} + +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 { + var tmp struct { + 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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + 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 + + fieldType, _ := UnmarshalPassportElementType(tmp.Type) + encryptedPassportElement.Type = fieldType + + return nil +} + +// The element contains an error in an unspecified place. The error will be considered resolved when new data is added +type InputPassportElementErrorSourceUnspecified struct { + meta + // Current hash of the entire element + ElementHash []byte `json:"element_hash"` +} + +func (entity *InputPassportElementErrorSourceUnspecified) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementErrorSourceUnspecified + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementErrorSourceUnspecified) GetClass() string { + return ClassInputPassportElementErrorSource +} + +func (*InputPassportElementErrorSourceUnspecified) GetType() string { + return TypeInputPassportElementErrorSourceUnspecified +} + +func (*InputPassportElementErrorSourceUnspecified) InputPassportElementErrorSourceType() string { + return TypeInputPassportElementErrorSourceUnspecified +} + +// A data field contains an error. The error is considered resolved when the field's value changes +type InputPassportElementErrorSourceDataField struct { + meta + // Field name + FieldName string `json:"field_name"` + // Current data hash + DataHash []byte `json:"data_hash"` +} + +func (entity *InputPassportElementErrorSourceDataField) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementErrorSourceDataField + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementErrorSourceDataField) GetClass() string { + return ClassInputPassportElementErrorSource +} + +func (*InputPassportElementErrorSourceDataField) GetType() string { + return TypeInputPassportElementErrorSourceDataField +} + +func (*InputPassportElementErrorSourceDataField) InputPassportElementErrorSourceType() string { + return TypeInputPassportElementErrorSourceDataField +} + +// 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 { + meta + // Current hash of the file containing the front side + FileHash []byte `json:"file_hash"` +} + +func (entity *InputPassportElementErrorSourceFrontSide) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementErrorSourceFrontSide + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementErrorSourceFrontSide) GetClass() string { + return ClassInputPassportElementErrorSource +} + +func (*InputPassportElementErrorSourceFrontSide) GetType() string { + return TypeInputPassportElementErrorSourceFrontSide +} + +func (*InputPassportElementErrorSourceFrontSide) InputPassportElementErrorSourceType() string { + return TypeInputPassportElementErrorSourceFrontSide +} + +// 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 { + meta + // Current hash of the file containing the reverse side + FileHash []byte `json:"file_hash"` +} + +func (entity *InputPassportElementErrorSourceReverseSide) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementErrorSourceReverseSide + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementErrorSourceReverseSide) GetClass() string { + return ClassInputPassportElementErrorSource +} + +func (*InputPassportElementErrorSourceReverseSide) GetType() string { + return TypeInputPassportElementErrorSourceReverseSide +} + +func (*InputPassportElementErrorSourceReverseSide) InputPassportElementErrorSourceType() string { + return TypeInputPassportElementErrorSourceReverseSide +} + +// The selfie contains an error. The error is considered resolved when the file with the selfie changes +type InputPassportElementErrorSourceSelfie struct { + meta + // Current hash of the file containing the selfie + FileHash []byte `json:"file_hash"` +} + +func (entity *InputPassportElementErrorSourceSelfie) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementErrorSourceSelfie + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementErrorSourceSelfie) GetClass() string { + return ClassInputPassportElementErrorSource +} + +func (*InputPassportElementErrorSourceSelfie) GetType() string { + return TypeInputPassportElementErrorSourceSelfie +} + +func (*InputPassportElementErrorSourceSelfie) InputPassportElementErrorSourceType() string { + return TypeInputPassportElementErrorSourceSelfie +} + +// 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 { + meta + // Current hash of the file containing the translation + FileHash []byte `json:"file_hash"` +} + +func (entity *InputPassportElementErrorSourceTranslationFile) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementErrorSourceTranslationFile + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementErrorSourceTranslationFile) GetClass() string { + return ClassInputPassportElementErrorSource +} + +func (*InputPassportElementErrorSourceTranslationFile) GetType() string { + return TypeInputPassportElementErrorSourceTranslationFile +} + +func (*InputPassportElementErrorSourceTranslationFile) InputPassportElementErrorSourceType() string { + return TypeInputPassportElementErrorSourceTranslationFile +} + +// The translation of the document contains an error. The error is considered resolved when the list of files changes +type InputPassportElementErrorSourceTranslationFiles struct { + meta + // Current hashes of all files with the translation + FileHashes [][]byte `json:"file_hashes"` +} + +func (entity *InputPassportElementErrorSourceTranslationFiles) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementErrorSourceTranslationFiles + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementErrorSourceTranslationFiles) GetClass() string { + return ClassInputPassportElementErrorSource +} + +func (*InputPassportElementErrorSourceTranslationFiles) GetType() string { + return TypeInputPassportElementErrorSourceTranslationFiles +} + +func (*InputPassportElementErrorSourceTranslationFiles) InputPassportElementErrorSourceType() string { + return TypeInputPassportElementErrorSourceTranslationFiles +} + +// The file contains an error. The error is considered resolved when the file changes +type InputPassportElementErrorSourceFile struct { + meta + // Current hash of the file which has the error + FileHash []byte `json:"file_hash"` +} + +func (entity *InputPassportElementErrorSourceFile) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementErrorSourceFile + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementErrorSourceFile) GetClass() string { + return ClassInputPassportElementErrorSource +} + +func (*InputPassportElementErrorSourceFile) GetType() string { + return TypeInputPassportElementErrorSourceFile +} + +func (*InputPassportElementErrorSourceFile) InputPassportElementErrorSourceType() string { + return TypeInputPassportElementErrorSourceFile +} + +// The list of attached files contains an error. The error is considered resolved when the file list changes +type InputPassportElementErrorSourceFiles struct { + meta + // Current hashes of all attached files + FileHashes [][]byte `json:"file_hashes"` +} + +func (entity *InputPassportElementErrorSourceFiles) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementErrorSourceFiles + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementErrorSourceFiles) GetClass() string { + return ClassInputPassportElementErrorSource +} + +func (*InputPassportElementErrorSourceFiles) GetType() string { + return TypeInputPassportElementErrorSourceFiles +} + +func (*InputPassportElementErrorSourceFiles) InputPassportElementErrorSourceType() string { + return TypeInputPassportElementErrorSourceFiles +} + +// Contains the description of an error in a Telegram Passport element; for bots only +type InputPassportElementError struct { + meta + // 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"` +} + +func (entity *InputPassportElementError) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPassportElementError + + return json.Marshal((*stub)(entity)) +} + +func (*InputPassportElementError) GetClass() string { + return ClassInputPassportElementError +} + +func (*InputPassportElementError) GetType() string { + return TypeInputPassportElementError +} + +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 +} + +// A text message +type MessageText struct { + meta + // 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"` +} + +func (entity *MessageText) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageText + + return json.Marshal((*stub)(entity)) +} + +func (*MessageText) GetClass() string { + return ClassMessageContent +} + +func (*MessageText) GetType() string { + return TypeMessageText +} + +func (*MessageText) MessageContentType() string { + return TypeMessageText +} + +// An animation message (GIF-style). +type MessageAnimation struct { + meta + // The animation description + 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"` +} + +func (entity *MessageAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*MessageAnimation) GetClass() string { + return ClassMessageContent +} + +func (*MessageAnimation) GetType() string { + return TypeMessageAnimation +} + +func (*MessageAnimation) MessageContentType() string { + return TypeMessageAnimation +} + +// An audio message +type MessageAudio struct { + meta + // The audio description + Audio *Audio `json:"audio"` + // Audio caption + Caption *FormattedText `json:"caption"` +} + +func (entity *MessageAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageAudio + + return json.Marshal((*stub)(entity)) +} + +func (*MessageAudio) GetClass() string { + return ClassMessageContent +} + +func (*MessageAudio) GetType() string { + return TypeMessageAudio +} + +func (*MessageAudio) MessageContentType() string { + return TypeMessageAudio +} + +// A document message (general file) +type MessageDocument struct { + meta + // The document description + Document *Document `json:"document"` + // Document caption + Caption *FormattedText `json:"caption"` +} + +func (entity *MessageDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageDocument + + return json.Marshal((*stub)(entity)) +} + +func (*MessageDocument) GetClass() string { + return ClassMessageContent +} + +func (*MessageDocument) GetType() string { + return TypeMessageDocument +} + +func (*MessageDocument) MessageContentType() string { + return TypeMessageDocument +} + +// A photo message +type MessagePhoto struct { + meta + // The photo description + 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"` +} + +func (entity *MessagePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePhoto) GetClass() string { + return ClassMessageContent +} + +func (*MessagePhoto) GetType() string { + return TypeMessagePhoto +} + +func (*MessagePhoto) MessageContentType() string { + return TypeMessagePhoto +} + +// An expired photo message (self-destructed after TTL has elapsed) +type MessageExpiredPhoto struct { + meta +} + +func (entity *MessageExpiredPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExpiredPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExpiredPhoto) GetClass() string { + return ClassMessageContent +} + +func (*MessageExpiredPhoto) GetType() string { + return TypeMessageExpiredPhoto +} + +func (*MessageExpiredPhoto) MessageContentType() string { + return TypeMessageExpiredPhoto +} + +// A sticker message +type MessageSticker struct { + meta + // The sticker description + Sticker *Sticker `json:"sticker"` +} + +func (entity *MessageSticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSticker + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSticker) GetClass() string { + return ClassMessageContent +} + +func (*MessageSticker) GetType() string { + return TypeMessageSticker +} + +func (*MessageSticker) MessageContentType() string { + return TypeMessageSticker +} + +// A video message +type MessageVideo struct { + meta + // The video description + 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"` +} + +func (entity *MessageVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageVideo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageVideo) GetClass() string { + return ClassMessageContent +} + +func (*MessageVideo) GetType() string { + return TypeMessageVideo +} + +func (*MessageVideo) MessageContentType() string { + return TypeMessageVideo +} + +// An expired video message (self-destructed after TTL has elapsed) +type MessageExpiredVideo struct { + meta +} + +func (entity *MessageExpiredVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExpiredVideo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExpiredVideo) GetClass() string { + return ClassMessageContent +} + +func (*MessageExpiredVideo) GetType() string { + return TypeMessageExpiredVideo +} + +func (*MessageExpiredVideo) MessageContentType() string { + return TypeMessageExpiredVideo +} + +// A video note message +type MessageVideoNote struct { + meta + // The video note description + 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"` +} + +func (entity *MessageVideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageVideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*MessageVideoNote) GetClass() string { + return ClassMessageContent +} + +func (*MessageVideoNote) GetType() string { + return TypeMessageVideoNote +} + +func (*MessageVideoNote) MessageContentType() string { + return TypeMessageVideoNote +} + +// A voice note message +type MessageVoiceNote struct { + meta + // The voice note description + 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"` +} + +func (entity *MessageVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*MessageVoiceNote) GetClass() string { + return ClassMessageContent +} + +func (*MessageVoiceNote) GetType() string { + return TypeMessageVoiceNote +} + +func (*MessageVoiceNote) MessageContentType() string { + return TypeMessageVoiceNote +} + +// A message with a location +type MessageLocation struct { + meta + // The location description + Location *Location `json:"location"` + // Time relative to the message send date, for 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"` + // For live locations, a direction in which the location moves, in degrees; 1-360. If 0 the direction is unknown + Heading int32 `json:"heading"` + // For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). 0 if the notification is disabled. Available only for the message sender + ProximityAlertRadius int32 `json:"proximity_alert_radius"` +} + +func (entity *MessageLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageLocation + + return json.Marshal((*stub)(entity)) +} + +func (*MessageLocation) GetClass() string { + return ClassMessageContent +} + +func (*MessageLocation) GetType() string { + return TypeMessageLocation +} + +func (*MessageLocation) MessageContentType() string { + return TypeMessageLocation +} + +// A message with information about a venue +type MessageVenue struct { + meta + // The venue description + Venue *Venue `json:"venue"` +} + +func (entity *MessageVenue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageVenue + + return json.Marshal((*stub)(entity)) +} + +func (*MessageVenue) GetClass() string { + return ClassMessageContent +} + +func (*MessageVenue) GetType() string { + return TypeMessageVenue +} + +func (*MessageVenue) MessageContentType() string { + return TypeMessageVenue +} + +// A message with a user contact +type MessageContact struct { + meta + // The contact description + Contact *Contact `json:"contact"` +} + +func (entity *MessageContact) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageContact + + return json.Marshal((*stub)(entity)) +} + +func (*MessageContact) GetClass() string { + return ClassMessageContent +} + +func (*MessageContact) GetType() string { + return TypeMessageContact +} + +func (*MessageContact) MessageContentType() string { + return TypeMessageContact +} + +// A dice message. The dice value is randomly generated by the server +type MessageDice struct { + meta + // The animated stickers with the initial dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known + InitialState DiceStickers `json:"initial_state"` + // The animated stickers with the final dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known + FinalState DiceStickers `json:"final_state"` + // Emoji on which the dice throw animation is based + Emoji string `json:"emoji"` + // The dice value. If the value is 0, the dice don't have final state yet + Value int32 `json:"value"` + // Number of frame after which a success animation like a shower of confetti needs to be shown on updateMessageSendSucceeded + SuccessAnimationFrameNumber int32 `json:"success_animation_frame_number"` +} + +func (entity *MessageDice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageDice + + return json.Marshal((*stub)(entity)) +} + +func (*MessageDice) GetClass() string { + return ClassMessageContent +} + +func (*MessageDice) GetType() string { + return TypeMessageDice +} + +func (*MessageDice) MessageContentType() string { + return TypeMessageDice +} + +func (messageDice *MessageDice) UnmarshalJSON(data []byte) error { + var tmp struct { + InitialState json.RawMessage `json:"initial_state"` + FinalState json.RawMessage `json:"final_state"` + Emoji string `json:"emoji"` + Value int32 `json:"value"` + SuccessAnimationFrameNumber int32 `json:"success_animation_frame_number"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageDice.Emoji = tmp.Emoji + messageDice.Value = tmp.Value + messageDice.SuccessAnimationFrameNumber = tmp.SuccessAnimationFrameNumber + + fieldInitialState, _ := UnmarshalDiceStickers(tmp.InitialState) + messageDice.InitialState = fieldInitialState + + fieldFinalState, _ := UnmarshalDiceStickers(tmp.FinalState) + messageDice.FinalState = fieldFinalState + + return nil +} + +// A message with a game +type MessageGame struct { + meta + // The game description + Game *Game `json:"game"` +} + +func (entity *MessageGame) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGame + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGame) GetClass() string { + return ClassMessageContent +} + +func (*MessageGame) GetType() string { + return TypeMessageGame +} + +func (*MessageGame) MessageContentType() string { + return TypeMessageGame +} + +// A message with a poll +type MessagePoll struct { + meta + // The poll description + Poll *Poll `json:"poll"` +} + +func (entity *MessagePoll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePoll + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePoll) GetClass() string { + return ClassMessageContent +} + +func (*MessagePoll) GetType() string { + return TypeMessagePoll +} + +func (*MessagePoll) MessageContentType() string { + return TypeMessagePoll +} + +// A message with an invoice from a bot +type MessageInvoice struct { + meta + // 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"` +} + +func (entity *MessageInvoice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageInvoice + + return json.Marshal((*stub)(entity)) +} + +func (*MessageInvoice) GetClass() string { + return ClassMessageContent +} + +func (*MessageInvoice) GetType() string { + return TypeMessageInvoice +} + +func (*MessageInvoice) MessageContentType() string { + return TypeMessageInvoice +} + +// A message with information about an ended call +type MessageCall struct { + meta + // True, if the call was a video call + IsVideo bool `json:"is_video"` + // 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) { + entity.meta.Type = entity.GetType() + + type stub MessageCall + + return json.Marshal((*stub)(entity)) +} + +func (*MessageCall) GetClass() string { + return ClassMessageContent +} + +func (*MessageCall) GetType() string { + return TypeMessageCall +} + +func (*MessageCall) MessageContentType() string { + return TypeMessageCall +} + +func (messageCall *MessageCall) UnmarshalJSON(data []byte) error { + var tmp struct { + IsVideo bool `json:"is_video"` + DiscardReason json.RawMessage `json:"discard_reason"` + Duration int32 `json:"duration"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageCall.IsVideo = tmp.IsVideo + messageCall.Duration = tmp.Duration + + fieldDiscardReason, _ := UnmarshalCallDiscardReason(tmp.DiscardReason) + messageCall.DiscardReason = fieldDiscardReason + + return nil +} + +// A newly created basic group +type MessageBasicGroupChatCreate struct { + meta + // Title of the basic group + Title string `json:"title"` + // User identifiers of members in the basic group + MemberUserIds []int32 `json:"member_user_ids"` +} + +func (entity *MessageBasicGroupChatCreate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageBasicGroupChatCreate + + return json.Marshal((*stub)(entity)) +} + +func (*MessageBasicGroupChatCreate) GetClass() string { + return ClassMessageContent +} + +func (*MessageBasicGroupChatCreate) GetType() string { + return TypeMessageBasicGroupChatCreate +} + +func (*MessageBasicGroupChatCreate) MessageContentType() string { + return TypeMessageBasicGroupChatCreate +} + +// A newly created supergroup or channel +type MessageSupergroupChatCreate struct { + meta + // Title of the supergroup or channel + Title string `json:"title"` +} + +func (entity *MessageSupergroupChatCreate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSupergroupChatCreate + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSupergroupChatCreate) GetClass() string { + return ClassMessageContent +} + +func (*MessageSupergroupChatCreate) GetType() string { + return TypeMessageSupergroupChatCreate +} + +func (*MessageSupergroupChatCreate) MessageContentType() string { + return TypeMessageSupergroupChatCreate +} + +// An updated chat title +type MessageChatChangeTitle struct { + meta + // New chat title + Title string `json:"title"` +} + +func (entity *MessageChatChangeTitle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatChangeTitle + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatChangeTitle) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatChangeTitle) GetType() string { + return TypeMessageChatChangeTitle +} + +func (*MessageChatChangeTitle) MessageContentType() string { + return TypeMessageChatChangeTitle +} + +// An updated chat photo +type MessageChatChangePhoto struct { + meta + // New chat photo + Photo *ChatPhoto `json:"photo"` +} + +func (entity *MessageChatChangePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatChangePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatChangePhoto) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatChangePhoto) GetType() string { + return TypeMessageChatChangePhoto +} + +func (*MessageChatChangePhoto) MessageContentType() string { + return TypeMessageChatChangePhoto +} + +// A deleted chat photo +type MessageChatDeletePhoto struct { + meta +} + +func (entity *MessageChatDeletePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatDeletePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatDeletePhoto) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatDeletePhoto) GetType() string { + return TypeMessageChatDeletePhoto +} + +func (*MessageChatDeletePhoto) MessageContentType() string { + return TypeMessageChatDeletePhoto +} + +// New chat members were added +type MessageChatAddMembers struct { + meta + // User identifiers of the new members + MemberUserIds []int32 `json:"member_user_ids"` +} + +func (entity *MessageChatAddMembers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatAddMembers + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatAddMembers) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatAddMembers) GetType() string { + return TypeMessageChatAddMembers +} + +func (*MessageChatAddMembers) MessageContentType() string { + return TypeMessageChatAddMembers +} + +// A new member joined the chat by invite link +type MessageChatJoinByLink struct { + meta +} + +func (entity *MessageChatJoinByLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatJoinByLink + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatJoinByLink) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatJoinByLink) GetType() string { + return TypeMessageChatJoinByLink +} + +func (*MessageChatJoinByLink) MessageContentType() string { + return TypeMessageChatJoinByLink +} + +// A chat member was deleted +type MessageChatDeleteMember struct { + meta + // User identifier of the deleted chat member + UserId int32 `json:"user_id"` +} + +func (entity *MessageChatDeleteMember) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatDeleteMember + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatDeleteMember) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatDeleteMember) GetType() string { + return TypeMessageChatDeleteMember +} + +func (*MessageChatDeleteMember) MessageContentType() string { + return TypeMessageChatDeleteMember +} + +// A basic group was upgraded to a supergroup and was deactivated as the result +type MessageChatUpgradeTo struct { + meta + // Identifier of the supergroup to which the basic group was upgraded + SupergroupId int32 `json:"supergroup_id"` +} + +func (entity *MessageChatUpgradeTo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatUpgradeTo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatUpgradeTo) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatUpgradeTo) GetType() string { + return TypeMessageChatUpgradeTo +} + +func (*MessageChatUpgradeTo) MessageContentType() string { + return TypeMessageChatUpgradeTo +} + +// A supergroup has been created from a basic group +type MessageChatUpgradeFrom struct { + meta + // Title of the newly created supergroup + Title string `json:"title"` + // The identifier of the original basic group + BasicGroupId int32 `json:"basic_group_id"` +} + +func (entity *MessageChatUpgradeFrom) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatUpgradeFrom + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatUpgradeFrom) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatUpgradeFrom) GetType() string { + return TypeMessageChatUpgradeFrom +} + +func (*MessageChatUpgradeFrom) MessageContentType() string { + return TypeMessageChatUpgradeFrom +} + +// A message has been pinned +type MessagePinMessage struct { + meta + // Identifier of the pinned message, can be an identifier of a deleted message or 0 + MessageId int64 `json:"message_id"` +} + +func (entity *MessagePinMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePinMessage + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePinMessage) GetClass() string { + return ClassMessageContent +} + +func (*MessagePinMessage) GetType() string { + return TypeMessagePinMessage +} + +func (*MessagePinMessage) MessageContentType() string { + return TypeMessagePinMessage +} + +// A screenshot of a message in the chat has been taken +type MessageScreenshotTaken struct { + meta +} + +func (entity *MessageScreenshotTaken) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageScreenshotTaken + + return json.Marshal((*stub)(entity)) +} + +func (*MessageScreenshotTaken) GetClass() string { + return ClassMessageContent +} + +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 { + meta + // New TTL + Ttl int32 `json:"ttl"` +} + +func (entity *MessageChatSetTtl) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatSetTtl + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatSetTtl) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatSetTtl) GetType() string { + return TypeMessageChatSetTtl +} + +func (*MessageChatSetTtl) MessageContentType() string { + return TypeMessageChatSetTtl +} + +// 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"` +} + +func (entity *MessageCustomServiceAction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageCustomServiceAction + + return json.Marshal((*stub)(entity)) +} + +func (*MessageCustomServiceAction) GetClass() string { + return ClassMessageContent +} + +func (*MessageCustomServiceAction) GetType() string { + return TypeMessageCustomServiceAction +} + +func (*MessageCustomServiceAction) MessageContentType() string { + return TypeMessageCustomServiceAction +} + +// A new high score was achieved in a game +type MessageGameScore struct { + meta + // 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"` +} + +func (entity *MessageGameScore) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGameScore + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGameScore) GetClass() string { + return ClassMessageContent +} + +func (*MessageGameScore) GetType() string { + return TypeMessageGameScore +} + +func (*MessageGameScore) MessageContentType() string { + return TypeMessageGameScore +} + +// 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"` +} + +func (entity *MessagePaymentSuccessful) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePaymentSuccessful + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePaymentSuccessful) GetClass() string { + return ClassMessageContent +} + +func (*MessagePaymentSuccessful) GetType() string { + return TypeMessagePaymentSuccessful +} + +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) { + entity.meta.Type = entity.GetType() + + type stub MessagePaymentSuccessfulBot + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePaymentSuccessfulBot) GetClass() string { + return ClassMessageContent +} + +func (*MessagePaymentSuccessfulBot) GetType() string { + return TypeMessagePaymentSuccessfulBot +} + +func (*MessagePaymentSuccessfulBot) MessageContentType() string { + return TypeMessagePaymentSuccessfulBot +} + +// A contact has registered with Telegram +type MessageContactRegistered struct { + meta +} + +func (entity *MessageContactRegistered) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageContactRegistered + + return json.Marshal((*stub)(entity)) +} + +func (*MessageContactRegistered) GetClass() string { + return ClassMessageContent +} + +func (*MessageContactRegistered) GetType() string { + return TypeMessageContactRegistered +} + +func (*MessageContactRegistered) MessageContentType() string { + return TypeMessageContactRegistered +} + +// The current user has connected a website by logging in using Telegram Login Widget on it +type MessageWebsiteConnected struct { + meta + // Domain name of the connected website + DomainName string `json:"domain_name"` +} + +func (entity *MessageWebsiteConnected) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageWebsiteConnected + + return json.Marshal((*stub)(entity)) +} + +func (*MessageWebsiteConnected) GetClass() string { + return ClassMessageContent +} + +func (*MessageWebsiteConnected) GetType() string { + return TypeMessageWebsiteConnected +} + +func (*MessageWebsiteConnected) MessageContentType() string { + return TypeMessageWebsiteConnected +} + +// Telegram Passport data has been sent +type MessagePassportDataSent struct { + meta + // List of Telegram Passport element types sent + Types []PassportElementType `json:"types"` +} + +func (entity *MessagePassportDataSent) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePassportDataSent + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePassportDataSent) GetClass() string { + return ClassMessageContent +} + +func (*MessagePassportDataSent) GetType() string { + return TypeMessagePassportDataSent +} + +func (*MessagePassportDataSent) MessageContentType() string { + return TypeMessagePassportDataSent +} + +func (messagePassportDataSent *MessagePassportDataSent) UnmarshalJSON(data []byte) error { + var tmp struct { + Types []json.RawMessage `json:"types"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldTypes, _ := UnmarshalListOfPassportElementType(tmp.Types) + messagePassportDataSent.Types = fieldTypes + + return nil +} + +// Telegram Passport data has been received; for bots only +type MessagePassportDataReceived struct { + meta + // List of received Telegram Passport elements + Elements []*EncryptedPassportElement `json:"elements"` + // Encrypted data credentials + Credentials *EncryptedCredentials `json:"credentials"` +} + +func (entity *MessagePassportDataReceived) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePassportDataReceived + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePassportDataReceived) GetClass() string { + return ClassMessageContent +} + +func (*MessagePassportDataReceived) GetType() string { + return TypeMessagePassportDataReceived +} + +func (*MessagePassportDataReceived) MessageContentType() string { + return TypeMessagePassportDataReceived +} + +// A user in the chat came within proximity alert range +type MessageProximityAlertTriggered struct { + meta + // The user or chat, which triggered the proximity alert + Traveler MessageSender `json:"traveler"` + // The user or chat, which subscribed for the proximity alert + Watcher MessageSender `json:"watcher"` + // The distance between the users + Distance int32 `json:"distance"` +} + +func (entity *MessageProximityAlertTriggered) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageProximityAlertTriggered + + return json.Marshal((*stub)(entity)) +} + +func (*MessageProximityAlertTriggered) GetClass() string { + return ClassMessageContent +} + +func (*MessageProximityAlertTriggered) GetType() string { + return TypeMessageProximityAlertTriggered +} + +func (*MessageProximityAlertTriggered) MessageContentType() string { + return TypeMessageProximityAlertTriggered +} + +func (messageProximityAlertTriggered *MessageProximityAlertTriggered) UnmarshalJSON(data []byte) error { + var tmp struct { + Traveler json.RawMessage `json:"traveler"` + Watcher json.RawMessage `json:"watcher"` + Distance int32 `json:"distance"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageProximityAlertTriggered.Distance = tmp.Distance + + fieldTraveler, _ := UnmarshalMessageSender(tmp.Traveler) + messageProximityAlertTriggered.Traveler = fieldTraveler + + fieldWatcher, _ := UnmarshalMessageSender(tmp.Watcher) + messageProximityAlertTriggered.Watcher = fieldWatcher + + return nil +} + +// Message content that is not supported in the current TDLib version +type MessageUnsupported struct { + meta +} + +func (entity *MessageUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*MessageUnsupported) GetClass() string { + return ClassMessageContent +} + +func (*MessageUnsupported) GetType() string { + return TypeMessageUnsupported +} + +func (*MessageUnsupported) MessageContentType() string { + return TypeMessageUnsupported +} + +// A mention of a user by their username +type TextEntityTypeMention struct { + meta +} + +func (entity *TextEntityTypeMention) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeMention + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeMention) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeMention) GetType() string { + return TypeTextEntityTypeMention +} + +func (*TextEntityTypeMention) TextEntityTypeType() string { + return TypeTextEntityTypeMention +} + +// A hashtag text, beginning with "#" +type TextEntityTypeHashtag struct { + meta +} + +func (entity *TextEntityTypeHashtag) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeHashtag + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeHashtag) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeHashtag) GetType() string { + return TypeTextEntityTypeHashtag +} + +func (*TextEntityTypeHashtag) TextEntityTypeType() string { + return TypeTextEntityTypeHashtag +} + +// A cashtag text, beginning with "$" and consisting of capital english letters (i.e. "$USD") +type TextEntityTypeCashtag struct { + meta +} + +func (entity *TextEntityTypeCashtag) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeCashtag + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeCashtag) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeCashtag) GetType() string { + return TypeTextEntityTypeCashtag +} + +func (*TextEntityTypeCashtag) TextEntityTypeType() string { + return TypeTextEntityTypeCashtag +} + +// A bot command, beginning with "/". This shouldn't be highlighted if there are no bots in the chat +type TextEntityTypeBotCommand struct { + meta +} + +func (entity *TextEntityTypeBotCommand) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeBotCommand + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeBotCommand) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeBotCommand) GetType() string { + return TypeTextEntityTypeBotCommand +} + +func (*TextEntityTypeBotCommand) TextEntityTypeType() string { + return TypeTextEntityTypeBotCommand +} + +// An HTTP URL +type TextEntityTypeUrl struct { + meta +} + +func (entity *TextEntityTypeUrl) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeUrl + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeUrl) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeUrl) GetType() string { + return TypeTextEntityTypeUrl +} + +func (*TextEntityTypeUrl) TextEntityTypeType() string { + return TypeTextEntityTypeUrl +} + +// An email address +type TextEntityTypeEmailAddress struct { + meta +} + +func (entity *TextEntityTypeEmailAddress) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeEmailAddress + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeEmailAddress) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeEmailAddress) GetType() string { + return TypeTextEntityTypeEmailAddress +} + +func (*TextEntityTypeEmailAddress) TextEntityTypeType() string { + return TypeTextEntityTypeEmailAddress +} + +// A phone number +type TextEntityTypePhoneNumber struct { + meta +} + +func (entity *TextEntityTypePhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypePhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypePhoneNumber) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypePhoneNumber) GetType() string { + return TypeTextEntityTypePhoneNumber +} + +func (*TextEntityTypePhoneNumber) TextEntityTypeType() string { + return TypeTextEntityTypePhoneNumber +} + +// A bank card number. The getBankCardInfo method can be used to get information about the bank card +type TextEntityTypeBankCardNumber struct { + meta +} + +func (entity *TextEntityTypeBankCardNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeBankCardNumber + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeBankCardNumber) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeBankCardNumber) GetType() string { + return TypeTextEntityTypeBankCardNumber +} + +func (*TextEntityTypeBankCardNumber) TextEntityTypeType() string { + return TypeTextEntityTypeBankCardNumber +} + +// A bold text +type TextEntityTypeBold struct { + meta +} + +func (entity *TextEntityTypeBold) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeBold + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeBold) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeBold) GetType() string { + return TypeTextEntityTypeBold +} + +func (*TextEntityTypeBold) TextEntityTypeType() string { + return TypeTextEntityTypeBold +} + +// An italic text +type TextEntityTypeItalic struct { + meta +} + +func (entity *TextEntityTypeItalic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeItalic + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeItalic) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeItalic) GetType() string { + return TypeTextEntityTypeItalic +} + +func (*TextEntityTypeItalic) TextEntityTypeType() string { + return TypeTextEntityTypeItalic +} + +// An underlined text +type TextEntityTypeUnderline struct { + meta +} + +func (entity *TextEntityTypeUnderline) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeUnderline + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeUnderline) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeUnderline) GetType() string { + return TypeTextEntityTypeUnderline +} + +func (*TextEntityTypeUnderline) TextEntityTypeType() string { + return TypeTextEntityTypeUnderline +} + +// A strikethrough text +type TextEntityTypeStrikethrough struct { + meta +} + +func (entity *TextEntityTypeStrikethrough) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeStrikethrough + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeStrikethrough) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeStrikethrough) GetType() string { + return TypeTextEntityTypeStrikethrough +} + +func (*TextEntityTypeStrikethrough) TextEntityTypeType() string { + return TypeTextEntityTypeStrikethrough +} + +// Text that must be formatted as if inside a code HTML tag +type TextEntityTypeCode struct { + meta +} + +func (entity *TextEntityTypeCode) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeCode + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeCode) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeCode) GetType() string { + return TypeTextEntityTypeCode +} + +func (*TextEntityTypeCode) TextEntityTypeType() string { + return TypeTextEntityTypeCode +} + +// Text that must be formatted as if inside a pre HTML tag +type TextEntityTypePre struct { + meta +} + +func (entity *TextEntityTypePre) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypePre + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypePre) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypePre) GetType() string { + return TypeTextEntityTypePre +} + +func (*TextEntityTypePre) TextEntityTypeType() string { + return TypeTextEntityTypePre +} + +// Text that must be formatted as if inside pre, and code HTML tags +type TextEntityTypePreCode struct { + meta + // Programming language of the code; as defined by the sender + Language string `json:"language"` +} + +func (entity *TextEntityTypePreCode) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypePreCode + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypePreCode) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypePreCode) GetType() string { + return TypeTextEntityTypePreCode +} + +func (*TextEntityTypePreCode) TextEntityTypeType() string { + return TypeTextEntityTypePreCode +} + +// A text description shown instead of a raw URL +type TextEntityTypeTextUrl struct { + meta + // HTTP or tg:// URL to be opened when the link is clicked + Url string `json:"url"` +} + +func (entity *TextEntityTypeTextUrl) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeTextUrl + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeTextUrl) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeTextUrl) GetType() string { + return TypeTextEntityTypeTextUrl +} + +func (*TextEntityTypeTextUrl) TextEntityTypeType() string { + return TypeTextEntityTypeTextUrl +} + +// A text shows instead of a raw mention of the user (e.g., when the user has no username) +type TextEntityTypeMentionName struct { + meta + // Identifier of the mentioned user + UserId int32 `json:"user_id"` +} + +func (entity *TextEntityTypeMentionName) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeMentionName + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeMentionName) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeMentionName) GetType() string { + return TypeTextEntityTypeMentionName +} + +func (*TextEntityTypeMentionName) TextEntityTypeType() string { + return TypeTextEntityTypeMentionName +} + +// A thumbnail to be sent along with a file; must be in JPEG or WEBP format for stickers, and less than 200 KB in size +type InputThumbnail struct { + meta + // 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"` +} + +func (entity *InputThumbnail) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputThumbnail + + return json.Marshal((*stub)(entity)) +} + +func (*InputThumbnail) GetClass() string { + return ClassInputThumbnail +} + +func (*InputThumbnail) GetType() string { + return TypeInputThumbnail +} + +func (inputThumbnail *InputThumbnail) UnmarshalJSON(data []byte) error { + var tmp struct { + Thumbnail json.RawMessage `json:"thumbnail"` + Width int32 `json:"width"` + Height int32 `json:"height"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputThumbnail.Width = tmp.Width + inputThumbnail.Height = tmp.Height + + fieldThumbnail, _ := UnmarshalInputFile(tmp.Thumbnail) + inputThumbnail.Thumbnail = fieldThumbnail + + return nil +} + +// The message will be sent at the specified date +type MessageSchedulingStateSendAtDate struct { + meta + // Date the message will be sent. The date must be within 367 days in the future + SendDate int32 `json:"send_date"` +} + +func (entity *MessageSchedulingStateSendAtDate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSchedulingStateSendAtDate + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSchedulingStateSendAtDate) GetClass() string { + return ClassMessageSchedulingState +} + +func (*MessageSchedulingStateSendAtDate) GetType() string { + return TypeMessageSchedulingStateSendAtDate +} + +func (*MessageSchedulingStateSendAtDate) MessageSchedulingStateType() string { + return TypeMessageSchedulingStateSendAtDate +} + +// The message will be sent when the peer will be online. Applicable to private chats only and when the exact online status of the peer is known +type MessageSchedulingStateSendWhenOnline struct { + meta +} + +func (entity *MessageSchedulingStateSendWhenOnline) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSchedulingStateSendWhenOnline + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSchedulingStateSendWhenOnline) GetClass() string { + return ClassMessageSchedulingState +} + +func (*MessageSchedulingStateSendWhenOnline) GetType() string { + return TypeMessageSchedulingStateSendWhenOnline +} + +func (*MessageSchedulingStateSendWhenOnline) MessageSchedulingStateType() string { + return TypeMessageSchedulingStateSendWhenOnline +} + +// Options to be used when a message is sent +type MessageSendOptions struct { + meta + // Pass true to disable notification for the message + DisableNotification bool `json:"disable_notification"` + // Pass true if the message is sent from the background + FromBackground bool `json:"from_background"` + // Message scheduling state. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled + SchedulingState MessageSchedulingState `json:"scheduling_state"` +} + +func (entity *MessageSendOptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSendOptions + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSendOptions) GetClass() string { + return ClassMessageSendOptions +} + +func (*MessageSendOptions) GetType() string { + return TypeMessageSendOptions +} + +func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { + var tmp struct { + DisableNotification bool `json:"disable_notification"` + FromBackground bool `json:"from_background"` + SchedulingState json.RawMessage `json:"scheduling_state"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSendOptions.DisableNotification = tmp.DisableNotification + messageSendOptions.FromBackground = tmp.FromBackground + + fieldSchedulingState, _ := UnmarshalMessageSchedulingState(tmp.SchedulingState) + messageSendOptions.SchedulingState = fieldSchedulingState + + return nil +} + +// Options to be used when a message content is copied without a link to the original message +type MessageCopyOptions struct { + meta + // 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 replaced. Ignored if send_copy is false + ReplaceCaption bool `json:"replace_caption"` + // New message caption. Ignored if replace_caption is false + NewCaption *FormattedText `json:"new_caption"` +} + +func (entity *MessageCopyOptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageCopyOptions + + return json.Marshal((*stub)(entity)) +} + +func (*MessageCopyOptions) GetClass() string { + return ClassMessageCopyOptions +} + +func (*MessageCopyOptions) GetType() string { + return TypeMessageCopyOptions +} + +// A text message +type InputMessageText struct { + meta + // Formatted text to be sent; 1-GetOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName 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"` +} + +func (entity *InputMessageText) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageText + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageText) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageText) GetType() string { + return TypeInputMessageText +} + +func (*InputMessageText) InputMessageContentType() string { + return TypeInputMessageText +} + +// An animation message (GIF-style). +type InputMessageAnimation struct { + meta + // Animation file to be sent + Animation InputFile `json:"animation"` + // Animation thumbnail, if available + Thumbnail *InputThumbnail `json:"thumbnail"` + // File identifiers of the stickers added to the animation, if applicable + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` + // 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"` +} + +func (entity *InputMessageAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageAnimation) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageAnimation) GetType() string { + return TypeInputMessageAnimation +} + +func (*InputMessageAnimation) InputMessageContentType() string { + return TypeInputMessageAnimation +} + +func (inputMessageAnimation *InputMessageAnimation) UnmarshalJSON(data []byte) error { + var tmp struct { + Animation json.RawMessage `json:"animation"` + Thumbnail *InputThumbnail `json:"thumbnail"` + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` + Duration int32 `json:"duration"` + Width int32 `json:"width"` + Height int32 `json:"height"` + Caption *FormattedText `json:"caption"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputMessageAnimation.Thumbnail = tmp.Thumbnail + inputMessageAnimation.AddedStickerFileIds = tmp.AddedStickerFileIds + inputMessageAnimation.Duration = tmp.Duration + inputMessageAnimation.Width = tmp.Width + inputMessageAnimation.Height = tmp.Height + inputMessageAnimation.Caption = tmp.Caption + + fieldAnimation, _ := UnmarshalInputFile(tmp.Animation) + inputMessageAnimation.Animation = fieldAnimation + + return nil +} + +// An audio message +type InputMessageAudio struct { + meta + // 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"` +} + +func (entity *InputMessageAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageAudio + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageAudio) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageAudio) GetType() string { + return TypeInputMessageAudio +} + +func (*InputMessageAudio) InputMessageContentType() string { + return TypeInputMessageAudio +} + +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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputMessageAudio.AlbumCoverThumbnail = tmp.AlbumCoverThumbnail + inputMessageAudio.Duration = tmp.Duration + inputMessageAudio.Title = tmp.Title + inputMessageAudio.Performer = tmp.Performer + inputMessageAudio.Caption = tmp.Caption + + fieldAudio, _ := UnmarshalInputFile(tmp.Audio) + inputMessageAudio.Audio = fieldAudio + + return nil +} + +// A document message (general file) +type InputMessageDocument struct { + meta + // Document to be sent + Document InputFile `json:"document"` + // Document thumbnail, if available + Thumbnail *InputThumbnail `json:"thumbnail"` + // If true, automatic file type detection will be disabled and the document will be always sent as file. Always true for files sent to secret chats + DisableContentTypeDetection bool `json:"disable_content_type_detection"` + // Document caption; 0-GetOption("message_caption_length_max") characters + Caption *FormattedText `json:"caption"` +} + +func (entity *InputMessageDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageDocument + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageDocument) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageDocument) GetType() string { + return TypeInputMessageDocument +} + +func (*InputMessageDocument) InputMessageContentType() string { + return TypeInputMessageDocument +} + +func (inputMessageDocument *InputMessageDocument) UnmarshalJSON(data []byte) error { + var tmp struct { + Document json.RawMessage `json:"document"` + Thumbnail *InputThumbnail `json:"thumbnail"` + DisableContentTypeDetection bool `json:"disable_content_type_detection"` + Caption *FormattedText `json:"caption"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputMessageDocument.Thumbnail = tmp.Thumbnail + inputMessageDocument.DisableContentTypeDetection = tmp.DisableContentTypeDetection + inputMessageDocument.Caption = tmp.Caption + + fieldDocument, _ := UnmarshalInputFile(tmp.Document) + inputMessageDocument.Document = fieldDocument + + return nil +} + +// A photo message +type InputMessagePhoto struct { + meta + // 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"` +} + +func (entity *InputMessagePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessagePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessagePhoto) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessagePhoto) GetType() string { + return TypeInputMessagePhoto +} + +func (*InputMessagePhoto) InputMessageContentType() string { + return TypeInputMessagePhoto +} + +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 { + meta + // 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"` +} + +func (entity *InputMessageSticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageSticker + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageSticker) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageSticker) GetType() string { + return TypeInputMessageSticker +} + +func (*InputMessageSticker) InputMessageContentType() string { + return TypeInputMessageSticker +} + +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 { + meta + // 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"` +} + +func (entity *InputMessageVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageVideo + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageVideo) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageVideo) GetType() string { + return TypeInputMessageVideo +} + +func (*InputMessageVideo) InputMessageContentType() string { + return TypeInputMessageVideo +} + +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 { + meta + // 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"` +} + +func (entity *InputMessageVideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageVideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageVideoNote) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageVideoNote) GetType() string { + return TypeInputMessageVideoNote +} + +func (*InputMessageVideoNote) InputMessageContentType() string { + return TypeInputMessageVideoNote +} + +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 { + meta + // 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"` +} + +func (entity *InputMessageVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageVoiceNote) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageVoiceNote) GetType() string { + return TypeInputMessageVoiceNote +} + +func (*InputMessageVoiceNote) InputMessageContentType() string { + return TypeInputMessageVoiceNote +} + +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 { + meta + // Location to be sent + Location *Location `json:"location"` + // Period for which the location can be updated, in seconds; should be between 60 and 86400 for a live location and 0 otherwise + LivePeriod int32 `json:"live_period"` + // For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 if unknown + Heading int32 `json:"heading"` + // For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled. Can't be enabled in channels and Saved Messages + ProximityAlertRadius int32 `json:"proximity_alert_radius"` +} + +func (entity *InputMessageLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageLocation + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageLocation) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageLocation) GetType() string { + return TypeInputMessageLocation +} + +func (*InputMessageLocation) InputMessageContentType() string { + return TypeInputMessageLocation +} + +// A message with information about a venue +type InputMessageVenue struct { + meta + // Venue to send + Venue *Venue `json:"venue"` +} + +func (entity *InputMessageVenue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageVenue + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageVenue) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageVenue) GetType() string { + return TypeInputMessageVenue +} + +func (*InputMessageVenue) InputMessageContentType() string { + return TypeInputMessageVenue +} + +// A message containing a user contact +type InputMessageContact struct { + meta + // Contact to send + Contact *Contact `json:"contact"` +} + +func (entity *InputMessageContact) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageContact + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageContact) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageContact) GetType() string { + return TypeInputMessageContact +} + +func (*InputMessageContact) InputMessageContentType() string { + return TypeInputMessageContact +} + +// A dice message +type InputMessageDice struct { + meta + // Emoji on which the dice throw animation is based + Emoji string `json:"emoji"` + // True, if a chat message draft should be deleted + ClearDraft bool `json:"clear_draft"` +} + +func (entity *InputMessageDice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageDice + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageDice) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageDice) GetType() string { + return TypeInputMessageDice +} + +func (*InputMessageDice) InputMessageContentType() string { + return TypeInputMessageDice +} + +// A message with a game; not supported for channels or secret chats +type InputMessageGame struct { + meta + // 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"` +} + +func (entity *InputMessageGame) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageGame + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageGame) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageGame) GetType() string { + return TypeInputMessageGame +} + +func (*InputMessageGame) InputMessageContentType() string { + return TypeInputMessageGame +} + +// A message with an invoice; can be used only by bots and only in private chats +type InputMessageInvoice struct { + meta + // 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"` +} + +func (entity *InputMessageInvoice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageInvoice + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageInvoice) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageInvoice) GetType() string { + return TypeInputMessageInvoice +} + +func (*InputMessageInvoice) InputMessageContentType() string { + return TypeInputMessageInvoice +} + +// A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot +type InputMessagePoll struct { + meta + // Poll question, 1-255 characters (up to 300 characters for bots) + Question string `json:"question"` + // List of poll answer options, 2-10 strings 1-100 characters each + Options []string `json:"options"` + // True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels + IsAnonymous bool `json:"is_anonymous"` + // Type of the poll + Type PollType `json:"type"` + // Amount of time the poll will be active after creation, in seconds; for bots only + OpenPeriod int32 `json:"open_period"` + // Point in time (Unix timestamp) when the poll will be automatically closed; for bots only + CloseDate int32 `json:"close_date"` + // True, if the poll needs to be sent already closed; for bots only + IsClosed bool `json:"is_closed"` +} + +func (entity *InputMessagePoll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessagePoll + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessagePoll) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessagePoll) GetType() string { + return TypeInputMessagePoll +} + +func (*InputMessagePoll) InputMessageContentType() string { + return TypeInputMessagePoll +} + +func (inputMessagePoll *InputMessagePoll) UnmarshalJSON(data []byte) error { + var tmp struct { + Question string `json:"question"` + Options []string `json:"options"` + IsAnonymous bool `json:"is_anonymous"` + Type json.RawMessage `json:"type"` + OpenPeriod int32 `json:"open_period"` + CloseDate int32 `json:"close_date"` + IsClosed bool `json:"is_closed"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputMessagePoll.Question = tmp.Question + inputMessagePoll.Options = tmp.Options + inputMessagePoll.IsAnonymous = tmp.IsAnonymous + inputMessagePoll.OpenPeriod = tmp.OpenPeriod + inputMessagePoll.CloseDate = tmp.CloseDate + inputMessagePoll.IsClosed = tmp.IsClosed + + fieldType, _ := UnmarshalPollType(tmp.Type) + inputMessagePoll.Type = fieldType + + return nil +} + +// A forwarded message +type InputMessageForwarded struct { + meta + // 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"` + // Options to be used to copy content of the message without a link to the original message + CopyOptions *MessageCopyOptions `json:"copy_options"` +} + +func (entity *InputMessageForwarded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageForwarded + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageForwarded) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageForwarded) GetType() string { + return TypeInputMessageForwarded +} + +func (*InputMessageForwarded) InputMessageContentType() string { + return TypeInputMessageForwarded +} + +// Returns all found messages, no filter is applied +type SearchMessagesFilterEmpty struct { + meta +} + +func (entity *SearchMessagesFilterEmpty) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterEmpty + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterEmpty) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterEmpty) GetType() string { + return TypeSearchMessagesFilterEmpty +} + +func (*SearchMessagesFilterEmpty) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterEmpty +} + +// Returns only animation messages +type SearchMessagesFilterAnimation struct { + meta +} + +func (entity *SearchMessagesFilterAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterAnimation) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterAnimation) GetType() string { + return TypeSearchMessagesFilterAnimation +} + +func (*SearchMessagesFilterAnimation) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterAnimation +} + +// Returns only audio messages +type SearchMessagesFilterAudio struct { + meta +} + +func (entity *SearchMessagesFilterAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterAudio + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterAudio) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterAudio) GetType() string { + return TypeSearchMessagesFilterAudio +} + +func (*SearchMessagesFilterAudio) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterAudio +} + +// Returns only document messages +type SearchMessagesFilterDocument struct { + meta +} + +func (entity *SearchMessagesFilterDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterDocument + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterDocument) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterDocument) GetType() string { + return TypeSearchMessagesFilterDocument +} + +func (*SearchMessagesFilterDocument) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterDocument +} + +// Returns only photo messages +type SearchMessagesFilterPhoto struct { + meta +} + +func (entity *SearchMessagesFilterPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterPhoto) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterPhoto) GetType() string { + return TypeSearchMessagesFilterPhoto +} + +func (*SearchMessagesFilterPhoto) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterPhoto +} + +// Returns only video messages +type SearchMessagesFilterVideo struct { + meta +} + +func (entity *SearchMessagesFilterVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterVideo + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterVideo) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterVideo) GetType() string { + return TypeSearchMessagesFilterVideo +} + +func (*SearchMessagesFilterVideo) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterVideo +} + +// Returns only voice note messages +type SearchMessagesFilterVoiceNote struct { + meta +} + +func (entity *SearchMessagesFilterVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterVoiceNote) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterVoiceNote) GetType() string { + return TypeSearchMessagesFilterVoiceNote +} + +func (*SearchMessagesFilterVoiceNote) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterVoiceNote +} + +// Returns only photo and video messages +type SearchMessagesFilterPhotoAndVideo struct { + meta +} + +func (entity *SearchMessagesFilterPhotoAndVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterPhotoAndVideo + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterPhotoAndVideo) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterPhotoAndVideo) GetType() string { + return TypeSearchMessagesFilterPhotoAndVideo +} + +func (*SearchMessagesFilterPhotoAndVideo) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterPhotoAndVideo +} + +// Returns only messages containing URLs +type SearchMessagesFilterUrl struct { + meta +} + +func (entity *SearchMessagesFilterUrl) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterUrl + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterUrl) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterUrl) GetType() string { + return TypeSearchMessagesFilterUrl +} + +func (*SearchMessagesFilterUrl) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterUrl +} + +// Returns only messages containing chat photos +type SearchMessagesFilterChatPhoto struct { + meta +} + +func (entity *SearchMessagesFilterChatPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterChatPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterChatPhoto) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterChatPhoto) GetType() string { + return TypeSearchMessagesFilterChatPhoto +} + +func (*SearchMessagesFilterChatPhoto) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterChatPhoto +} + +// Returns only call messages +type SearchMessagesFilterCall struct { + meta +} + +func (entity *SearchMessagesFilterCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterCall + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterCall) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterCall) GetType() string { + return TypeSearchMessagesFilterCall +} + +func (*SearchMessagesFilterCall) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterCall +} + +// Returns only incoming call messages with missed/declined discard reasons +type SearchMessagesFilterMissedCall struct { + meta +} + +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, a message thread 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 +} + +// Returns only failed to send messages. This filter can be used only if the message database is used +type SearchMessagesFilterFailedToSend struct { + meta +} + +func (entity *SearchMessagesFilterFailedToSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterFailedToSend + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterFailedToSend) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterFailedToSend) GetType() string { + return TypeSearchMessagesFilterFailedToSend +} + +func (*SearchMessagesFilterFailedToSend) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterFailedToSend +} + +// Returns only pinned messages +type SearchMessagesFilterPinned struct { + meta +} + +func (entity *SearchMessagesFilterPinned) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesFilterPinned + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesFilterPinned) GetClass() string { + return ClassSearchMessagesFilter +} + +func (*SearchMessagesFilterPinned) GetType() string { + return TypeSearchMessagesFilterPinned +} + +func (*SearchMessagesFilterPinned) SearchMessagesFilterType() string { + return TypeSearchMessagesFilterPinned +} + +// 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 +} + +// Represents a list of emoji +type Emojis struct { + meta + // List of emojis + Emojis []string `json:"emojis"` +} + +func (entity *Emojis) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Emojis + + return json.Marshal((*stub)(entity)) +} + +func (*Emojis) GetClass() string { + return ClassEmojis +} + +func (*Emojis) GetType() string { + return TypeEmojis +} + +// 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"` + // Sticker set thumbnail in WEBP or TGS format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed + Thumbnail *Thumbnail `json:"thumbnail"` + // 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"` + // True, is the stickers in the set are animated + IsAnimated bool `json:"is_animated"` + // 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"` + // 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"` +} + +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"` + // Sticker set thumbnail in WEBP or TGS format with width and height 100; may be null + Thumbnail *Thumbnail `json:"thumbnail"` + // 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"` + // True, is the stickers in the set are animated + IsAnimated bool `json:"is_animated"` + // 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 application 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"` + // The minimum supported API layer; use 65 + MinLayer int32 `json:"min_layer"` + // The maximum supported API layer; use 65 + MaxLayer int32 `json:"max_layer"` + // List of supported libtgvoip versions + LibraryVersions []string `json:"library_versions"` +} + +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 +} + +// A Telegram call reflector +type CallServerTypeTelegramReflector struct { + meta + // A peer tag to be used with the reflector + PeerTag []byte `json:"peer_tag"` +} + +func (entity *CallServerTypeTelegramReflector) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallServerTypeTelegramReflector + + return json.Marshal((*stub)(entity)) +} + +func (*CallServerTypeTelegramReflector) GetClass() string { + return ClassCallServerType +} + +func (*CallServerTypeTelegramReflector) GetType() string { + return TypeCallServerTypeTelegramReflector +} + +func (*CallServerTypeTelegramReflector) CallServerTypeType() string { + return TypeCallServerTypeTelegramReflector +} + +// A WebRTC server +type CallServerTypeWebrtc struct { + meta + // Username to be used for authentication + Username string `json:"username"` + // Authentication password + Password string `json:"password"` + // True, if the server supports TURN + SupportsTurn bool `json:"supports_turn"` + // True, if the server supports STUN + SupportsStun bool `json:"supports_stun"` +} + +func (entity *CallServerTypeWebrtc) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallServerTypeWebrtc + + return json.Marshal((*stub)(entity)) +} + +func (*CallServerTypeWebrtc) GetClass() string { + return ClassCallServerType +} + +func (*CallServerTypeWebrtc) GetType() string { + return TypeCallServerTypeWebrtc +} + +func (*CallServerTypeWebrtc) CallServerTypeType() string { + return TypeCallServerTypeWebrtc +} + +// Describes a server for relaying call data +type CallServer struct { + meta + // Server identifier + Id JsonInt64 `json:"id"` + // Server IPv4 address + IpAddress string `json:"ip_address"` + // Server IPv6 address + Ipv6Address string `json:"ipv6_address"` + // Server port number + Port int32 `json:"port"` + // Server type + Type CallServerType `json:"type"` +} + +func (entity *CallServer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallServer + + return json.Marshal((*stub)(entity)) +} + +func (*CallServer) GetClass() string { + return ClassCallServer +} + +func (*CallServer) GetType() string { + return TypeCallServer +} + +func (callServer *CallServer) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + IpAddress string `json:"ip_address"` + Ipv6Address string `json:"ipv6_address"` + Port int32 `json:"port"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + callServer.Id = tmp.Id + callServer.IpAddress = tmp.IpAddress + callServer.Ipv6Address = tmp.Ipv6Address + callServer.Port = tmp.Port + + fieldType, _ := UnmarshalCallServerType(tmp.Type) + callServer.Type = fieldType + + return nil +} + +// 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"` + // List of available call servers + Servers []*CallServer `json:"servers"` + // 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 +} + +// 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 +} + +// The video was distorted +type CallProblemDistortedVideo struct { + meta +} + +func (entity *CallProblemDistortedVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallProblemDistortedVideo + + return json.Marshal((*stub)(entity)) +} + +func (*CallProblemDistortedVideo) GetClass() string { + return ClassCallProblem +} + +func (*CallProblemDistortedVideo) GetType() string { + return TypeCallProblemDistortedVideo +} + +func (*CallProblemDistortedVideo) CallProblemType() string { + return TypeCallProblemDistortedVideo +} + +// The video was pixelated +type CallProblemPixelatedVideo struct { + meta +} + +func (entity *CallProblemPixelatedVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallProblemPixelatedVideo + + return json.Marshal((*stub)(entity)) +} + +func (*CallProblemPixelatedVideo) GetClass() string { + return ClassCallProblem +} + +func (*CallProblemPixelatedVideo) GetType() string { + return TypeCallProblemPixelatedVideo +} + +func (*CallProblemPixelatedVideo) CallProblemType() string { + return TypeCallProblemPixelatedVideo +} + +// 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"` + // True, if the call is a video call + IsVideo bool `json:"is_video"` + // 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"` + IsVideo bool `json:"is_video"` + 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 + call.IsVideo = tmp.IsVideo + + fieldState, _ := UnmarshalCallState(tmp.State) + call.State = fieldState + + return nil +} + +// 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 application 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 +} + +// 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 +} + +// A regular animated sticker +type DiceStickersRegular struct { + meta + // The animated sticker with the dice animation + Sticker *Sticker `json:"sticker"` +} + +func (entity *DiceStickersRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DiceStickersRegular + + return json.Marshal((*stub)(entity)) +} + +func (*DiceStickersRegular) GetClass() string { + return ClassDiceStickers +} + +func (*DiceStickersRegular) GetType() string { + return TypeDiceStickersRegular +} + +func (*DiceStickersRegular) DiceStickersType() string { + return TypeDiceStickersRegular +} + +// Animated stickers to be combined into a slot machine +type DiceStickersSlotMachine struct { + meta + // The animated sticker with the slot machine background. The background animation must start playing after all reel animations finish + Background *Sticker `json:"background"` + // The animated sticker with the lever animation. The lever animation must play once in the initial dice state + Lever *Sticker `json:"lever"` + // The animated sticker with the left reel + LeftReel *Sticker `json:"left_reel"` + // The animated sticker with the center reel + CenterReel *Sticker `json:"center_reel"` + // The animated sticker with the right reel + RightReel *Sticker `json:"right_reel"` +} + +func (entity *DiceStickersSlotMachine) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DiceStickersSlotMachine + + return json.Marshal((*stub)(entity)) +} + +func (*DiceStickersSlotMachine) GetClass() string { + return ClassDiceStickers +} + +func (*DiceStickersSlotMachine) GetType() string { + return TypeDiceStickersSlotMachine +} + +func (*DiceStickersSlotMachine) DiceStickersType() string { + return TypeDiceStickersSlotMachine +} + +// 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 or an animated (i.e. without sound) H.264/MPEG-4 AVC video +type InputInlineQueryResultAnimation struct { + meta + // Unique identifier of the query result + Id string `json:"id"` + // Title of the query result + Title string `json:"title"` + // URL of the result thumbnail (JPEG, GIF, or MPEG4), if it exists + ThumbnailUrl string `json:"thumbnail_url"` + // MIME type of the video thumbnail. If non-empty, must be one of "image/jpeg", "image/gif" and "video/mp4" + ThumbnailMimeType string `json:"thumbnail_mime_type"` + // The URL of the video file (file size must not exceed 1MB) + VideoUrl string `json:"video_url"` + // MIME type of the video file. Must be one of "image/gif" and "video/mp4" + VideoMimeType string `json:"video_mime_type"` + // Duration of the video, in seconds + VideoDuration int32 `json:"video_duration"` + // Width of the video + VideoWidth int32 `json:"video_width"` + // Height of the video + VideoHeight int32 `json:"video_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 *InputInlineQueryResultAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputInlineQueryResultAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*InputInlineQueryResultAnimation) GetClass() string { + return ClassInputInlineQueryResult +} + +func (*InputInlineQueryResultAnimation) GetType() string { + return TypeInputInlineQueryResultAnimation +} + +func (*InputInlineQueryResultAnimation) InputInlineQueryResultType() string { + return TypeInputInlineQueryResultAnimation +} + +func (inputInlineQueryResultAnimation *InputInlineQueryResultAnimation) UnmarshalJSON(data []byte) error { + var tmp struct { + Id string `json:"id"` + Title string `json:"title"` + ThumbnailUrl string `json:"thumbnail_url"` + ThumbnailMimeType string `json:"thumbnail_mime_type"` + VideoUrl string `json:"video_url"` + VideoMimeType string `json:"video_mime_type"` + VideoDuration int32 `json:"video_duration"` + VideoWidth int32 `json:"video_width"` + VideoHeight int32 `json:"video_height"` + ReplyMarkup json.RawMessage `json:"reply_markup"` + InputMessageContent json.RawMessage `json:"input_message_content"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputInlineQueryResultAnimation.Id = tmp.Id + inputInlineQueryResultAnimation.Title = tmp.Title + inputInlineQueryResultAnimation.ThumbnailUrl = tmp.ThumbnailUrl + inputInlineQueryResultAnimation.ThumbnailMimeType = tmp.ThumbnailMimeType + inputInlineQueryResultAnimation.VideoUrl = tmp.VideoUrl + inputInlineQueryResultAnimation.VideoMimeType = tmp.VideoMimeType + inputInlineQueryResultAnimation.VideoDuration = tmp.VideoDuration + inputInlineQueryResultAnimation.VideoWidth = tmp.VideoWidth + inputInlineQueryResultAnimation.VideoHeight = tmp.VideoHeight + + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultAnimation.ReplyMarkup = fieldReplyMarkup + + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultAnimation.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 +} + +// Represents a link to a WEBP or TGS sticker +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"` + // The URL of the WEBP or TGS sticker (sticker file size must not exceed 5MB) + 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) { + entity.meta.Type = entity.GetType() + + type stub InputInlineQueryResultVideo + + return json.Marshal((*stub)(entity)) +} + +func (*InputInlineQueryResultVideo) GetClass() string { + return ClassInputInlineQueryResult +} + +func (*InputInlineQueryResultVideo) GetType() string { + return TypeInputInlineQueryResultVideo +} + +func (*InputInlineQueryResultVideo) InputInlineQueryResultType() string { + return TypeInputInlineQueryResultVideo +} + +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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + 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 + + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultVideo.ReplyMarkup = fieldReplyMarkup + + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultVideo.InputMessageContent = fieldInputMessageContent + + return nil +} + +// Represents a link to an opus-encoded audio file within an OGG container, single channel audio +type InputInlineQueryResultVoiceNote struct { + meta + // 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"` +} + +func (entity *InputInlineQueryResultVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputInlineQueryResultVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*InputInlineQueryResultVoiceNote) GetClass() string { + return ClassInputInlineQueryResult +} + +func (*InputInlineQueryResultVoiceNote) GetType() string { + return TypeInputInlineQueryResultVoiceNote +} + +func (*InputInlineQueryResultVoiceNote) InputInlineQueryResultType() string { + return TypeInputInlineQueryResultVoiceNote +} + +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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputInlineQueryResultVoiceNote.Id = tmp.Id + inputInlineQueryResultVoiceNote.Title = tmp.Title + inputInlineQueryResultVoiceNote.VoiceNoteUrl = tmp.VoiceNoteUrl + inputInlineQueryResultVoiceNote.VoiceNoteDuration = tmp.VoiceNoteDuration + + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultVoiceNote.ReplyMarkup = fieldReplyMarkup + + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultVoiceNote.InputMessageContent = fieldInputMessageContent + + return nil +} + +// Represents a link to an article or web page +type InlineQueryResultArticle 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"` + // Result thumbnail in JPEG format; may be null + Thumbnail *Thumbnail `json:"thumbnail"` +} + +func (entity *InlineQueryResultArticle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultArticle + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultArticle) GetClass() string { + return ClassInlineQueryResult +} + +func (*InlineQueryResultArticle) GetType() string { + return TypeInlineQueryResultArticle +} + +func (*InlineQueryResultArticle) InlineQueryResultType() string { + return TypeInlineQueryResultArticle +} + +// Represents a user contact +type InlineQueryResultContact struct { + meta + // Unique identifier of the query result + Id string `json:"id"` + // A user contact + Contact *Contact `json:"contact"` + // Result thumbnail in JPEG format; may be null + Thumbnail *Thumbnail `json:"thumbnail"` +} + +func (entity *InlineQueryResultContact) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultContact + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultContact) GetClass() string { + return ClassInlineQueryResult +} + +func (*InlineQueryResultContact) GetType() string { + return TypeInlineQueryResultContact +} + +func (*InlineQueryResultContact) InlineQueryResultType() string { + return TypeInlineQueryResultContact +} + +// Represents a point on the map +type InlineQueryResultLocation struct { + meta + // 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 in JPEG format; may be null + Thumbnail *Thumbnail `json:"thumbnail"` +} + +func (entity *InlineQueryResultLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultLocation + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultLocation) GetClass() string { + return ClassInlineQueryResult +} + +func (*InlineQueryResultLocation) GetType() string { + return TypeInlineQueryResultLocation +} + +func (*InlineQueryResultLocation) InlineQueryResultType() string { + return TypeInlineQueryResultLocation +} + +// Represents information about a venue +type InlineQueryResultVenue struct { + meta + // Unique identifier of the query result + Id string `json:"id"` + // Venue result + Venue *Venue `json:"venue"` + // Result thumbnail in JPEG format; may be null + Thumbnail *Thumbnail `json:"thumbnail"` +} + +func (entity *InlineQueryResultVenue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultVenue + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultVenue) GetClass() string { + return ClassInlineQueryResult +} + +func (*InlineQueryResultVenue) GetType() string { + return TypeInlineQueryResultVenue +} + +func (*InlineQueryResultVenue) InlineQueryResultType() string { + return TypeInlineQueryResultVenue +} + +// Represents information about a game +type InlineQueryResultGame struct { + meta + // Unique identifier of the query result + Id string `json:"id"` + // Game result + Game *Game `json:"game"` +} + +func (entity *InlineQueryResultGame) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultGame + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultGame) GetClass() string { + return ClassInlineQueryResult +} + +func (*InlineQueryResultGame) GetType() string { + return TypeInlineQueryResultGame +} + +func (*InlineQueryResultGame) InlineQueryResultType() string { + return TypeInlineQueryResultGame +} + +// Represents an animation file +type InlineQueryResultAnimation struct { + meta + // Unique identifier of the query result + Id string `json:"id"` + // Animation file + Animation *Animation `json:"animation"` + // Animation title + Title string `json:"title"` +} + +func (entity *InlineQueryResultAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultAnimation) GetClass() string { + return ClassInlineQueryResult +} + +func (*InlineQueryResultAnimation) GetType() string { + return TypeInlineQueryResultAnimation +} + +func (*InlineQueryResultAnimation) InlineQueryResultType() string { + return TypeInlineQueryResultAnimation +} + +// Represents an audio file +type InlineQueryResultAudio struct { + meta + // Unique identifier of the query result + Id string `json:"id"` + // Audio file + Audio *Audio `json:"audio"` +} + +func (entity *InlineQueryResultAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultAudio + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultAudio) GetClass() string { + return ClassInlineQueryResult +} + +func (*InlineQueryResultAudio) GetType() string { + return TypeInlineQueryResultAudio +} + +func (*InlineQueryResultAudio) InlineQueryResultType() string { + return TypeInlineQueryResultAudio +} + +// Represents a document +type InlineQueryResultDocument struct { + meta + // 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"` +} + +func (entity *InlineQueryResultDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultDocument + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultDocument) GetClass() string { + return ClassInlineQueryResult +} + +func (*InlineQueryResultDocument) GetType() string { + return TypeInlineQueryResultDocument +} + +func (*InlineQueryResultDocument) InlineQueryResultType() string { + return TypeInlineQueryResultDocument +} + +// Represents a photo +type InlineQueryResultPhoto struct { + meta + // 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"` +} + +func (entity *InlineQueryResultPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultPhoto) GetClass() string { + return ClassInlineQueryResult +} + +func (*InlineQueryResultPhoto) GetType() string { + return TypeInlineQueryResultPhoto +} + +func (*InlineQueryResultPhoto) InlineQueryResultType() string { + return TypeInlineQueryResultPhoto +} + +// Represents a sticker +type InlineQueryResultSticker struct { + meta + // Unique identifier of the query result + Id string `json:"id"` + // Sticker + Sticker *Sticker `json:"sticker"` +} + +func (entity *InlineQueryResultSticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultSticker + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultSticker) GetClass() string { + return ClassInlineQueryResult +} + +func (*InlineQueryResultSticker) GetType() string { + return TypeInlineQueryResultSticker +} + +func (*InlineQueryResultSticker) InlineQueryResultType() string { + return TypeInlineQueryResultSticker +} + +// Represents a video +type InlineQueryResultVideo struct { + meta + // 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"` +} + +func (entity *InlineQueryResultVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultVideo + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultVideo) GetClass() string { + return ClassInlineQueryResult +} + +func (*InlineQueryResultVideo) GetType() string { + return TypeInlineQueryResultVideo +} + +func (*InlineQueryResultVideo) InlineQueryResultType() string { + return TypeInlineQueryResultVideo +} + +// 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) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResultVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResultVoiceNote) GetClass() string { + return ClassInlineQueryResult +} + +func (*InlineQueryResultVoiceNote) GetType() string { + return TypeInlineQueryResultVoiceNote +} + +func (*InlineQueryResultVoiceNote) InlineQueryResultType() string { + return TypeInlineQueryResultVoiceNote +} + +// Represents the results of the inline query. Use sendInlineQueryResultMessage to send the result of the query +type InlineQueryResults struct { + meta + // 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"` +} + +func (entity *InlineQueryResults) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineQueryResults + + return json.Marshal((*stub)(entity)) +} + +func (*InlineQueryResults) GetClass() string { + return ClassInlineQueryResults +} + +func (*InlineQueryResults) GetType() string { + return TypeInlineQueryResults +} + +func (inlineQueryResults *InlineQueryResults) UnmarshalJSON(data []byte) error { + var tmp struct { + InlineQueryId JsonInt64 `json:"inline_query_id"` + NextOffset string `json:"next_offset"` + Results []json.RawMessage `json:"results"` + SwitchPmText string `json:"switch_pm_text"` + SwitchPmParameter string `json:"switch_pm_parameter"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inlineQueryResults.InlineQueryId = tmp.InlineQueryId + inlineQueryResults.NextOffset = tmp.NextOffset + inlineQueryResults.SwitchPmText = tmp.SwitchPmText + inlineQueryResults.SwitchPmParameter = tmp.SwitchPmParameter + + fieldResults, _ := UnmarshalListOfInlineQueryResult(tmp.Results) + inlineQueryResults.Results = fieldResults + + return nil +} + +// The payload for a general callback button +type CallbackQueryPayloadData struct { + meta + // Data that was attached to the callback button + Data []byte `json:"data"` +} + +func (entity *CallbackQueryPayloadData) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallbackQueryPayloadData + + return json.Marshal((*stub)(entity)) +} + +func (*CallbackQueryPayloadData) GetClass() string { + return ClassCallbackQueryPayload +} + +func (*CallbackQueryPayloadData) GetType() string { + return TypeCallbackQueryPayloadData +} + +func (*CallbackQueryPayloadData) CallbackQueryPayloadType() string { + return TypeCallbackQueryPayloadData +} + +// The payload for a callback button requiring password +type CallbackQueryPayloadDataWithPassword struct { + meta + // The password for the current user + Password string `json:"password"` + // Data that was attached to the callback button + Data []byte `json:"data"` +} + +func (entity *CallbackQueryPayloadDataWithPassword) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallbackQueryPayloadDataWithPassword + + return json.Marshal((*stub)(entity)) +} + +func (*CallbackQueryPayloadDataWithPassword) GetClass() string { + return ClassCallbackQueryPayload +} + +func (*CallbackQueryPayloadDataWithPassword) GetType() string { + return TypeCallbackQueryPayloadDataWithPassword +} + +func (*CallbackQueryPayloadDataWithPassword) CallbackQueryPayloadType() string { + return TypeCallbackQueryPayloadDataWithPassword +} + +// The payload for a game callback button +type CallbackQueryPayloadGame struct { + meta + // A short name of the game that was attached to the callback button + GameShortName string `json:"game_short_name"` +} + +func (entity *CallbackQueryPayloadGame) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallbackQueryPayloadGame + + return json.Marshal((*stub)(entity)) +} + +func (*CallbackQueryPayloadGame) GetClass() string { + return ClassCallbackQueryPayload +} + +func (*CallbackQueryPayloadGame) GetType() string { + return TypeCallbackQueryPayloadGame +} + +func (*CallbackQueryPayloadGame) CallbackQueryPayloadType() string { + return TypeCallbackQueryPayloadGame +} + +// 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"` +} + +func (entity *CallbackQueryAnswer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallbackQueryAnswer + + return json.Marshal((*stub)(entity)) +} + +func (*CallbackQueryAnswer) GetClass() string { + return ClassCallbackQueryAnswer +} + +func (*CallbackQueryAnswer) GetType() string { + return TypeCallbackQueryAnswer +} + +// Contains the result of a custom request +type CustomRequestResult struct { + meta + // A JSON-serialized result + Result string `json:"result"` +} + +func (entity *CustomRequestResult) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CustomRequestResult + + return json.Marshal((*stub)(entity)) +} + +func (*CustomRequestResult) GetClass() string { + return ClassCustomRequestResult +} + +func (*CustomRequestResult) GetType() string { + return TypeCustomRequestResult +} + +// 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"` +} + +func (entity *GameHighScore) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GameHighScore + + return json.Marshal((*stub)(entity)) +} + +func (*GameHighScore) GetClass() string { + return ClassGameHighScore +} + +func (*GameHighScore) GetType() string { + return TypeGameHighScore +} + +// Contains a list of game high scores +type GameHighScores struct { + meta + // A list of game high scores + Scores []*GameHighScore `json:"scores"` +} + +func (entity *GameHighScores) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GameHighScores + + return json.Marshal((*stub)(entity)) +} + +func (*GameHighScores) GetClass() string { + return ClassGameHighScores +} + +func (*GameHighScores) GetType() string { + return TypeGameHighScores +} + +// 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"` +} + +func (entity *ChatEventMessageEdited) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventMessageEdited + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventMessageEdited) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventMessageEdited) GetType() string { + return TypeChatEventMessageEdited +} + +func (*ChatEventMessageEdited) ChatEventActionType() string { + return TypeChatEventMessageEdited +} + +// A message was deleted +type ChatEventMessageDeleted struct { + meta + // Deleted message + Message *Message `json:"message"` +} + +func (entity *ChatEventMessageDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventMessageDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventMessageDeleted) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventMessageDeleted) GetType() string { + return TypeChatEventMessageDeleted +} + +func (*ChatEventMessageDeleted) ChatEventActionType() string { + return TypeChatEventMessageDeleted +} + +// 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 +} + +// A message was pinned +type ChatEventMessagePinned struct { + meta + // Pinned message + Message *Message `json:"message"` +} + +func (entity *ChatEventMessagePinned) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventMessagePinned + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventMessagePinned) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventMessagePinned) GetType() string { + return TypeChatEventMessagePinned +} + +func (*ChatEventMessagePinned) ChatEventActionType() string { + return TypeChatEventMessagePinned +} + +// A message was unpinned +type ChatEventMessageUnpinned struct { + meta + // Unpinned message + Message *Message `json:"message"` +} + +func (entity *ChatEventMessageUnpinned) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventMessageUnpinned + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventMessageUnpinned) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventMessageUnpinned) GetType() string { + return TypeChatEventMessageUnpinned +} + +func (*ChatEventMessageUnpinned) ChatEventActionType() string { + return TypeChatEventMessageUnpinned +} + +// 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 +} + +// A member left the chat +type ChatEventMemberLeft struct { + meta +} + +func (entity *ChatEventMemberLeft) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventMemberLeft + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventMemberLeft) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventMemberLeft) GetType() string { + return TypeChatEventMemberLeft +} + +func (*ChatEventMemberLeft) ChatEventActionType() string { + return TypeChatEventMemberLeft +} + +// A new chat member was invited +type ChatEventMemberInvited struct { + meta + // New member user identifier + UserId int32 `json:"user_id"` + // New member status + Status ChatMemberStatus `json:"status"` +} + +func (entity *ChatEventMemberInvited) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventMemberInvited + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventMemberInvited) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventMemberInvited) GetType() string { + return TypeChatEventMemberInvited +} + +func (*ChatEventMemberInvited) ChatEventActionType() string { + return TypeChatEventMemberInvited +} + +func (chatEventMemberInvited *ChatEventMemberInvited) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int32 `json:"user_id"` + Status json.RawMessage `json:"status"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatEventMemberInvited.UserId = tmp.UserId + + fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) + chatEventMemberInvited.Status = fieldStatus + + return nil +} + +// A chat member has gained/lost administrator status, or the list of their administrator privileges has changed +type ChatEventMemberPromoted struct { + meta + // 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"` +} + +func (entity *ChatEventMemberPromoted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventMemberPromoted + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventMemberPromoted) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventMemberPromoted) GetType() string { + return TypeChatEventMemberPromoted +} + +func (*ChatEventMemberPromoted) ChatEventActionType() string { + return TypeChatEventMemberPromoted +} + +func (chatEventMemberPromoted *ChatEventMemberPromoted) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int32 `json:"user_id"` + OldStatus json.RawMessage `json:"old_status"` + NewStatus json.RawMessage `json:"new_status"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatEventMemberPromoted.UserId = tmp.UserId + + fieldOldStatus, _ := UnmarshalChatMemberStatus(tmp.OldStatus) + chatEventMemberPromoted.OldStatus = fieldOldStatus + + fieldNewStatus, _ := UnmarshalChatMemberStatus(tmp.NewStatus) + chatEventMemberPromoted.NewStatus = fieldNewStatus + + return nil +} + +// A chat member was restricted/unrestricted or banned/unbanned, or the list of their restrictions has changed +type ChatEventMemberRestricted struct { + meta + // 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"` +} + +func (entity *ChatEventMemberRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventMemberRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventMemberRestricted) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventMemberRestricted) GetType() string { + return TypeChatEventMemberRestricted +} + +func (*ChatEventMemberRestricted) ChatEventActionType() string { + return TypeChatEventMemberRestricted +} + +func (chatEventMemberRestricted *ChatEventMemberRestricted) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int32 `json:"user_id"` + OldStatus json.RawMessage `json:"old_status"` + NewStatus json.RawMessage `json:"new_status"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatEventMemberRestricted.UserId = tmp.UserId + + fieldOldStatus, _ := UnmarshalChatMemberStatus(tmp.OldStatus) + chatEventMemberRestricted.OldStatus = fieldOldStatus + + fieldNewStatus, _ := UnmarshalChatMemberStatus(tmp.NewStatus) + chatEventMemberRestricted.NewStatus = fieldNewStatus + + return nil +} + +// The chat title was changed +type ChatEventTitleChanged struct { + meta + // Previous chat title + OldTitle string `json:"old_title"` + // New chat title + NewTitle string `json:"new_title"` +} + +func (entity *ChatEventTitleChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventTitleChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventTitleChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventTitleChanged) GetType() string { + return TypeChatEventTitleChanged +} + +func (*ChatEventTitleChanged) ChatEventActionType() string { + return TypeChatEventTitleChanged +} + +// 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 +} + +// 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"` +} + +func (entity *ChatEventDescriptionChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventDescriptionChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventDescriptionChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventDescriptionChanged) GetType() string { + return TypeChatEventDescriptionChanged +} + +func (*ChatEventDescriptionChanged) ChatEventActionType() string { + return TypeChatEventDescriptionChanged +} + +// The chat username was changed +type ChatEventUsernameChanged struct { + meta + // Previous chat username + OldUsername string `json:"old_username"` + // New chat username + NewUsername string `json:"new_username"` +} + +func (entity *ChatEventUsernameChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventUsernameChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventUsernameChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventUsernameChanged) GetType() string { + return TypeChatEventUsernameChanged +} + +func (*ChatEventUsernameChanged) ChatEventActionType() string { + return TypeChatEventUsernameChanged +} + +// The chat photo was changed +type ChatEventPhotoChanged struct { + meta + // Previous chat photo value; may be null + OldPhoto *ChatPhoto `json:"old_photo"` + // New chat photo value; may be null + NewPhoto *ChatPhoto `json:"new_photo"` +} + +func (entity *ChatEventPhotoChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventPhotoChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventPhotoChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventPhotoChanged) GetType() string { + return TypeChatEventPhotoChanged +} + +func (*ChatEventPhotoChanged) ChatEventActionType() string { + return TypeChatEventPhotoChanged +} + +// The can_invite_users permission of a supergroup chat was toggled +type ChatEventInvitesToggled struct { + meta + // New value of can_invite_users permission + CanInviteUsers bool `json:"can_invite_users"` +} + +func (entity *ChatEventInvitesToggled) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventInvitesToggled + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventInvitesToggled) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventInvitesToggled) GetType() string { + return TypeChatEventInvitesToggled +} + +func (*ChatEventInvitesToggled) ChatEventActionType() string { + return TypeChatEventInvitesToggled +} + +// The linked chat of a supergroup was changed +type ChatEventLinkedChatChanged struct { + meta + // Previous supergroup linked chat identifier + OldLinkedChatId int64 `json:"old_linked_chat_id"` + // New supergroup linked chat identifier + NewLinkedChatId int64 `json:"new_linked_chat_id"` +} + +func (entity *ChatEventLinkedChatChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventLinkedChatChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventLinkedChatChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventLinkedChatChanged) GetType() string { + return TypeChatEventLinkedChatChanged +} + +func (*ChatEventLinkedChatChanged) ChatEventActionType() string { + return TypeChatEventLinkedChatChanged +} + +// The slow_mode_delay setting of a supergroup was changed +type ChatEventSlowModeDelayChanged struct { + meta + // Previous value of slow_mode_delay + OldSlowModeDelay int32 `json:"old_slow_mode_delay"` + // New value of slow_mode_delay + NewSlowModeDelay int32 `json:"new_slow_mode_delay"` +} + +func (entity *ChatEventSlowModeDelayChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventSlowModeDelayChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventSlowModeDelayChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventSlowModeDelayChanged) GetType() string { + return TypeChatEventSlowModeDelayChanged +} + +func (*ChatEventSlowModeDelayChanged) ChatEventActionType() string { + return TypeChatEventSlowModeDelayChanged +} + +// The sign_messages setting of a channel was toggled +type ChatEventSignMessagesToggled struct { + meta + // New value of sign_messages + SignMessages bool `json:"sign_messages"` +} + +func (entity *ChatEventSignMessagesToggled) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventSignMessagesToggled + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventSignMessagesToggled) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventSignMessagesToggled) GetType() string { + return TypeChatEventSignMessagesToggled +} + +func (*ChatEventSignMessagesToggled) ChatEventActionType() string { + return TypeChatEventSignMessagesToggled +} + +// 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) { + entity.meta.Type = entity.GetType() + + type stub ChatEventStickerSetChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventStickerSetChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventStickerSetChanged) GetType() string { + return TypeChatEventStickerSetChanged +} + +func (*ChatEventStickerSetChanged) ChatEventActionType() string { + return TypeChatEventStickerSetChanged +} + +// The supergroup location was changed +type ChatEventLocationChanged struct { + meta + // Previous location; may be null + OldLocation *ChatLocation `json:"old_location"` + // New location; may be null + NewLocation *ChatLocation `json:"new_location"` +} + +func (entity *ChatEventLocationChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventLocationChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventLocationChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventLocationChanged) GetType() string { + return TypeChatEventLocationChanged +} + +func (*ChatEventLocationChanged) ChatEventActionType() string { + return TypeChatEventLocationChanged +} + +// 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"` +} + +func (entity *ChatEventIsAllHistoryAvailableToggled) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventIsAllHistoryAvailableToggled + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventIsAllHistoryAvailableToggled) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventIsAllHistoryAvailableToggled) GetType() string { + return TypeChatEventIsAllHistoryAvailableToggled +} + +func (*ChatEventIsAllHistoryAvailableToggled) ChatEventActionType() string { + return TypeChatEventIsAllHistoryAvailableToggled +} + +// Represents a chat event +type ChatEvent struct { + meta + // 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"` +} + +func (entity *ChatEvent) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEvent + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEvent) GetClass() string { + return ClassChatEvent +} + +func (*ChatEvent) GetType() string { + return TypeChatEvent +} + +func (chatEvent *ChatEvent) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + Date int32 `json:"date"` + UserId int32 `json:"user_id"` + Action json.RawMessage `json:"action"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatEvent.Id = tmp.Id + chatEvent.Date = tmp.Date + chatEvent.UserId = tmp.UserId + + fieldAction, _ := UnmarshalChatEventAction(tmp.Action) + chatEvent.Action = fieldAction + + return nil +} + +// Contains a list of chat events +type ChatEvents struct { + meta + // List of events + Events []*ChatEvent `json:"events"` +} + +func (entity *ChatEvents) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEvents + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEvents) GetClass() string { + return ClassChatEvents +} + +func (*ChatEvents) GetType() string { + return TypeChatEvents +} + +// 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"` +} + +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 { + meta + // String value + Value string `json:"value"` +} + +func (entity *LanguagePackStringValueOrdinary) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LanguagePackStringValueOrdinary + + return json.Marshal((*stub)(entity)) +} + +func (*LanguagePackStringValueOrdinary) GetClass() string { + return ClassLanguagePackStringValue +} + +func (*LanguagePackStringValueOrdinary) GetType() string { + return TypeLanguagePackStringValueOrdinary +} + +func (*LanguagePackStringValueOrdinary) LanguagePackStringValueType() string { + return TypeLanguagePackStringValueOrdinary +} + +// 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 { + meta + // 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"` +} + +func (entity *LanguagePackStringValuePluralized) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LanguagePackStringValuePluralized + + return json.Marshal((*stub)(entity)) +} + +func (*LanguagePackStringValuePluralized) GetClass() string { + return ClassLanguagePackStringValue +} + +func (*LanguagePackStringValuePluralized) GetType() string { + return TypeLanguagePackStringValuePluralized +} + +func (*LanguagePackStringValuePluralized) LanguagePackStringValueType() string { + return TypeLanguagePackStringValuePluralized +} + +// A deleted language pack string, the value should be taken from the built-in english language pack +type LanguagePackStringValueDeleted struct { + meta +} + +func (entity *LanguagePackStringValueDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LanguagePackStringValueDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*LanguagePackStringValueDeleted) GetClass() string { + return ClassLanguagePackStringValue +} + +func (*LanguagePackStringValueDeleted) GetType() string { + return TypeLanguagePackStringValueDeleted +} + +func (*LanguagePackStringValueDeleted) LanguagePackStringValueType() string { + return TypeLanguagePackStringValueDeleted +} + +// Represents one language pack string +type LanguagePackString struct { + meta + // String key + Key string `json:"key"` + // String value + Value LanguagePackStringValue `json:"value"` +} + +func (entity *LanguagePackString) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LanguagePackString + + return json.Marshal((*stub)(entity)) +} + +func (*LanguagePackString) GetClass() string { + return ClassLanguagePackString +} + +func (*LanguagePackString) GetType() string { + return TypeLanguagePackString +} + +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 +} + +// Contains a list of language pack strings +type LanguagePackStrings struct { + meta + // A list of language pack strings + Strings []*LanguagePackString `json:"strings"` +} + +func (entity *LanguagePackStrings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LanguagePackStrings + + return json.Marshal((*stub)(entity)) +} + +func (*LanguagePackStrings) GetClass() string { + return ClassLanguagePackStrings +} + +func (*LanguagePackStrings) GetType() string { + return TypeLanguagePackStrings +} + +// Contains information about a language pack +type LanguagePackInfo struct { + meta + // Unique language pack identifier + Id string `json:"id"` + // 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"` +} + +func (entity *LanguagePackInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LanguagePackInfo + + return json.Marshal((*stub)(entity)) +} + +func (*LanguagePackInfo) GetClass() string { + return ClassLanguagePackInfo +} + +func (*LanguagePackInfo) GetType() string { + return TypeLanguagePackInfo +} + +// Contains information about the current localization target +type LocalizationTargetInfo struct { + meta + // List of available language packs for this application + LanguagePacks []*LanguagePackInfo `json:"language_packs"` +} + +func (entity *LocalizationTargetInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LocalizationTargetInfo + + return json.Marshal((*stub)(entity)) +} + +func (*LocalizationTargetInfo) GetClass() string { + return ClassLocalizationTargetInfo +} + +func (*LocalizationTargetInfo) GetType() string { + return TypeLocalizationTargetInfo +} + +// A token for Firebase Cloud Messaging +type DeviceTokenFirebaseCloudMessaging struct { + meta + // 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"` +} + +func (entity *DeviceTokenFirebaseCloudMessaging) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeviceTokenFirebaseCloudMessaging + + return json.Marshal((*stub)(entity)) +} + +func (*DeviceTokenFirebaseCloudMessaging) GetClass() string { + return ClassDeviceToken +} + +func (*DeviceTokenFirebaseCloudMessaging) GetType() string { + return TypeDeviceTokenFirebaseCloudMessaging +} + +func (*DeviceTokenFirebaseCloudMessaging) DeviceTokenType() string { + return TypeDeviceTokenFirebaseCloudMessaging +} + +// A token for Apple Push Notification service +type DeviceTokenApplePush struct { + meta + // 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"` +} + +func (entity *DeviceTokenApplePush) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeviceTokenApplePush + + return json.Marshal((*stub)(entity)) +} + +func (*DeviceTokenApplePush) GetClass() string { + return ClassDeviceToken +} + +func (*DeviceTokenApplePush) GetType() string { + return TypeDeviceTokenApplePush +} + +func (*DeviceTokenApplePush) DeviceTokenType() string { + return TypeDeviceTokenApplePush +} + +// A token for Apple Push Notification service VoIP notifications +type DeviceTokenApplePushVoIP struct { + meta + // 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"` +} + +func (entity *DeviceTokenApplePushVoIP) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeviceTokenApplePushVoIP + + return json.Marshal((*stub)(entity)) +} + +func (*DeviceTokenApplePushVoIP) GetClass() string { + return ClassDeviceToken +} + +func (*DeviceTokenApplePushVoIP) GetType() string { + return TypeDeviceTokenApplePushVoIP +} + +func (*DeviceTokenApplePushVoIP) DeviceTokenType() string { + return TypeDeviceTokenApplePushVoIP +} + +// A token for Windows Push Notification Services +type DeviceTokenWindowsPush struct { + meta + // The access token that will be used to send notifications; may be empty to de-register a device + AccessToken string `json:"access_token"` +} + +func (entity *DeviceTokenWindowsPush) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeviceTokenWindowsPush + + return json.Marshal((*stub)(entity)) +} + +func (*DeviceTokenWindowsPush) GetClass() string { + return ClassDeviceToken +} + +func (*DeviceTokenWindowsPush) GetType() string { + return TypeDeviceTokenWindowsPush +} + +func (*DeviceTokenWindowsPush) DeviceTokenType() string { + return TypeDeviceTokenWindowsPush +} + +// A token for Microsoft Push Notification Service +type DeviceTokenMicrosoftPush struct { + meta + // Push notification channel URI; may be empty to de-register a device + ChannelUri string `json:"channel_uri"` +} + +func (entity *DeviceTokenMicrosoftPush) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeviceTokenMicrosoftPush + + return json.Marshal((*stub)(entity)) +} + +func (*DeviceTokenMicrosoftPush) GetClass() string { + return ClassDeviceToken +} + +func (*DeviceTokenMicrosoftPush) GetType() string { + return TypeDeviceTokenMicrosoftPush +} + +func (*DeviceTokenMicrosoftPush) DeviceTokenType() string { + return TypeDeviceTokenMicrosoftPush +} + +// A token for Microsoft Push Notification Service VoIP channel +type DeviceTokenMicrosoftPushVoIP struct { + meta + // Push notification channel URI; may be empty to de-register a device + ChannelUri string `json:"channel_uri"` +} + +func (entity *DeviceTokenMicrosoftPushVoIP) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeviceTokenMicrosoftPushVoIP + + return json.Marshal((*stub)(entity)) +} + +func (*DeviceTokenMicrosoftPushVoIP) GetClass() string { + return ClassDeviceToken +} + +func (*DeviceTokenMicrosoftPushVoIP) GetType() string { + return TypeDeviceTokenMicrosoftPushVoIP +} + +func (*DeviceTokenMicrosoftPushVoIP) DeviceTokenType() string { + return TypeDeviceTokenMicrosoftPushVoIP +} + +// A token for web Push API +type DeviceTokenWebPush struct { + meta + // 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"` +} + +func (entity *DeviceTokenWebPush) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeviceTokenWebPush + + return json.Marshal((*stub)(entity)) +} + +func (*DeviceTokenWebPush) GetClass() string { + return ClassDeviceToken +} + +func (*DeviceTokenWebPush) GetType() string { + return TypeDeviceTokenWebPush +} + +func (*DeviceTokenWebPush) DeviceTokenType() string { + return TypeDeviceTokenWebPush +} + +// A token for Simple Push API for Firefox OS +type DeviceTokenSimplePush struct { + meta + // 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"` +} + +func (entity *DeviceTokenSimplePush) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeviceTokenSimplePush + + return json.Marshal((*stub)(entity)) +} + +func (*DeviceTokenSimplePush) GetClass() string { + return ClassDeviceToken +} + +func (*DeviceTokenSimplePush) GetType() string { + return TypeDeviceTokenSimplePush +} + +func (*DeviceTokenSimplePush) DeviceTokenType() string { + return TypeDeviceTokenSimplePush +} + +// A token for Ubuntu Push Client service +type DeviceTokenUbuntuPush struct { + meta + // Token; may be empty to de-register a device + Token string `json:"token"` +} + +func (entity *DeviceTokenUbuntuPush) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeviceTokenUbuntuPush + + return json.Marshal((*stub)(entity)) +} + +func (*DeviceTokenUbuntuPush) GetClass() string { + return ClassDeviceToken +} + +func (*DeviceTokenUbuntuPush) GetType() string { + return TypeDeviceTokenUbuntuPush +} + +func (*DeviceTokenUbuntuPush) DeviceTokenType() string { + return TypeDeviceTokenUbuntuPush +} + +// A token for BlackBerry Push Service +type DeviceTokenBlackBerryPush struct { + meta + // Token; may be empty to de-register a device + Token string `json:"token"` +} + +func (entity *DeviceTokenBlackBerryPush) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeviceTokenBlackBerryPush + + return json.Marshal((*stub)(entity)) +} + +func (*DeviceTokenBlackBerryPush) GetClass() string { + return ClassDeviceToken +} + +func (*DeviceTokenBlackBerryPush) GetType() string { + return TypeDeviceTokenBlackBerryPush +} + +func (*DeviceTokenBlackBerryPush) DeviceTokenType() string { + return TypeDeviceTokenBlackBerryPush +} + +// A token for Tizen Push Service +type DeviceTokenTizenPush struct { + meta + // Push service registration identifier; may be empty to de-register a device + RegId string `json:"reg_id"` +} + +func (entity *DeviceTokenTizenPush) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeviceTokenTizenPush + + return json.Marshal((*stub)(entity)) +} + +func (*DeviceTokenTizenPush) GetClass() string { + return ClassDeviceToken +} + +func (*DeviceTokenTizenPush) GetType() string { + return TypeDeviceTokenTizenPush +} + +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 { + meta + // The globally unique identifier of push notification subscription + Id JsonInt64 `json:"id"` +} + +func (entity *PushReceiverId) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushReceiverId + + return json.Marshal((*stub)(entity)) +} + +func (*PushReceiverId) GetClass() string { + return ClassPushReceiverId +} + +func (*PushReceiverId) GetType() string { + return TypePushReceiverId +} + +// Describes a solid fill of a background +type BackgroundFillSolid struct { + meta + // A color of the background in the RGB24 format + Color int32 `json:"color"` +} + +func (entity *BackgroundFillSolid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BackgroundFillSolid + + return json.Marshal((*stub)(entity)) +} + +func (*BackgroundFillSolid) GetClass() string { + return ClassBackgroundFill +} + +func (*BackgroundFillSolid) GetType() string { + return TypeBackgroundFillSolid +} + +func (*BackgroundFillSolid) BackgroundFillType() string { + return TypeBackgroundFillSolid +} + +// Describes a gradient fill of a background +type BackgroundFillGradient struct { + meta + // A top color of the background in the RGB24 format + TopColor int32 `json:"top_color"` + // A bottom color of the background in the RGB24 format + BottomColor int32 `json:"bottom_color"` + // Clockwise rotation angle of the gradient, in degrees; 0-359. Should be always divisible by 45 + RotationAngle int32 `json:"rotation_angle"` +} + +func (entity *BackgroundFillGradient) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BackgroundFillGradient + + return json.Marshal((*stub)(entity)) +} + +func (*BackgroundFillGradient) GetClass() string { + return ClassBackgroundFill +} + +func (*BackgroundFillGradient) GetType() string { + return TypeBackgroundFillGradient +} + +func (*BackgroundFillGradient) BackgroundFillType() string { + return TypeBackgroundFillGradient +} + +// A wallpaper in JPEG format +type BackgroundTypeWallpaper struct { + meta + // 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 tilted + 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 or TGV (gzipped subset of SVG with MIME type "application/x-tgwallpattern") pattern to be combined with the background fill chosen by the user +type BackgroundTypePattern struct { + meta + // Description of the background fill + Fill BackgroundFill `json:"fill"` + // Intensity of the pattern when it is shown above the filled background, 0-100 + Intensity int32 `json:"intensity"` + // True, if the background needs to be slightly moved when device is tilted + IsMoving bool `json:"is_moving"` +} + +func (entity *BackgroundTypePattern) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BackgroundTypePattern + + return json.Marshal((*stub)(entity)) +} + +func (*BackgroundTypePattern) GetClass() string { + return ClassBackgroundType +} + +func (*BackgroundTypePattern) GetType() string { + return TypeBackgroundTypePattern +} + +func (*BackgroundTypePattern) BackgroundTypeType() string { + return TypeBackgroundTypePattern +} + +func (backgroundTypePattern *BackgroundTypePattern) UnmarshalJSON(data []byte) error { + var tmp struct { + Fill json.RawMessage `json:"fill"` + Intensity int32 `json:"intensity"` + IsMoving bool `json:"is_moving"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + backgroundTypePattern.Intensity = tmp.Intensity + backgroundTypePattern.IsMoving = tmp.IsMoving + + fieldFill, _ := UnmarshalBackgroundFill(tmp.Fill) + backgroundTypePattern.Fill = fieldFill + + return nil +} + +// A filled background +type BackgroundTypeFill struct { + meta + // Description of the background fill + Fill BackgroundFill `json:"fill"` +} + +func (entity *BackgroundTypeFill) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BackgroundTypeFill + + return json.Marshal((*stub)(entity)) +} + +func (*BackgroundTypeFill) GetClass() string { + return ClassBackgroundType +} + +func (*BackgroundTypeFill) GetType() string { + return TypeBackgroundTypeFill +} + +func (*BackgroundTypeFill) BackgroundTypeType() string { + return TypeBackgroundTypeFill +} + +func (backgroundTypeFill *BackgroundTypeFill) UnmarshalJSON(data []byte) error { + var tmp struct { + Fill json.RawMessage `json:"fill"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldFill, _ := UnmarshalBackgroundFill(tmp.Fill) + backgroundTypeFill.Fill = fieldFill + + return nil +} + +// 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 filled 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 must 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 +} + +func (*InputBackgroundLocal) InputBackgroundType() string { + return TypeInputBackgroundLocal +} + +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 { + meta + // The background identifier + BackgroundId JsonInt64 `json:"background_id"` +} + +func (entity *InputBackgroundRemote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputBackgroundRemote + + return json.Marshal((*stub)(entity)) +} + +func (*InputBackgroundRemote) GetClass() string { + return ClassInputBackground +} + +func (*InputBackgroundRemote) GetType() string { + return TypeInputBackgroundRemote +} + +func (*InputBackgroundRemote) InputBackgroundType() string { + return TypeInputBackgroundRemote +} + +// Contains a list of hashtags +type Hashtags struct { + meta + // A list of hashtags + Hashtags []string `json:"hashtags"` +} + +func (entity *Hashtags) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Hashtags + + return json.Marshal((*stub)(entity)) +} + +func (*Hashtags) GetClass() string { + return ClassHashtags +} + +func (*Hashtags) GetType() string { + return TypeHashtags +} + +// The session can be used +type CanTransferOwnershipResultOk struct { + meta +} + +func (entity *CanTransferOwnershipResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanTransferOwnershipResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*CanTransferOwnershipResultOk) GetClass() string { + return ClassCanTransferOwnershipResult +} + +func (*CanTransferOwnershipResultOk) GetType() string { + return TypeCanTransferOwnershipResultOk +} + +func (*CanTransferOwnershipResultOk) CanTransferOwnershipResultType() string { + return TypeCanTransferOwnershipResultOk +} + +// The 2-step verification needs to be enabled first +type CanTransferOwnershipResultPasswordNeeded struct { + meta +} + +func (entity *CanTransferOwnershipResultPasswordNeeded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanTransferOwnershipResultPasswordNeeded + + return json.Marshal((*stub)(entity)) +} + +func (*CanTransferOwnershipResultPasswordNeeded) GetClass() string { + return ClassCanTransferOwnershipResult +} + +func (*CanTransferOwnershipResultPasswordNeeded) GetType() string { + return TypeCanTransferOwnershipResultPasswordNeeded +} + +func (*CanTransferOwnershipResultPasswordNeeded) CanTransferOwnershipResultType() string { + return TypeCanTransferOwnershipResultPasswordNeeded +} + +// The 2-step verification was enabled recently, user needs to wait +type CanTransferOwnershipResultPasswordTooFresh struct { + meta + // Time left before the session can be used to transfer ownership of a chat, in seconds + RetryAfter int32 `json:"retry_after"` +} + +func (entity *CanTransferOwnershipResultPasswordTooFresh) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanTransferOwnershipResultPasswordTooFresh + + return json.Marshal((*stub)(entity)) +} + +func (*CanTransferOwnershipResultPasswordTooFresh) GetClass() string { + return ClassCanTransferOwnershipResult +} + +func (*CanTransferOwnershipResultPasswordTooFresh) GetType() string { + return TypeCanTransferOwnershipResultPasswordTooFresh +} + +func (*CanTransferOwnershipResultPasswordTooFresh) CanTransferOwnershipResultType() string { + return TypeCanTransferOwnershipResultPasswordTooFresh +} + +// The session was created recently, user needs to wait +type CanTransferOwnershipResultSessionTooFresh struct { + meta + // Time left before the session can be used to transfer ownership of a chat, in seconds + RetryAfter int32 `json:"retry_after"` +} + +func (entity *CanTransferOwnershipResultSessionTooFresh) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanTransferOwnershipResultSessionTooFresh + + return json.Marshal((*stub)(entity)) +} + +func (*CanTransferOwnershipResultSessionTooFresh) GetClass() string { + return ClassCanTransferOwnershipResult +} + +func (*CanTransferOwnershipResultSessionTooFresh) GetType() string { + return TypeCanTransferOwnershipResultSessionTooFresh +} + +func (*CanTransferOwnershipResultSessionTooFresh) CanTransferOwnershipResultType() string { + return TypeCanTransferOwnershipResultSessionTooFresh +} + +// The username can be set +type CheckChatUsernameResultOk struct { + meta +} + +func (entity *CheckChatUsernameResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CheckChatUsernameResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*CheckChatUsernameResultOk) GetClass() string { + return ClassCheckChatUsernameResult +} + +func (*CheckChatUsernameResultOk) GetType() string { + return TypeCheckChatUsernameResultOk +} + +func (*CheckChatUsernameResultOk) CheckChatUsernameResultType() string { + return TypeCheckChatUsernameResultOk +} + +// The username is invalid +type CheckChatUsernameResultUsernameInvalid struct { + meta +} + +func (entity *CheckChatUsernameResultUsernameInvalid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CheckChatUsernameResultUsernameInvalid + + return json.Marshal((*stub)(entity)) +} + +func (*CheckChatUsernameResultUsernameInvalid) GetClass() string { + return ClassCheckChatUsernameResult +} + +func (*CheckChatUsernameResultUsernameInvalid) GetType() string { + return TypeCheckChatUsernameResultUsernameInvalid +} + +func (*CheckChatUsernameResultUsernameInvalid) CheckChatUsernameResultType() string { + return TypeCheckChatUsernameResultUsernameInvalid +} + +// The username is occupied +type CheckChatUsernameResultUsernameOccupied struct { + meta +} + +func (entity *CheckChatUsernameResultUsernameOccupied) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CheckChatUsernameResultUsernameOccupied + + return json.Marshal((*stub)(entity)) +} + +func (*CheckChatUsernameResultUsernameOccupied) GetClass() string { + return ClassCheckChatUsernameResult +} + +func (*CheckChatUsernameResultUsernameOccupied) GetType() string { + return TypeCheckChatUsernameResultUsernameOccupied +} + +func (*CheckChatUsernameResultUsernameOccupied) CheckChatUsernameResultType() string { + return TypeCheckChatUsernameResultUsernameOccupied +} + +// The user has too much chats with username, one of them should be made private first +type CheckChatUsernameResultPublicChatsTooMuch struct { + meta +} + +func (entity *CheckChatUsernameResultPublicChatsTooMuch) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CheckChatUsernameResultPublicChatsTooMuch + + return json.Marshal((*stub)(entity)) +} + +func (*CheckChatUsernameResultPublicChatsTooMuch) GetClass() string { + return ClassCheckChatUsernameResult +} + +func (*CheckChatUsernameResultPublicChatsTooMuch) GetType() string { + return TypeCheckChatUsernameResultPublicChatsTooMuch +} + +func (*CheckChatUsernameResultPublicChatsTooMuch) CheckChatUsernameResultType() string { + return TypeCheckChatUsernameResultPublicChatsTooMuch +} + +// The user can't be a member of a public supergroup +type CheckChatUsernameResultPublicGroupsUnavailable struct { + meta +} + +func (entity *CheckChatUsernameResultPublicGroupsUnavailable) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CheckChatUsernameResultPublicGroupsUnavailable + + return json.Marshal((*stub)(entity)) +} + +func (*CheckChatUsernameResultPublicGroupsUnavailable) GetClass() string { + return ClassCheckChatUsernameResult +} + +func (*CheckChatUsernameResultPublicGroupsUnavailable) GetType() string { + return TypeCheckChatUsernameResultPublicGroupsUnavailable +} + +func (*CheckChatUsernameResultPublicGroupsUnavailable) CheckChatUsernameResultType() string { + return TypeCheckChatUsernameResultPublicGroupsUnavailable +} + +// A general message with hidden content +type PushMessageContentHidden struct { + meta + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentHidden) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentHidden + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentHidden) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentHidden) GetType() string { + return TypePushMessageContentHidden +} + +func (*PushMessageContentHidden) PushMessageContentType() string { + return TypePushMessageContentHidden +} + +// An animation message (GIF-style). +type PushMessageContentAnimation struct { + meta + // 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"` +} + +func (entity *PushMessageContentAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentAnimation) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentAnimation) GetType() string { + return TypePushMessageContentAnimation +} + +func (*PushMessageContentAnimation) PushMessageContentType() string { + return TypePushMessageContentAnimation +} + +// An audio message +type PushMessageContentAudio struct { + meta + // 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"` +} + +func (entity *PushMessageContentAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentAudio + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentAudio) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentAudio) GetType() string { + return TypePushMessageContentAudio +} + +func (*PushMessageContentAudio) PushMessageContentType() string { + return TypePushMessageContentAudio +} + +// A message with a user contact +type PushMessageContentContact struct { + meta + // Contact's name + Name string `json:"name"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentContact) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentContact + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentContact) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentContact) GetType() string { + return TypePushMessageContentContact +} + +func (*PushMessageContentContact) PushMessageContentType() string { + return TypePushMessageContentContact +} + +// A contact has registered with Telegram +type PushMessageContentContactRegistered struct { + meta +} + +func (entity *PushMessageContentContactRegistered) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentContactRegistered + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentContactRegistered) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentContactRegistered) GetType() string { + return TypePushMessageContentContactRegistered +} + +func (*PushMessageContentContactRegistered) PushMessageContentType() string { + return TypePushMessageContentContactRegistered +} + +// A document message (a general file) +type PushMessageContentDocument struct { + meta + // 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"` +} + +func (entity *PushMessageContentDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentDocument + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentDocument) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentDocument) GetType() string { + return TypePushMessageContentDocument +} + +func (*PushMessageContentDocument) PushMessageContentType() string { + return TypePushMessageContentDocument +} + +// A message with a game +type PushMessageContentGame struct { + meta + // 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"` +} + +func (entity *PushMessageContentGame) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentGame + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentGame) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentGame) GetType() string { + return TypePushMessageContentGame +} + +func (*PushMessageContentGame) PushMessageContentType() string { + return TypePushMessageContentGame +} + +// A new high score was achieved in a game +type PushMessageContentGameScore struct { + meta + // 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"` +} + +func (entity *PushMessageContentGameScore) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentGameScore + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentGameScore) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentGameScore) GetType() string { + return TypePushMessageContentGameScore +} + +func (*PushMessageContentGameScore) PushMessageContentType() string { + return TypePushMessageContentGameScore +} + +// A message with an invoice from a bot +type PushMessageContentInvoice struct { + meta + // Product price + Price string `json:"price"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentInvoice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentInvoice + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentInvoice) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentInvoice) GetType() string { + return TypePushMessageContentInvoice +} + +func (*PushMessageContentInvoice) PushMessageContentType() string { + return TypePushMessageContentInvoice +} + +// A message with a location +type PushMessageContentLocation struct { + meta + // 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"` +} + +func (entity *PushMessageContentLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentLocation + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentLocation) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentLocation) GetType() string { + return TypePushMessageContentLocation +} + +func (*PushMessageContentLocation) PushMessageContentType() string { + return TypePushMessageContentLocation +} + +// A photo message +type PushMessageContentPhoto struct { + meta + // 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"` +} + +func (entity *PushMessageContentPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentPhoto) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentPhoto) GetType() string { + return TypePushMessageContentPhoto +} + +func (*PushMessageContentPhoto) PushMessageContentType() string { + return TypePushMessageContentPhoto +} + +// A message with a poll +type PushMessageContentPoll struct { + meta + // Poll question + Question string `json:"question"` + // True, if the poll is regular and not in quiz mode + IsRegular bool `json:"is_regular"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentPoll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentPoll + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentPoll) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentPoll) GetType() string { + return TypePushMessageContentPoll +} + +func (*PushMessageContentPoll) PushMessageContentType() string { + return TypePushMessageContentPoll +} + +// A screenshot of a message in the chat has been taken +type PushMessageContentScreenshotTaken struct { + meta +} + +func (entity *PushMessageContentScreenshotTaken) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentScreenshotTaken + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentScreenshotTaken) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentScreenshotTaken) GetType() string { + return TypePushMessageContentScreenshotTaken +} + +func (*PushMessageContentScreenshotTaken) PushMessageContentType() string { + return TypePushMessageContentScreenshotTaken +} + +// A message with a sticker +type PushMessageContentSticker struct { + meta + // 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"` +} + +func (entity *PushMessageContentSticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentSticker + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentSticker) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentSticker) GetType() string { + return TypePushMessageContentSticker +} + +func (*PushMessageContentSticker) PushMessageContentType() string { + return TypePushMessageContentSticker +} + +// A text message +type PushMessageContentText struct { + meta + // Message text + Text string `json:"text"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentText) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentText + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentText) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentText) GetType() string { + return TypePushMessageContentText +} + +func (*PushMessageContentText) PushMessageContentType() string { + return TypePushMessageContentText +} + +// A video message +type PushMessageContentVideo struct { + meta + // 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"` +} + +func (entity *PushMessageContentVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVideo + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVideo) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVideo) GetType() string { + return TypePushMessageContentVideo +} + +func (*PushMessageContentVideo) PushMessageContentType() string { + return TypePushMessageContentVideo +} + +// A video note message +type PushMessageContentVideoNote struct { + meta + // 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"` +} + +func (entity *PushMessageContentVideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVideoNote) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVideoNote) GetType() string { + return TypePushMessageContentVideoNote +} + +func (*PushMessageContentVideoNote) PushMessageContentType() string { + return TypePushMessageContentVideoNote +} + +// A voice note message +type PushMessageContentVoiceNote struct { + meta + // 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"` +} + +func (entity *PushMessageContentVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVoiceNote) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVoiceNote) GetType() string { + return TypePushMessageContentVoiceNote +} + +func (*PushMessageContentVoiceNote) PushMessageContentType() string { + return TypePushMessageContentVoiceNote +} + +// A newly created basic group +type PushMessageContentBasicGroupChatCreate struct { + meta +} + +func (entity *PushMessageContentBasicGroupChatCreate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentBasicGroupChatCreate + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentBasicGroupChatCreate) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentBasicGroupChatCreate) GetType() string { + return TypePushMessageContentBasicGroupChatCreate +} + +func (*PushMessageContentBasicGroupChatCreate) PushMessageContentType() string { + return TypePushMessageContentBasicGroupChatCreate +} + +// New chat members were invited to a group +type PushMessageContentChatAddMembers struct { + meta + // 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 themself + IsReturned bool `json:"is_returned"` +} + +func (entity *PushMessageContentChatAddMembers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChatAddMembers + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChatAddMembers) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChatAddMembers) GetType() string { + return TypePushMessageContentChatAddMembers +} + +func (*PushMessageContentChatAddMembers) PushMessageContentType() string { + return TypePushMessageContentChatAddMembers +} + +// A chat photo was edited +type PushMessageContentChatChangePhoto struct { + meta +} + +func (entity *PushMessageContentChatChangePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChatChangePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChatChangePhoto) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChatChangePhoto) GetType() string { + return TypePushMessageContentChatChangePhoto +} + +func (*PushMessageContentChatChangePhoto) PushMessageContentType() string { + return TypePushMessageContentChatChangePhoto +} + +// A chat title was edited +type PushMessageContentChatChangeTitle struct { + meta + // New chat title + Title string `json:"title"` +} + +func (entity *PushMessageContentChatChangeTitle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChatChangeTitle + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChatChangeTitle) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChatChangeTitle) GetType() string { + return TypePushMessageContentChatChangeTitle +} + +func (*PushMessageContentChatChangeTitle) PushMessageContentType() string { + return TypePushMessageContentChatChangeTitle +} + +// A chat member was deleted +type PushMessageContentChatDeleteMember struct { + meta + // 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 themself + IsLeft bool `json:"is_left"` +} + +func (entity *PushMessageContentChatDeleteMember) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChatDeleteMember + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChatDeleteMember) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChatDeleteMember) GetType() string { + return TypePushMessageContentChatDeleteMember +} + +func (*PushMessageContentChatDeleteMember) PushMessageContentType() string { + return TypePushMessageContentChatDeleteMember +} + +// A new member joined the chat by invite link +type PushMessageContentChatJoinByLink struct { + meta +} + +func (entity *PushMessageContentChatJoinByLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChatJoinByLink + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChatJoinByLink) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChatJoinByLink) GetType() string { + return TypePushMessageContentChatJoinByLink +} + +func (*PushMessageContentChatJoinByLink) PushMessageContentType() string { + return TypePushMessageContentChatJoinByLink +} + +// A forwarded messages +type PushMessageContentMessageForwards struct { + meta + // Number of forwarded messages + TotalCount int32 `json:"total_count"` +} + +func (entity *PushMessageContentMessageForwards) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentMessageForwards + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentMessageForwards) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentMessageForwards) GetType() string { + return TypePushMessageContentMessageForwards +} + +func (*PushMessageContentMessageForwards) PushMessageContentType() string { + return TypePushMessageContentMessageForwards +} + +// A media album +type PushMessageContentMediaAlbum struct { + meta + // 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"` + // True, if the album has at least one audio file + HasAudios bool `json:"has_audios"` + // True, if the album has at least one document + HasDocuments bool `json:"has_documents"` +} + +func (entity *PushMessageContentMediaAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentMediaAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentMediaAlbum) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentMediaAlbum) GetType() string { + return TypePushMessageContentMediaAlbum +} + +func (*PushMessageContentMediaAlbum) PushMessageContentType() string { + return TypePushMessageContentMediaAlbum +} + +// New message was received +type NotificationTypeNewMessage struct { + meta + // The message + Message *Message `json:"message"` +} + +func (entity *NotificationTypeNewMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationTypeNewMessage + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationTypeNewMessage) GetClass() string { + return ClassNotificationType +} + +func (*NotificationTypeNewMessage) GetType() string { + return TypeNotificationTypeNewMessage +} + +func (*NotificationTypeNewMessage) NotificationTypeType() string { + return TypeNotificationTypeNewMessage +} + +// New secret chat was created +type NotificationTypeNewSecretChat struct { + meta +} + +func (entity *NotificationTypeNewSecretChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationTypeNewSecretChat + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationTypeNewSecretChat) GetClass() string { + return ClassNotificationType +} + +func (*NotificationTypeNewSecretChat) GetType() string { + return TypeNotificationTypeNewSecretChat +} + +func (*NotificationTypeNewSecretChat) NotificationTypeType() string { + return TypeNotificationTypeNewSecretChat +} + +// New call was received +type NotificationTypeNewCall struct { + meta + // Call identifier + CallId int32 `json:"call_id"` +} + +func (entity *NotificationTypeNewCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationTypeNewCall + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationTypeNewCall) GetClass() string { + return ClassNotificationType +} + +func (*NotificationTypeNewCall) GetType() string { + return TypeNotificationTypeNewCall +} + +func (*NotificationTypeNewCall) NotificationTypeType() string { + return TypeNotificationTypeNewCall +} + +// New message was received through a push notification +type NotificationTypeNewPushMessage struct { + meta + // The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages, or as reply_to_message_id + MessageId int64 `json:"message_id"` + // The sender of the message. Corresponding user or chat may be inaccessible + Sender MessageSender `json:"sender"` + // Name of the sender + SenderName string `json:"sender_name"` + // True, if the message is outgoing + IsOutgoing bool `json:"is_outgoing"` + // Push message content + Content PushMessageContent `json:"content"` +} + +func (entity *NotificationTypeNewPushMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationTypeNewPushMessage + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationTypeNewPushMessage) GetClass() string { + return ClassNotificationType +} + +func (*NotificationTypeNewPushMessage) GetType() string { + return TypeNotificationTypeNewPushMessage +} + +func (*NotificationTypeNewPushMessage) NotificationTypeType() string { + return TypeNotificationTypeNewPushMessage +} + +func (notificationTypeNewPushMessage *NotificationTypeNewPushMessage) UnmarshalJSON(data []byte) error { + var tmp struct { + MessageId int64 `json:"message_id"` + Sender json.RawMessage `json:"sender"` + SenderName string `json:"sender_name"` + IsOutgoing bool `json:"is_outgoing"` + Content json.RawMessage `json:"content"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + notificationTypeNewPushMessage.MessageId = tmp.MessageId + notificationTypeNewPushMessage.SenderName = tmp.SenderName + notificationTypeNewPushMessage.IsOutgoing = tmp.IsOutgoing + + fieldSender, _ := UnmarshalMessageSender(tmp.Sender) + notificationTypeNewPushMessage.Sender = fieldSender + + fieldContent, _ := UnmarshalPushMessageContent(tmp.Content) + notificationTypeNewPushMessage.Content = fieldContent + + return nil +} + +// A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with ordinary unread messages +type NotificationGroupTypeMessages struct { + meta +} + +func (entity *NotificationGroupTypeMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationGroupTypeMessages + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationGroupTypeMessages) GetClass() string { + return ClassNotificationGroupType +} + +func (*NotificationGroupTypeMessages) GetType() string { + return TypeNotificationGroupTypeMessages +} + +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 { + meta +} + +func (entity *NotificationGroupTypeMentions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationGroupTypeMentions + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationGroupTypeMentions) GetClass() string { + return ClassNotificationGroupType +} + +func (*NotificationGroupTypeMentions) GetType() string { + return TypeNotificationGroupTypeMentions +} + +func (*NotificationGroupTypeMentions) NotificationGroupTypeType() string { + return TypeNotificationGroupTypeMentions +} + +// A group containing a notification of type notificationTypeNewSecretChat +type NotificationGroupTypeSecretChat struct { + meta +} + +func (entity *NotificationGroupTypeSecretChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationGroupTypeSecretChat + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationGroupTypeSecretChat) GetClass() string { + return ClassNotificationGroupType +} + +func (*NotificationGroupTypeSecretChat) GetType() string { + return TypeNotificationGroupTypeSecretChat +} + +func (*NotificationGroupTypeSecretChat) NotificationGroupTypeType() string { + return TypeNotificationGroupTypeSecretChat +} + +// A group containing notifications of type notificationTypeNewCall +type NotificationGroupTypeCalls struct { + meta +} + +func (entity *NotificationGroupTypeCalls) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationGroupTypeCalls + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationGroupTypeCalls) GetClass() string { + return ClassNotificationGroupType +} + +func (*NotificationGroupTypeCalls) GetType() string { + return TypeNotificationGroupTypeCalls +} + +func (*NotificationGroupTypeCalls) NotificationGroupTypeType() string { + return TypeNotificationGroupTypeCalls +} + +// Contains information about a notification +type Notification struct { + meta + // Unique persistent identifier of this notification + Id int32 `json:"id"` + // Notification date + Date int32 `json:"date"` + // True, if the notification was initially silent + IsSilent bool `json:"is_silent"` + // Notification type + Type NotificationType `json:"type"` +} + +func (entity *Notification) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Notification + + return json.Marshal((*stub)(entity)) +} + +func (*Notification) GetClass() string { + return ClassNotification +} + +func (*Notification) GetType() string { + return TypeNotification +} + +func (notification *Notification) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int32 `json:"id"` + Date int32 `json:"date"` + IsSilent bool `json:"is_silent"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + notification.Id = tmp.Id + notification.Date = tmp.Date + notification.IsSilent = tmp.IsSilent + + fieldType, _ := UnmarshalNotificationType(tmp.Type) + notification.Type = fieldType + + return nil +} + +// Describes a group of notifications +type NotificationGroup struct { + meta + // 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"` +} + +func (entity *NotificationGroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationGroup + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationGroup) GetClass() string { + return ClassNotificationGroup +} + +func (*NotificationGroup) GetType() string { + return TypeNotificationGroup +} + +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 +} + +// Represents a boolean option +type OptionValueBoolean struct { + meta + // The value of the option + Value bool `json:"value"` +} + +func (entity *OptionValueBoolean) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub OptionValueBoolean + + return json.Marshal((*stub)(entity)) +} + +func (*OptionValueBoolean) GetClass() string { + return ClassOptionValue +} + +func (*OptionValueBoolean) GetType() string { + return TypeOptionValueBoolean +} + +func (*OptionValueBoolean) OptionValueType() string { + return TypeOptionValueBoolean +} + +// Represents an unknown option or an option which has a default value +type OptionValueEmpty struct { + meta +} + +func (entity *OptionValueEmpty) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub OptionValueEmpty + + return json.Marshal((*stub)(entity)) +} + +func (*OptionValueEmpty) GetClass() string { + return ClassOptionValue +} + +func (*OptionValueEmpty) GetType() string { + return TypeOptionValueEmpty +} + +func (*OptionValueEmpty) OptionValueType() string { + return TypeOptionValueEmpty +} + +// Represents an integer option +type OptionValueInteger struct { + meta + // The value of the option + Value JsonInt64 `json:"value"` +} + +func (entity *OptionValueInteger) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub OptionValueInteger + + return json.Marshal((*stub)(entity)) +} + +func (*OptionValueInteger) GetClass() string { + return ClassOptionValue +} + +func (*OptionValueInteger) GetType() string { + return TypeOptionValueInteger +} + +func (*OptionValueInteger) OptionValueType() string { + return TypeOptionValueInteger +} + +// Represents a string option +type OptionValueString struct { + meta + // The value of the option + Value string `json:"value"` +} + +func (entity *OptionValueString) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub OptionValueString + + return json.Marshal((*stub)(entity)) +} + +func (*OptionValueString) GetClass() string { + return ClassOptionValue +} + +func (*OptionValueString) GetType() string { + return TypeOptionValueString +} + +func (*OptionValueString) OptionValueType() string { + return TypeOptionValueString +} + +// 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 +} + +func (jsonValueArray *JsonValueArray) UnmarshalJSON(data []byte) error { + var tmp struct { + Values []json.RawMessage `json:"values"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldValues, _ := UnmarshalListOfJsonValue(tmp.Values) + jsonValueArray.Values = fieldValues + + return nil +} + +// 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 +} + +// A rule to allow all users to do something +type UserPrivacySettingRuleAllowAll struct { + meta +} + +func (entity *UserPrivacySettingRuleAllowAll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleAllowAll + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleAllowAll) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleAllowAll) GetType() string { + return TypeUserPrivacySettingRuleAllowAll +} + +func (*UserPrivacySettingRuleAllowAll) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleAllowAll +} + +// A rule to allow all of a user's contacts to do something +type UserPrivacySettingRuleAllowContacts struct { + meta +} + +func (entity *UserPrivacySettingRuleAllowContacts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleAllowContacts + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleAllowContacts) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleAllowContacts) GetType() string { + return TypeUserPrivacySettingRuleAllowContacts +} + +func (*UserPrivacySettingRuleAllowContacts) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleAllowContacts +} + +// A rule to allow certain specified users to do something +type UserPrivacySettingRuleAllowUsers struct { + meta + // The user identifiers, total number of users in all rules must not exceed 1000 + UserIds []int32 `json:"user_ids"` +} + +func (entity *UserPrivacySettingRuleAllowUsers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleAllowUsers + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleAllowUsers) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleAllowUsers) GetType() string { + return TypeUserPrivacySettingRuleAllowUsers +} + +func (*UserPrivacySettingRuleAllowUsers) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleAllowUsers +} + +// A rule to allow all members of certain specified basic groups and supergroups to doing something +type UserPrivacySettingRuleAllowChatMembers struct { + meta + // The chat identifiers, total number of chats in all rules must not exceed 20 + ChatIds []int64 `json:"chat_ids"` +} + +func (entity *UserPrivacySettingRuleAllowChatMembers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleAllowChatMembers + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleAllowChatMembers) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleAllowChatMembers) GetType() string { + return TypeUserPrivacySettingRuleAllowChatMembers +} + +func (*UserPrivacySettingRuleAllowChatMembers) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleAllowChatMembers +} + +// A rule to restrict all users from doing something +type UserPrivacySettingRuleRestrictAll struct { + meta +} + +func (entity *UserPrivacySettingRuleRestrictAll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleRestrictAll + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleRestrictAll) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleRestrictAll) GetType() string { + return TypeUserPrivacySettingRuleRestrictAll +} + +func (*UserPrivacySettingRuleRestrictAll) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleRestrictAll +} + +// A rule to restrict all contacts of a user from doing something +type UserPrivacySettingRuleRestrictContacts struct { + meta +} + +func (entity *UserPrivacySettingRuleRestrictContacts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleRestrictContacts + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleRestrictContacts) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleRestrictContacts) GetType() string { + return TypeUserPrivacySettingRuleRestrictContacts +} + +func (*UserPrivacySettingRuleRestrictContacts) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleRestrictContacts +} + +// A rule to restrict all specified users from doing something +type UserPrivacySettingRuleRestrictUsers struct { + meta + // The user identifiers, total number of users in all rules must not exceed 1000 + UserIds []int32 `json:"user_ids"` +} + +func (entity *UserPrivacySettingRuleRestrictUsers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleRestrictUsers + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleRestrictUsers) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleRestrictUsers) GetType() string { + return TypeUserPrivacySettingRuleRestrictUsers +} + +func (*UserPrivacySettingRuleRestrictUsers) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleRestrictUsers +} + +// A rule to restrict all members of specified basic groups and supergroups from doing something +type UserPrivacySettingRuleRestrictChatMembers struct { + meta + // The chat identifiers, total number of chats in all rules must not exceed 20 + ChatIds []int64 `json:"chat_ids"` +} + +func (entity *UserPrivacySettingRuleRestrictChatMembers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleRestrictChatMembers + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleRestrictChatMembers) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleRestrictChatMembers) GetType() string { + return TypeUserPrivacySettingRuleRestrictChatMembers +} + +func (*UserPrivacySettingRuleRestrictChatMembers) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleRestrictChatMembers +} + +// 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 { + meta + // A list of rules + Rules []UserPrivacySettingRule `json:"rules"` +} + +func (entity *UserPrivacySettingRules) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRules + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRules) GetClass() string { + return ClassUserPrivacySettingRules +} + +func (*UserPrivacySettingRules) GetType() string { + return TypeUserPrivacySettingRules +} + +func (userPrivacySettingRules *UserPrivacySettingRules) UnmarshalJSON(data []byte) error { + var tmp struct { + Rules []json.RawMessage `json:"rules"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldRules, _ := UnmarshalListOfUserPrivacySettingRule(tmp.Rules) + userPrivacySettingRules.Rules = fieldRules + + return nil +} + +// A privacy setting for managing whether the user's online status is visible +type UserPrivacySettingShowStatus struct { + meta +} + +func (entity *UserPrivacySettingShowStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingShowStatus + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingShowStatus) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingShowStatus) GetType() string { + return TypeUserPrivacySettingShowStatus +} + +func (*UserPrivacySettingShowStatus) UserPrivacySettingType() string { + return TypeUserPrivacySettingShowStatus +} + +// 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 +} + +// A privacy setting for managing whether the user's phone number is visible +type UserPrivacySettingShowPhoneNumber struct { + meta +} + +func (entity *UserPrivacySettingShowPhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingShowPhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingShowPhoneNumber) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingShowPhoneNumber) GetType() string { + return TypeUserPrivacySettingShowPhoneNumber +} + +func (*UserPrivacySettingShowPhoneNumber) UserPrivacySettingType() string { + return TypeUserPrivacySettingShowPhoneNumber +} + +// A privacy setting for managing whether the user can be invited to chats +type UserPrivacySettingAllowChatInvites struct { + meta +} + +func (entity *UserPrivacySettingAllowChatInvites) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingAllowChatInvites + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingAllowChatInvites) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingAllowChatInvites) GetType() string { + return TypeUserPrivacySettingAllowChatInvites +} + +func (*UserPrivacySettingAllowChatInvites) UserPrivacySettingType() string { + return TypeUserPrivacySettingAllowChatInvites +} + +// A privacy setting for managing whether the user can be called +type UserPrivacySettingAllowCalls struct { + meta +} + +func (entity *UserPrivacySettingAllowCalls) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingAllowCalls + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingAllowCalls) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingAllowCalls) GetType() string { + return TypeUserPrivacySettingAllowCalls +} + +func (*UserPrivacySettingAllowCalls) UserPrivacySettingType() string { + return TypeUserPrivacySettingAllowCalls +} + +// 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 +} + +// A privacy setting for managing whether the user can be found by their phone number. Checked only if the phone number is not known to the other user. Can be set only to "Allow contacts" or "Allow all" +type UserPrivacySettingAllowFindingByPhoneNumber struct { + meta +} + +func (entity *UserPrivacySettingAllowFindingByPhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingAllowFindingByPhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingAllowFindingByPhoneNumber) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingAllowFindingByPhoneNumber) GetType() string { + return TypeUserPrivacySettingAllowFindingByPhoneNumber +} + +func (*UserPrivacySettingAllowFindingByPhoneNumber) UserPrivacySettingType() string { + return TypeUserPrivacySettingAllowFindingByPhoneNumber +} + +// Contains information about the period of inactivity after which the current user's account will automatically be deleted +type AccountTtl struct { + meta + // Number of days of inactivity before the account will be flagged for deletion; should range from 30-366 days + Days int32 `json:"days"` +} + +func (entity *AccountTtl) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AccountTtl + + return json.Marshal((*stub)(entity)) +} + +func (*AccountTtl) GetClass() string { + return ClassAccountTtl +} + +func (*AccountTtl) GetType() string { + return TypeAccountTtl +} + +// 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 +type Session struct { + meta + // Session identifier + Id JsonInt64 `json:"id"` + // True, if this session is the current session + IsCurrent bool `json:"is_current"` + // True, if a password is needed to complete authorization of the session + IsPasswordPending bool `json:"is_password_pending"` + // 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"` +} + +func (entity *Session) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Session + + return json.Marshal((*stub)(entity)) +} + +func (*Session) GetClass() string { + return ClassSession +} + +func (*Session) GetType() string { + return TypeSession +} + +// Contains a list of sessions +type Sessions struct { + meta + // List of sessions + Sessions []*Session `json:"sessions"` +} + +func (entity *Sessions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Sessions + + return json.Marshal((*stub)(entity)) +} + +func (*Sessions) GetClass() string { + return ClassSessions +} + +func (*Sessions) GetType() string { + return TypeSessions +} + +// Contains information about one website the current user is logged in with Telegram +type ConnectedWebsite struct { + 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"` +} + +func (entity *ConnectedWebsite) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ConnectedWebsite + + return json.Marshal((*stub)(entity)) +} + +func (*ConnectedWebsite) GetClass() string { + return ClassConnectedWebsite +} + +func (*ConnectedWebsite) GetType() string { + return TypeConnectedWebsite +} + +// Contains a list of websites the current user is logged in with Telegram +type ConnectedWebsites struct { + meta + // List of connected websites + Websites []*ConnectedWebsite `json:"websites"` +} + +func (entity *ConnectedWebsites) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ConnectedWebsites + + return json.Marshal((*stub)(entity)) +} + +func (*ConnectedWebsites) GetClass() string { + return ClassConnectedWebsites +} + +func (*ConnectedWebsites) GetType() string { + return TypeConnectedWebsites +} + +// The chat contains spam messages +type ChatReportReasonSpam struct { + meta +} + +func (entity *ChatReportReasonSpam) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatReportReasonSpam + + return json.Marshal((*stub)(entity)) +} + +func (*ChatReportReasonSpam) GetClass() string { + return ClassChatReportReason +} + +func (*ChatReportReasonSpam) GetType() string { + return TypeChatReportReasonSpam +} + +func (*ChatReportReasonSpam) ChatReportReasonType() string { + return TypeChatReportReasonSpam +} + +// The chat promotes violence +type ChatReportReasonViolence struct { + meta +} + +func (entity *ChatReportReasonViolence) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatReportReasonViolence + + return json.Marshal((*stub)(entity)) +} + +func (*ChatReportReasonViolence) GetClass() string { + return ClassChatReportReason +} + +func (*ChatReportReasonViolence) GetType() string { + return TypeChatReportReasonViolence +} + +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 +} + +// The chat has child abuse related content +type ChatReportReasonChildAbuse struct { + meta +} + +func (entity *ChatReportReasonChildAbuse) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatReportReasonChildAbuse + + return json.Marshal((*stub)(entity)) +} + +func (*ChatReportReasonChildAbuse) GetClass() string { + return ClassChatReportReason +} + +func (*ChatReportReasonChildAbuse) GetType() string { + return TypeChatReportReasonChildAbuse +} + +func (*ChatReportReasonChildAbuse) ChatReportReasonType() string { + return TypeChatReportReasonChildAbuse +} + +// The chat contains copyrighted content +type ChatReportReasonCopyright struct { + meta +} + +func (entity *ChatReportReasonCopyright) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatReportReasonCopyright + + return json.Marshal((*stub)(entity)) +} + +func (*ChatReportReasonCopyright) GetClass() string { + return ClassChatReportReason +} + +func (*ChatReportReasonCopyright) GetType() string { + return TypeChatReportReasonCopyright +} + +func (*ChatReportReasonCopyright) ChatReportReasonType() string { + return TypeChatReportReasonCopyright +} + +// The location-based chat is unrelated to its stated location +type ChatReportReasonUnrelatedLocation struct { + meta +} + +func (entity *ChatReportReasonUnrelatedLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatReportReasonUnrelatedLocation + + return json.Marshal((*stub)(entity)) +} + +func (*ChatReportReasonUnrelatedLocation) GetClass() string { + return ClassChatReportReason +} + +func (*ChatReportReasonUnrelatedLocation) GetType() string { + return TypeChatReportReasonUnrelatedLocation +} + +func (*ChatReportReasonUnrelatedLocation) ChatReportReasonType() string { + return TypeChatReportReasonUnrelatedLocation +} + +// A custom reason provided by the user +type ChatReportReasonCustom struct { + meta + // Report text + Text string `json:"text"` +} + +func (entity *ChatReportReasonCustom) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatReportReasonCustom + + return json.Marshal((*stub)(entity)) +} + +func (*ChatReportReasonCustom) GetClass() string { + return ClassChatReportReason +} + +func (*ChatReportReasonCustom) GetType() string { + return TypeChatReportReasonCustom +} + +func (*ChatReportReasonCustom) ChatReportReasonType() string { + return TypeChatReportReasonCustom +} + +// Contains an HTTPS link to a message in a supergroup or channel +type MessageLink struct { + meta + // Message link + Link string `json:"link"` + // True, if the link will work for non-members of the chat + IsPublic bool `json:"is_public"` +} + +func (entity *MessageLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageLink + + return json.Marshal((*stub)(entity)) +} + +func (*MessageLink) GetClass() string { + return ClassMessageLink +} + +func (*MessageLink) GetType() string { + return TypeMessageLink +} + +// 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"` + // True, if the message is linked as a channel post comment or from a message thread + ForComment bool `json:"for_comment"` +} + +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 +} + +// 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 +} + +// The data is not a file +type FileTypeNone struct { + meta +} + +func (entity *FileTypeNone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeNone + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeNone) GetClass() string { + return ClassFileType +} + +func (*FileTypeNone) GetType() string { + return TypeFileTypeNone +} + +func (*FileTypeNone) FileTypeType() string { + return TypeFileTypeNone +} + +// The file is an animation +type FileTypeAnimation struct { + meta +} + +func (entity *FileTypeAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeAnimation) GetClass() string { + return ClassFileType +} + +func (*FileTypeAnimation) GetType() string { + return TypeFileTypeAnimation +} + +func (*FileTypeAnimation) FileTypeType() string { + return TypeFileTypeAnimation +} + +// The file is an audio file +type FileTypeAudio struct { + meta +} + +func (entity *FileTypeAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeAudio + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeAudio) GetClass() string { + return ClassFileType +} + +func (*FileTypeAudio) GetType() string { + return TypeFileTypeAudio +} + +func (*FileTypeAudio) FileTypeType() string { + return TypeFileTypeAudio +} + +// The file is a document +type FileTypeDocument struct { + meta +} + +func (entity *FileTypeDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeDocument + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeDocument) GetClass() string { + return ClassFileType +} + +func (*FileTypeDocument) GetType() string { + return TypeFileTypeDocument +} + +func (*FileTypeDocument) FileTypeType() string { + return TypeFileTypeDocument +} + +// The file is a photo +type FileTypePhoto struct { + meta +} + +func (entity *FileTypePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypePhoto) GetClass() string { + return ClassFileType +} + +func (*FileTypePhoto) GetType() string { + return TypeFileTypePhoto +} + +func (*FileTypePhoto) FileTypeType() string { + return TypeFileTypePhoto +} + +// The file is a profile photo +type FileTypeProfilePhoto struct { + meta +} + +func (entity *FileTypeProfilePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeProfilePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeProfilePhoto) GetClass() string { + return ClassFileType +} + +func (*FileTypeProfilePhoto) GetType() string { + return TypeFileTypeProfilePhoto +} + +func (*FileTypeProfilePhoto) FileTypeType() string { + return TypeFileTypeProfilePhoto +} + +// The file was sent to a secret chat (the file type is not known to the server) +type FileTypeSecret struct { + meta +} + +func (entity *FileTypeSecret) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSecret + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSecret) GetClass() string { + return ClassFileType +} + +func (*FileTypeSecret) GetType() string { + return TypeFileTypeSecret +} + +func (*FileTypeSecret) FileTypeType() string { + return TypeFileTypeSecret +} + +// The file is a thumbnail of a file from a secret chat +type FileTypeSecretThumbnail struct { + meta +} + +func (entity *FileTypeSecretThumbnail) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSecretThumbnail + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSecretThumbnail) GetClass() string { + return ClassFileType +} + +func (*FileTypeSecretThumbnail) GetType() string { + return TypeFileTypeSecretThumbnail +} + +func (*FileTypeSecretThumbnail) FileTypeType() string { + return TypeFileTypeSecretThumbnail +} + +// The file is a file from Secure storage used for storing Telegram Passport files +type FileTypeSecure struct { + meta +} + +func (entity *FileTypeSecure) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSecure + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSecure) GetClass() string { + return ClassFileType +} + +func (*FileTypeSecure) GetType() string { + return TypeFileTypeSecure +} + +func (*FileTypeSecure) FileTypeType() string { + return TypeFileTypeSecure +} + +// The file is a sticker +type FileTypeSticker struct { + meta +} + +func (entity *FileTypeSticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSticker + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSticker) GetClass() string { + return ClassFileType +} + +func (*FileTypeSticker) GetType() string { + return TypeFileTypeSticker +} + +func (*FileTypeSticker) FileTypeType() string { + return TypeFileTypeSticker +} + +// The file is a thumbnail of another file +type FileTypeThumbnail struct { + meta +} + +func (entity *FileTypeThumbnail) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeThumbnail + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeThumbnail) GetClass() string { + return ClassFileType +} + +func (*FileTypeThumbnail) GetType() string { + return TypeFileTypeThumbnail +} + +func (*FileTypeThumbnail) FileTypeType() string { + return TypeFileTypeThumbnail +} + +// The file type is not yet known +type FileTypeUnknown struct { + meta +} + +func (entity *FileTypeUnknown) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeUnknown + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeUnknown) GetClass() string { + return ClassFileType +} + +func (*FileTypeUnknown) GetType() string { + return TypeFileTypeUnknown +} + +func (*FileTypeUnknown) FileTypeType() string { + return TypeFileTypeUnknown +} + +// The file is a video +type FileTypeVideo struct { + meta +} + +func (entity *FileTypeVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeVideo + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeVideo) GetClass() string { + return ClassFileType +} + +func (*FileTypeVideo) GetType() string { + return TypeFileTypeVideo +} + +func (*FileTypeVideo) FileTypeType() string { + return TypeFileTypeVideo +} + +// The file is a video note +type FileTypeVideoNote struct { + meta +} + +func (entity *FileTypeVideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeVideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeVideoNote) GetClass() string { + return ClassFileType +} + +func (*FileTypeVideoNote) GetType() string { + return TypeFileTypeVideoNote +} + +func (*FileTypeVideoNote) FileTypeType() string { + return TypeFileTypeVideoNote +} + +// The file is a voice note +type FileTypeVoiceNote struct { + meta +} + +func (entity *FileTypeVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeVoiceNote) GetClass() string { + return ClassFileType +} + +func (*FileTypeVoiceNote) GetType() string { + return TypeFileTypeVoiceNote +} + +func (*FileTypeVoiceNote) FileTypeType() string { + return TypeFileTypeVoiceNote +} + +// The file is a wallpaper or a background pattern +type FileTypeWallpaper struct { + meta +} + +func (entity *FileTypeWallpaper) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeWallpaper + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeWallpaper) GetClass() string { + return ClassFileType +} + +func (*FileTypeWallpaper) GetType() string { + return TypeFileTypeWallpaper +} + +func (*FileTypeWallpaper) FileTypeType() string { + return TypeFileTypeWallpaper +} + +// Contains the storage usage statistics for a specific file type +type StorageStatisticsByFileType struct { + 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"` +} + +func (entity *StorageStatisticsByFileType) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorageStatisticsByFileType + + return json.Marshal((*stub)(entity)) +} + +func (*StorageStatisticsByFileType) GetClass() string { + return ClassStorageStatisticsByFileType +} + +func (*StorageStatisticsByFileType) GetType() string { + return TypeStorageStatisticsByFileType +} + +func (storageStatisticsByFileType *StorageStatisticsByFileType) UnmarshalJSON(data []byte) error { + var tmp struct { + FileType json.RawMessage `json:"file_type"` + Size int64 `json:"size"` + Count int32 `json:"count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + storageStatisticsByFileType.Size = tmp.Size + storageStatisticsByFileType.Count = tmp.Count + + fieldFileType, _ := UnmarshalFileType(tmp.FileType) + storageStatisticsByFileType.FileType = fieldFileType + + return nil +} + +// Contains the storage usage statistics for a specific chat +type StorageStatisticsByChat struct { + 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"` +} + +func (entity *StorageStatisticsByChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorageStatisticsByChat + + return json.Marshal((*stub)(entity)) +} + +func (*StorageStatisticsByChat) GetClass() string { + return ClassStorageStatisticsByChat +} + +func (*StorageStatisticsByChat) GetType() string { + return TypeStorageStatisticsByChat +} + +// Contains the exact storage usage statistics split by chats and file type +type StorageStatistics struct { + 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"` +} + +func (entity *StorageStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorageStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*StorageStatistics) GetClass() string { + return ClassStorageStatistics +} + +func (*StorageStatistics) GetType() string { + return TypeStorageStatistics +} + +// Contains approximate storage usage statistics, excluding files of unknown file type +type StorageStatisticsFast struct { + 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"` + // Size of the language pack database + LanguagePackDatabaseSize int64 `json:"language_pack_database_size"` + // Size of the TDLib internal log + LogSize int64 `json:"log_size"` +} + +func (entity *StorageStatisticsFast) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorageStatisticsFast + + return json.Marshal((*stub)(entity)) +} + +func (*StorageStatisticsFast) GetClass() string { + return ClassStorageStatisticsFast +} + +func (*StorageStatisticsFast) GetType() string { + return TypeStorageStatisticsFast +} + +// 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 +} + +// The network is not available +type NetworkTypeNone struct { + meta +} + +func (entity *NetworkTypeNone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NetworkTypeNone + + return json.Marshal((*stub)(entity)) +} + +func (*NetworkTypeNone) GetClass() string { + return ClassNetworkType +} + +func (*NetworkTypeNone) GetType() string { + return TypeNetworkTypeNone +} + +func (*NetworkTypeNone) NetworkTypeType() string { + return TypeNetworkTypeNone +} + +// A mobile network +type NetworkTypeMobile struct { + meta +} + +func (entity *NetworkTypeMobile) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NetworkTypeMobile + + return json.Marshal((*stub)(entity)) +} + +func (*NetworkTypeMobile) GetClass() string { + return ClassNetworkType +} + +func (*NetworkTypeMobile) GetType() string { + return TypeNetworkTypeMobile +} + +func (*NetworkTypeMobile) NetworkTypeType() string { + return TypeNetworkTypeMobile +} + +// A mobile roaming network +type NetworkTypeMobileRoaming struct { + meta +} + +func (entity *NetworkTypeMobileRoaming) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NetworkTypeMobileRoaming + + return json.Marshal((*stub)(entity)) +} + +func (*NetworkTypeMobileRoaming) GetClass() string { + return ClassNetworkType +} + +func (*NetworkTypeMobileRoaming) GetType() string { + return TypeNetworkTypeMobileRoaming +} + +func (*NetworkTypeMobileRoaming) NetworkTypeType() string { + return TypeNetworkTypeMobileRoaming +} + +// A Wi-Fi network +type NetworkTypeWiFi struct { + meta +} + +func (entity *NetworkTypeWiFi) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NetworkTypeWiFi + + return json.Marshal((*stub)(entity)) +} + +func (*NetworkTypeWiFi) GetClass() string { + return ClassNetworkType +} + +func (*NetworkTypeWiFi) GetType() string { + return TypeNetworkTypeWiFi +} + +func (*NetworkTypeWiFi) NetworkTypeType() string { + return TypeNetworkTypeWiFi +} + +// A different network type (e.g., Ethernet network) +type NetworkTypeOther struct { + meta +} + +func (entity *NetworkTypeOther) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NetworkTypeOther + + return json.Marshal((*stub)(entity)) +} + +func (*NetworkTypeOther) GetClass() string { + return ClassNetworkType +} + +func (*NetworkTypeOther) GetType() string { + return TypeNetworkTypeOther +} + +func (*NetworkTypeOther) NetworkTypeType() string { + return TypeNetworkTypeOther +} + +// Contains information about the total amount of data that was used to send and receive files +type NetworkStatisticsEntryFile struct { + 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"` +} + +func (entity *NetworkStatisticsEntryFile) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NetworkStatisticsEntryFile + + return json.Marshal((*stub)(entity)) +} + +func (*NetworkStatisticsEntryFile) GetClass() string { + return ClassNetworkStatisticsEntry +} + +func (*NetworkStatisticsEntryFile) GetType() string { + return TypeNetworkStatisticsEntryFile +} + +func (*NetworkStatisticsEntryFile) NetworkStatisticsEntryType() string { + return TypeNetworkStatisticsEntryFile +} + +func (networkStatisticsEntryFile *NetworkStatisticsEntryFile) UnmarshalJSON(data []byte) error { + 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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + networkStatisticsEntryFile.SentBytes = tmp.SentBytes + networkStatisticsEntryFile.ReceivedBytes = tmp.ReceivedBytes + + fieldFileType, _ := UnmarshalFileType(tmp.FileType) + networkStatisticsEntryFile.FileType = fieldFileType + + fieldNetworkType, _ := UnmarshalNetworkType(tmp.NetworkType) + networkStatisticsEntryFile.NetworkType = fieldNetworkType + + return nil +} + +// Contains information about the total amount of data that was used for calls +type NetworkStatisticsEntryCall struct { + 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"` +} + +func (entity *NetworkStatisticsEntryCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NetworkStatisticsEntryCall + + return json.Marshal((*stub)(entity)) +} + +func (*NetworkStatisticsEntryCall) GetClass() string { + return ClassNetworkStatisticsEntry +} + +func (*NetworkStatisticsEntryCall) GetType() string { + return TypeNetworkStatisticsEntryCall +} + +func (*NetworkStatisticsEntryCall) NetworkStatisticsEntryType() string { + return TypeNetworkStatisticsEntryCall +} + +func (networkStatisticsEntryCall *NetworkStatisticsEntryCall) UnmarshalJSON(data []byte) error { + var tmp struct { + NetworkType json.RawMessage `json:"network_type"` + SentBytes int64 `json:"sent_bytes"` + ReceivedBytes int64 `json:"received_bytes"` + Duration float64 `json:"duration"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + networkStatisticsEntryCall.SentBytes = tmp.SentBytes + networkStatisticsEntryCall.ReceivedBytes = tmp.ReceivedBytes + networkStatisticsEntryCall.Duration = tmp.Duration + + fieldNetworkType, _ := UnmarshalNetworkType(tmp.NetworkType) + networkStatisticsEntryCall.NetworkType = fieldNetworkType + + return nil +} + +// A full list of available network statistic entries +type NetworkStatistics struct { + meta + // Point in time (Unix timestamp) from which the statistics are collected + SinceDate int32 `json:"since_date"` + // Network statistics entries + Entries []NetworkStatisticsEntry `json:"entries"` +} + +func (entity *NetworkStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NetworkStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*NetworkStatistics) GetClass() string { + return ClassNetworkStatistics +} + +func (*NetworkStatistics) GetType() string { + return TypeNetworkStatistics +} + +func (networkStatistics *NetworkStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + SinceDate int32 `json:"since_date"` + Entries []json.RawMessage `json:"entries"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + networkStatistics.SinceDate = tmp.SinceDate + + fieldEntries, _ := UnmarshalListOfNetworkStatisticsEntry(tmp.Entries) + networkStatistics.Entries = fieldEntries + + return nil +} + +// Contains auto-download settings +type AutoDownloadSettings struct { + meta + // True, if the auto-download is enabled + IsAutoDownloadEnabled bool `json:"is_auto_download_enabled"` + // The maximum size of a photo file to be auto-downloaded + MaxPhotoFileSize int32 `json:"max_photo_file_size"` + // The maximum size of a video file to be auto-downloaded + MaxVideoFileSize int32 `json:"max_video_file_size"` + // The maximum size of other file types to be auto-downloaded + MaxOtherFileSize int32 `json:"max_other_file_size"` + // The maximum suggested bitrate for uploaded videos + VideoUploadBitrate int32 `json:"video_upload_bitrate"` + // True, if the beginning of video files 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 +type ConnectionStateWaitingForNetwork struct { + meta +} + +func (entity *ConnectionStateWaitingForNetwork) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ConnectionStateWaitingForNetwork + + return json.Marshal((*stub)(entity)) +} + +func (*ConnectionStateWaitingForNetwork) GetClass() string { + return ClassConnectionState +} + +func (*ConnectionStateWaitingForNetwork) GetType() string { + return TypeConnectionStateWaitingForNetwork +} + +func (*ConnectionStateWaitingForNetwork) ConnectionStateType() string { + return TypeConnectionStateWaitingForNetwork +} + +// Currently establishing a connection with a proxy server +type ConnectionStateConnectingToProxy struct { + meta +} + +func (entity *ConnectionStateConnectingToProxy) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ConnectionStateConnectingToProxy + + return json.Marshal((*stub)(entity)) +} + +func (*ConnectionStateConnectingToProxy) GetClass() string { + return ClassConnectionState +} + +func (*ConnectionStateConnectingToProxy) GetType() string { + return TypeConnectionStateConnectingToProxy +} + +func (*ConnectionStateConnectingToProxy) ConnectionStateType() string { + return TypeConnectionStateConnectingToProxy +} + +// Currently establishing a connection to the Telegram servers +type ConnectionStateConnecting struct { + meta +} + +func (entity *ConnectionStateConnecting) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ConnectionStateConnecting + + return json.Marshal((*stub)(entity)) +} + +func (*ConnectionStateConnecting) GetClass() string { + return ClassConnectionState +} + +func (*ConnectionStateConnecting) GetType() string { + return TypeConnectionStateConnecting +} + +func (*ConnectionStateConnecting) ConnectionStateType() string { + return TypeConnectionStateConnecting +} + +// Downloading data received while the application was offline +type ConnectionStateUpdating struct { + meta +} + +func (entity *ConnectionStateUpdating) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ConnectionStateUpdating + + return json.Marshal((*stub)(entity)) +} + +func (*ConnectionStateUpdating) GetClass() string { + return ClassConnectionState +} + +func (*ConnectionStateUpdating) GetType() string { + return TypeConnectionStateUpdating +} + +func (*ConnectionStateUpdating) ConnectionStateType() string { + return TypeConnectionStateUpdating +} + +// There is a working connection to the Telegram servers +type ConnectionStateReady struct { + meta +} + +func (entity *ConnectionStateReady) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ConnectionStateReady + + return json.Marshal((*stub)(entity)) +} + +func (*ConnectionStateReady) GetClass() string { + return ClassConnectionState +} + +func (*ConnectionStateReady) GetType() string { + return TypeConnectionStateReady +} + +func (*ConnectionStateReady) ConnectionStateType() string { + return TypeConnectionStateReady +} + +// A category containing frequently used private chats with non-bot users +type TopChatCategoryUsers struct { + meta +} + +func (entity *TopChatCategoryUsers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TopChatCategoryUsers + + return json.Marshal((*stub)(entity)) +} + +func (*TopChatCategoryUsers) GetClass() string { + return ClassTopChatCategory +} + +func (*TopChatCategoryUsers) GetType() string { + return TypeTopChatCategoryUsers +} + +func (*TopChatCategoryUsers) TopChatCategoryType() string { + return TypeTopChatCategoryUsers +} + +// A category containing frequently used private chats with bot users +type TopChatCategoryBots struct { + meta +} + +func (entity *TopChatCategoryBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TopChatCategoryBots + + return json.Marshal((*stub)(entity)) +} + +func (*TopChatCategoryBots) GetClass() string { + return ClassTopChatCategory +} + +func (*TopChatCategoryBots) GetType() string { + return TypeTopChatCategoryBots +} + +func (*TopChatCategoryBots) TopChatCategoryType() string { + return TypeTopChatCategoryBots +} + +// A category containing frequently used basic groups and supergroups +type TopChatCategoryGroups struct { + meta +} + +func (entity *TopChatCategoryGroups) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TopChatCategoryGroups + + return json.Marshal((*stub)(entity)) +} + +func (*TopChatCategoryGroups) GetClass() string { + return ClassTopChatCategory +} + +func (*TopChatCategoryGroups) GetType() string { + return TypeTopChatCategoryGroups +} + +func (*TopChatCategoryGroups) TopChatCategoryType() string { + return TypeTopChatCategoryGroups +} + +// A category containing frequently used channels +type TopChatCategoryChannels struct { + meta +} + +func (entity *TopChatCategoryChannels) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TopChatCategoryChannels + + return json.Marshal((*stub)(entity)) +} + +func (*TopChatCategoryChannels) GetClass() string { + return ClassTopChatCategory +} + +func (*TopChatCategoryChannels) GetType() string { + return TypeTopChatCategoryChannels +} + +func (*TopChatCategoryChannels) TopChatCategoryType() string { + return TypeTopChatCategoryChannels +} + +// A category containing frequently used chats with inline bots sorted by their usage in inline mode +type TopChatCategoryInlineBots struct { + meta +} + +func (entity *TopChatCategoryInlineBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TopChatCategoryInlineBots + + return json.Marshal((*stub)(entity)) +} + +func (*TopChatCategoryInlineBots) GetClass() string { + return ClassTopChatCategory +} + +func (*TopChatCategoryInlineBots) GetType() string { + return TypeTopChatCategoryInlineBots +} + +func (*TopChatCategoryInlineBots) TopChatCategoryType() string { + return TypeTopChatCategoryInlineBots +} + +// A category containing frequently used chats used for calls +type TopChatCategoryCalls struct { + meta +} + +func (entity *TopChatCategoryCalls) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TopChatCategoryCalls + + return json.Marshal((*stub)(entity)) +} + +func (*TopChatCategoryCalls) GetClass() string { + return ClassTopChatCategory +} + +func (*TopChatCategoryCalls) GetType() string { + return TypeTopChatCategoryCalls +} + +func (*TopChatCategoryCalls) TopChatCategoryType() string { + return TypeTopChatCategoryCalls +} + +// A category containing frequently used chats used to forward messages +type TopChatCategoryForwardChats struct { + meta +} + +func (entity *TopChatCategoryForwardChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TopChatCategoryForwardChats + + return json.Marshal((*stub)(entity)) +} + +func (*TopChatCategoryForwardChats) GetClass() string { + return ClassTopChatCategory +} + +func (*TopChatCategoryForwardChats) GetType() string { + return TypeTopChatCategoryForwardChats +} + +func (*TopChatCategoryForwardChats) TopChatCategoryType() string { + return TypeTopChatCategoryForwardChats +} + +// A URL linking to a user +type TMeUrlTypeUser struct { + meta + // Identifier of the user + UserId int32 `json:"user_id"` +} + +func (entity *TMeUrlTypeUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TMeUrlTypeUser + + return json.Marshal((*stub)(entity)) +} + +func (*TMeUrlTypeUser) GetClass() string { + return ClassTMeUrlType +} + +func (*TMeUrlTypeUser) GetType() string { + return TypeTMeUrlTypeUser +} + +func (*TMeUrlTypeUser) TMeUrlTypeType() string { + return TypeTMeUrlTypeUser +} + +// A URL linking to a public supergroup or channel +type TMeUrlTypeSupergroup struct { + meta + // Identifier of the supergroup or channel + SupergroupId int64 `json:"supergroup_id"` +} + +func (entity *TMeUrlTypeSupergroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TMeUrlTypeSupergroup + + return json.Marshal((*stub)(entity)) +} + +func (*TMeUrlTypeSupergroup) GetClass() string { + return ClassTMeUrlType +} + +func (*TMeUrlTypeSupergroup) GetType() string { + return TypeTMeUrlTypeSupergroup +} + +func (*TMeUrlTypeSupergroup) TMeUrlTypeType() string { + return TypeTMeUrlTypeSupergroup +} + +// A chat invite link +type TMeUrlTypeChatInvite struct { + meta + // Chat invite link info + Info *ChatInviteLinkInfo `json:"info"` +} + +func (entity *TMeUrlTypeChatInvite) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TMeUrlTypeChatInvite + + return json.Marshal((*stub)(entity)) +} + +func (*TMeUrlTypeChatInvite) GetClass() string { + return ClassTMeUrlType +} + +func (*TMeUrlTypeChatInvite) GetType() string { + return TypeTMeUrlTypeChatInvite +} + +func (*TMeUrlTypeChatInvite) TMeUrlTypeType() string { + return TypeTMeUrlTypeChatInvite +} + +// A URL linking to a sticker set +type TMeUrlTypeStickerSet struct { + meta + // Identifier of the sticker set + StickerSetId JsonInt64 `json:"sticker_set_id"` +} + +func (entity *TMeUrlTypeStickerSet) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TMeUrlTypeStickerSet + + return json.Marshal((*stub)(entity)) +} + +func (*TMeUrlTypeStickerSet) GetClass() string { + return ClassTMeUrlType +} + +func (*TMeUrlTypeStickerSet) GetType() string { + return TypeTMeUrlTypeStickerSet +} + +func (*TMeUrlTypeStickerSet) TMeUrlTypeType() string { + return TypeTMeUrlTypeStickerSet +} + +// Represents a URL linking to an internal Telegram entity +type TMeUrl struct { + meta + // URL + Url string `json:"url"` + // Type of the URL + Type TMeUrlType `json:"type"` +} + +func (entity *TMeUrl) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TMeUrl + + return json.Marshal((*stub)(entity)) +} + +func (*TMeUrl) GetClass() string { + return ClassTMeUrl +} + +func (*TMeUrl) GetType() string { + return TypeTMeUrl +} + +func (tMeUrl *TMeUrl) UnmarshalJSON(data []byte) error { + var tmp struct { + Url string `json:"url"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + tMeUrl.Url = tmp.Url + + fieldType, _ := UnmarshalTMeUrlType(tmp.Type) + tMeUrl.Type = fieldType + + return nil +} + +// Contains a list of t.me URLs +type TMeUrls struct { + meta + // List of URLs + Urls []*TMeUrl `json:"urls"` +} + +func (entity *TMeUrls) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TMeUrls + + return json.Marshal((*stub)(entity)) +} + +func (*TMeUrls) GetClass() string { + return ClassTMeUrls +} + +func (*TMeUrls) GetType() string { + return TypeTMeUrls +} + +// Suggests the user to enable "archive_and_mute_new_chats_from_unknown_users" option +type SuggestedActionEnableArchiveAndMuteNewChats struct { + meta +} + +func (entity *SuggestedActionEnableArchiveAndMuteNewChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionEnableArchiveAndMuteNewChats + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionEnableArchiveAndMuteNewChats) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionEnableArchiveAndMuteNewChats) GetType() string { + return TypeSuggestedActionEnableArchiveAndMuteNewChats +} + +func (*SuggestedActionEnableArchiveAndMuteNewChats) SuggestedActionType() string { + return TypeSuggestedActionEnableArchiveAndMuteNewChats +} + +// Suggests the user to check authorization phone number and change the phone number if it is inaccessible +type SuggestedActionCheckPhoneNumber struct { + meta +} + +func (entity *SuggestedActionCheckPhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionCheckPhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionCheckPhoneNumber) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionCheckPhoneNumber) GetType() string { + return TypeSuggestedActionCheckPhoneNumber +} + +func (*SuggestedActionCheckPhoneNumber) SuggestedActionType() string { + return TypeSuggestedActionCheckPhoneNumber +} + +// Contains a counter +type Count struct { + meta + // Count + Count int32 `json:"count"` +} + +func (entity *Count) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Count + + return json.Marshal((*stub)(entity)) +} + +func (*Count) GetClass() string { + return ClassCount +} + +func (*Count) GetType() string { + return TypeCount +} + +// Contains some text +type Text struct { + meta + // Text + Text string `json:"text"` +} + +func (entity *Text) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Text + + return json.Marshal((*stub)(entity)) +} + +func (*Text) GetClass() string { + return ClassText +} + +func (*Text) GetType() string { + return TypeText +} + +// Contains a value representing a number of seconds +type Seconds struct { + meta + // Number of seconds + Seconds float64 `json:"seconds"` +} + +func (entity *Seconds) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Seconds + + return json.Marshal((*stub)(entity)) +} + +func (*Seconds) GetClass() string { + return ClassSeconds +} + +func (*Seconds) GetType() string { + return TypeSeconds +} + +// Contains information about a tg:// deep link +type DeepLinkInfo struct { + 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"` +} + +func (entity *DeepLinkInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeepLinkInfo + + return json.Marshal((*stub)(entity)) +} + +func (*DeepLinkInfo) GetClass() string { + return ClassDeepLinkInfo +} + +func (*DeepLinkInfo) GetType() string { + return TypeDeepLinkInfo +} + +// The text uses Markdown-style formatting +type TextParseModeMarkdown struct { + meta + // Version of the parser: 0 or 1 - Telegram Bot API "Markdown" parse mode, 2 - Telegram Bot API "MarkdownV2" parse mode + Version int32 `json:"version"` +} + +func (entity *TextParseModeMarkdown) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextParseModeMarkdown + + return json.Marshal((*stub)(entity)) +} + +func (*TextParseModeMarkdown) GetClass() string { + return ClassTextParseMode +} + +func (*TextParseModeMarkdown) GetType() string { + return TypeTextParseModeMarkdown +} + +func (*TextParseModeMarkdown) TextParseModeType() string { + return TypeTextParseModeMarkdown +} + +// The text uses HTML-style formatting. The same as Telegram Bot API "HTML" parse mode +type TextParseModeHTML struct { + meta +} + +func (entity *TextParseModeHTML) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextParseModeHTML + + return json.Marshal((*stub)(entity)) +} + +func (*TextParseModeHTML) GetClass() string { + return ClassTextParseMode +} + +func (*TextParseModeHTML) GetType() string { + return TypeTextParseModeHTML +} + +func (*TextParseModeHTML) TextParseModeType() string { + return TypeTextParseModeHTML +} + +// A SOCKS5 proxy server +type ProxyTypeSocks5 struct { + meta + // Username for logging in; may be empty + Username string `json:"username"` + // Password for logging in; may be empty + Password string `json:"password"` +} + +func (entity *ProxyTypeSocks5) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProxyTypeSocks5 + + return json.Marshal((*stub)(entity)) +} + +func (*ProxyTypeSocks5) GetClass() string { + return ClassProxyType +} + +func (*ProxyTypeSocks5) GetType() string { + return TypeProxyTypeSocks5 +} + +func (*ProxyTypeSocks5) ProxyTypeType() string { + return TypeProxyTypeSocks5 +} + +// A HTTP transparent proxy server +type ProxyTypeHttp struct { + 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"` +} + +func (entity *ProxyTypeHttp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProxyTypeHttp + + return json.Marshal((*stub)(entity)) +} + +func (*ProxyTypeHttp) GetClass() string { + return ClassProxyType +} + +func (*ProxyTypeHttp) GetType() string { + return TypeProxyTypeHttp +} + +func (*ProxyTypeHttp) ProxyTypeType() string { + return TypeProxyTypeHttp +} + +// An MTProto proxy server +type ProxyTypeMtproto struct { + meta + // The proxy's secret in hexadecimal encoding + Secret string `json:"secret"` +} + +func (entity *ProxyTypeMtproto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProxyTypeMtproto + + return json.Marshal((*stub)(entity)) +} + +func (*ProxyTypeMtproto) GetClass() string { + return ClassProxyType +} + +func (*ProxyTypeMtproto) GetType() string { + return TypeProxyTypeMtproto +} + +func (*ProxyTypeMtproto) ProxyTypeType() string { + return TypeProxyTypeMtproto +} + +// Contains information about a proxy server +type Proxy struct { + 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"` +} + +func (entity *Proxy) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Proxy + + return json.Marshal((*stub)(entity)) +} + +func (*Proxy) GetClass() string { + return ClassProxy +} + +func (*Proxy) GetType() string { + return TypeProxy +} + +func (proxy *Proxy) UnmarshalJSON(data []byte) error { + 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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + proxy.Id = tmp.Id + proxy.Server = tmp.Server + proxy.Port = tmp.Port + proxy.LastUsedDate = tmp.LastUsedDate + proxy.IsEnabled = tmp.IsEnabled + + fieldType, _ := UnmarshalProxyType(tmp.Type) + proxy.Type = fieldType + + return nil +} + +// Represents a list of proxy servers +type Proxies struct { + meta + // List of proxy servers + Proxies []*Proxy `json:"proxies"` +} + +func (entity *Proxies) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Proxies + + return json.Marshal((*stub)(entity)) +} + +func (*Proxies) GetClass() string { + return ClassProxies +} + +func (*Proxies) GetType() string { + return TypeProxies +} + +// A static sticker in PNG format, which will be converted to WEBP server-side +type InputStickerStatic struct { + meta + // PNG image with the sticker; must be up to 512 KB in size and fit in a 512x512 square + Sticker InputFile `json:"sticker"` + // Emojis 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"` +} + +func (entity *InputStickerStatic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStickerStatic + + return json.Marshal((*stub)(entity)) +} + +func (*InputStickerStatic) GetClass() string { + return ClassInputSticker +} + +func (*InputStickerStatic) GetType() string { + return TypeInputStickerStatic +} + +func (*InputStickerStatic) InputStickerType() string { + return TypeInputStickerStatic +} + +func (inputStickerStatic *InputStickerStatic) UnmarshalJSON(data []byte) error { + var tmp struct { + Sticker json.RawMessage `json:"sticker"` + Emojis string `json:"emojis"` + MaskPosition *MaskPosition `json:"mask_position"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputStickerStatic.Emojis = tmp.Emojis + inputStickerStatic.MaskPosition = tmp.MaskPosition + + fieldSticker, _ := UnmarshalInputFile(tmp.Sticker) + inputStickerStatic.Sticker = fieldSticker + + return nil +} + +// An animated sticker in TGS format +type InputStickerAnimated struct { + meta + // File with the animated sticker. Only local or uploaded within a week files are supported. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements + Sticker InputFile `json:"sticker"` + // Emojis corresponding to the sticker + Emojis string `json:"emojis"` +} + +func (entity *InputStickerAnimated) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStickerAnimated + + return json.Marshal((*stub)(entity)) +} + +func (*InputStickerAnimated) GetClass() string { + return ClassInputSticker +} + +func (*InputStickerAnimated) GetType() string { + return TypeInputStickerAnimated +} + +func (*InputStickerAnimated) InputStickerType() string { + return TypeInputStickerAnimated +} + +func (inputStickerAnimated *InputStickerAnimated) UnmarshalJSON(data []byte) error { + var tmp struct { + Sticker json.RawMessage `json:"sticker"` + Emojis string `json:"emojis"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputStickerAnimated.Emojis = tmp.Emojis + + fieldSticker, _ := UnmarshalInputFile(tmp.Sticker) + inputStickerAnimated.Sticker = fieldSticker + + return nil +} + +// Represents a date range +type DateRange struct { + meta + // Point in time (Unix timestamp) at which the date range begins + StartDate int32 `json:"start_date"` + // Point in time (Unix timestamp) at which the date range ends + EndDate int32 `json:"end_date"` +} + +func (entity *DateRange) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DateRange + + return json.Marshal((*stub)(entity)) +} + +func (*DateRange) GetClass() string { + return ClassDateRange +} + +func (*DateRange) GetType() string { + return TypeDateRange +} + +// A value with information about its recent changes +type StatisticalValue struct { + meta + // The current value + Value float64 `json:"value"` + // The value for the previous day + PreviousValue float64 `json:"previous_value"` + // The growth rate of the value, as a percentage + GrowthRatePercentage float64 `json:"growth_rate_percentage"` +} + +func (entity *StatisticalValue) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StatisticalValue + + return json.Marshal((*stub)(entity)) +} + +func (*StatisticalValue) GetClass() string { + return ClassStatisticalValue +} + +func (*StatisticalValue) GetType() string { + return TypeStatisticalValue +} + +// A graph data +type StatisticalGraphData struct { + meta + // Graph data in JSON format + JsonData string `json:"json_data"` + // If non-empty, a token which can be used to receive a zoomed in graph + ZoomToken string `json:"zoom_token"` +} + +func (entity *StatisticalGraphData) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StatisticalGraphData + + return json.Marshal((*stub)(entity)) +} + +func (*StatisticalGraphData) GetClass() string { + return ClassStatisticalGraph +} + +func (*StatisticalGraphData) GetType() string { + return TypeStatisticalGraphData +} + +func (*StatisticalGraphData) StatisticalGraphType() string { + return TypeStatisticalGraphData +} + +// The graph data to be asynchronously loaded through getStatisticalGraph +type StatisticalGraphAsync struct { + meta + // The token to use for data loading + Token string `json:"token"` +} + +func (entity *StatisticalGraphAsync) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StatisticalGraphAsync + + return json.Marshal((*stub)(entity)) +} + +func (*StatisticalGraphAsync) GetClass() string { + return ClassStatisticalGraph +} + +func (*StatisticalGraphAsync) GetType() string { + return TypeStatisticalGraphAsync +} + +func (*StatisticalGraphAsync) StatisticalGraphType() string { + return TypeStatisticalGraphAsync +} + +// An error message to be shown to the user instead of the graph +type StatisticalGraphError struct { + meta + // The error message + ErrorMessage string `json:"error_message"` +} + +func (entity *StatisticalGraphError) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StatisticalGraphError + + return json.Marshal((*stub)(entity)) +} + +func (*StatisticalGraphError) GetClass() string { + return ClassStatisticalGraph +} + +func (*StatisticalGraphError) GetType() string { + return TypeStatisticalGraphError +} + +func (*StatisticalGraphError) StatisticalGraphType() string { + return TypeStatisticalGraphError +} + +// Contains statistics about interactions with a message +type ChatStatisticsMessageInteractionInfo struct { + meta + // Message identifier + MessageId int64 `json:"message_id"` + // Number of times the message was viewed + ViewCount int32 `json:"view_count"` + // Number of times the message was forwarded + ForwardCount int32 `json:"forward_count"` +} + +func (entity *ChatStatisticsMessageInteractionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatStatisticsMessageInteractionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ChatStatisticsMessageInteractionInfo) GetClass() string { + return ClassChatStatisticsMessageInteractionInfo +} + +func (*ChatStatisticsMessageInteractionInfo) GetType() string { + return TypeChatStatisticsMessageInteractionInfo +} + +// Contains statistics about messages sent by a user +type ChatStatisticsMessageSenderInfo struct { + meta + // User identifier + UserId int32 `json:"user_id"` + // Number of sent messages + SentMessageCount int32 `json:"sent_message_count"` + // Average number of characters in sent messages + AverageCharacterCount int32 `json:"average_character_count"` +} + +func (entity *ChatStatisticsMessageSenderInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatStatisticsMessageSenderInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ChatStatisticsMessageSenderInfo) GetClass() string { + return ClassChatStatisticsMessageSenderInfo +} + +func (*ChatStatisticsMessageSenderInfo) GetType() string { + return TypeChatStatisticsMessageSenderInfo +} + +// Contains statistics about administrator actions done by a user +type ChatStatisticsAdministratorActionsInfo struct { + meta + // Administrator user identifier + UserId int32 `json:"user_id"` + // Number of messages deleted by the administrator + DeletedMessageCount int32 `json:"deleted_message_count"` + // Number of users banned by the administrator + BannedUserCount int32 `json:"banned_user_count"` + // Number of users restricted by the administrator + RestrictedUserCount int32 `json:"restricted_user_count"` +} + +func (entity *ChatStatisticsAdministratorActionsInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatStatisticsAdministratorActionsInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ChatStatisticsAdministratorActionsInfo) GetClass() string { + return ClassChatStatisticsAdministratorActionsInfo +} + +func (*ChatStatisticsAdministratorActionsInfo) GetType() string { + return TypeChatStatisticsAdministratorActionsInfo +} + +// Contains statistics about number of new members invited by a user +type ChatStatisticsInviterInfo struct { + meta + // User identifier + UserId int32 `json:"user_id"` + // Number of new members invited by the user + AddedMemberCount int32 `json:"added_member_count"` +} + +func (entity *ChatStatisticsInviterInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatStatisticsInviterInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ChatStatisticsInviterInfo) GetClass() string { + return ClassChatStatisticsInviterInfo +} + +func (*ChatStatisticsInviterInfo) GetType() string { + return TypeChatStatisticsInviterInfo +} + +// A detailed statistics about a supergroup chat +type ChatStatisticsSupergroup struct { + meta + // A period to which the statistics applies + Period *DateRange `json:"period"` + // Number of members in the chat + MemberCount *StatisticalValue `json:"member_count"` + // Number of messages sent to the chat + MessageCount *StatisticalValue `json:"message_count"` + // Number of users who viewed messages in the chat + ViewerCount *StatisticalValue `json:"viewer_count"` + // Number of users who sent messages to the chat + SenderCount *StatisticalValue `json:"sender_count"` + // A graph containing number of members in the chat + MemberCountGraph StatisticalGraph `json:"member_count_graph"` + // A graph containing number of members joined and left the chat + JoinGraph StatisticalGraph `json:"join_graph"` + // A graph containing number of new member joins per source + JoinBySourceGraph StatisticalGraph `json:"join_by_source_graph"` + // A graph containing distribution of active users per language + LanguageGraph StatisticalGraph `json:"language_graph"` + // A graph containing distribution of sent messages by content type + MessageContentGraph StatisticalGraph `json:"message_content_graph"` + // A graph containing number of different actions in the chat + ActionGraph StatisticalGraph `json:"action_graph"` + // A graph containing distribution of message views per hour + DayGraph StatisticalGraph `json:"day_graph"` + // A graph containing distribution of message views per day of week + WeekGraph StatisticalGraph `json:"week_graph"` + // List of users sent most messages in the last week + TopSenders []*ChatStatisticsMessageSenderInfo `json:"top_senders"` + // List of most active administrators in the last week + TopAdministrators []*ChatStatisticsAdministratorActionsInfo `json:"top_administrators"` + // List of most active inviters of new members in the last week + TopInviters []*ChatStatisticsInviterInfo `json:"top_inviters"` +} + +func (entity *ChatStatisticsSupergroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatStatisticsSupergroup + + return json.Marshal((*stub)(entity)) +} + +func (*ChatStatisticsSupergroup) GetClass() string { + return ClassChatStatistics +} + +func (*ChatStatisticsSupergroup) GetType() string { + return TypeChatStatisticsSupergroup +} + +func (*ChatStatisticsSupergroup) ChatStatisticsType() string { + return TypeChatStatisticsSupergroup +} + +func (chatStatisticsSupergroup *ChatStatisticsSupergroup) UnmarshalJSON(data []byte) error { + var tmp struct { + Period *DateRange `json:"period"` + MemberCount *StatisticalValue `json:"member_count"` + MessageCount *StatisticalValue `json:"message_count"` + ViewerCount *StatisticalValue `json:"viewer_count"` + SenderCount *StatisticalValue `json:"sender_count"` + MemberCountGraph json.RawMessage `json:"member_count_graph"` + JoinGraph json.RawMessage `json:"join_graph"` + JoinBySourceGraph json.RawMessage `json:"join_by_source_graph"` + LanguageGraph json.RawMessage `json:"language_graph"` + MessageContentGraph json.RawMessage `json:"message_content_graph"` + ActionGraph json.RawMessage `json:"action_graph"` + DayGraph json.RawMessage `json:"day_graph"` + WeekGraph json.RawMessage `json:"week_graph"` + TopSenders []*ChatStatisticsMessageSenderInfo `json:"top_senders"` + TopAdministrators []*ChatStatisticsAdministratorActionsInfo `json:"top_administrators"` + TopInviters []*ChatStatisticsInviterInfo `json:"top_inviters"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatStatisticsSupergroup.Period = tmp.Period + chatStatisticsSupergroup.MemberCount = tmp.MemberCount + chatStatisticsSupergroup.MessageCount = tmp.MessageCount + chatStatisticsSupergroup.ViewerCount = tmp.ViewerCount + chatStatisticsSupergroup.SenderCount = tmp.SenderCount + chatStatisticsSupergroup.TopSenders = tmp.TopSenders + chatStatisticsSupergroup.TopAdministrators = tmp.TopAdministrators + chatStatisticsSupergroup.TopInviters = tmp.TopInviters + + fieldMemberCountGraph, _ := UnmarshalStatisticalGraph(tmp.MemberCountGraph) + chatStatisticsSupergroup.MemberCountGraph = fieldMemberCountGraph + + fieldJoinGraph, _ := UnmarshalStatisticalGraph(tmp.JoinGraph) + chatStatisticsSupergroup.JoinGraph = fieldJoinGraph + + fieldJoinBySourceGraph, _ := UnmarshalStatisticalGraph(tmp.JoinBySourceGraph) + chatStatisticsSupergroup.JoinBySourceGraph = fieldJoinBySourceGraph + + fieldLanguageGraph, _ := UnmarshalStatisticalGraph(tmp.LanguageGraph) + chatStatisticsSupergroup.LanguageGraph = fieldLanguageGraph + + fieldMessageContentGraph, _ := UnmarshalStatisticalGraph(tmp.MessageContentGraph) + chatStatisticsSupergroup.MessageContentGraph = fieldMessageContentGraph + + fieldActionGraph, _ := UnmarshalStatisticalGraph(tmp.ActionGraph) + chatStatisticsSupergroup.ActionGraph = fieldActionGraph + + fieldDayGraph, _ := UnmarshalStatisticalGraph(tmp.DayGraph) + chatStatisticsSupergroup.DayGraph = fieldDayGraph + + fieldWeekGraph, _ := UnmarshalStatisticalGraph(tmp.WeekGraph) + chatStatisticsSupergroup.WeekGraph = fieldWeekGraph + + return nil +} + +// A detailed statistics about a channel chat +type ChatStatisticsChannel struct { + meta + // A period to which the statistics applies + Period *DateRange `json:"period"` + // Number of members in the chat + MemberCount *StatisticalValue `json:"member_count"` + // Mean number of times the recently sent messages was viewed + MeanViewCount *StatisticalValue `json:"mean_view_count"` + // Mean number of times the recently sent messages was shared + MeanShareCount *StatisticalValue `json:"mean_share_count"` + // A percentage of users with enabled notifications for the chat + EnabledNotificationsPercentage float64 `json:"enabled_notifications_percentage"` + // A graph containing number of members in the chat + MemberCountGraph StatisticalGraph `json:"member_count_graph"` + // A graph containing number of members joined and left the chat + JoinGraph StatisticalGraph `json:"join_graph"` + // A graph containing number of members muted and unmuted the chat + MuteGraph StatisticalGraph `json:"mute_graph"` + // A graph containing number of message views in a given hour in the last two weeks + ViewCountByHourGraph StatisticalGraph `json:"view_count_by_hour_graph"` + // A graph containing number of message views per source + ViewCountBySourceGraph StatisticalGraph `json:"view_count_by_source_graph"` + // A graph containing number of new member joins per source + JoinBySourceGraph StatisticalGraph `json:"join_by_source_graph"` + // A graph containing number of users viewed chat messages per language + LanguageGraph StatisticalGraph `json:"language_graph"` + // A graph containing number of chat message views and shares + MessageInteractionGraph StatisticalGraph `json:"message_interaction_graph"` + // A graph containing number of views of associated with the chat instant views + InstantViewInteractionGraph StatisticalGraph `json:"instant_view_interaction_graph"` + // Detailed statistics about number of views and shares of recently sent messages + RecentMessageInteractions []*ChatStatisticsMessageInteractionInfo `json:"recent_message_interactions"` +} + +func (entity *ChatStatisticsChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatStatisticsChannel + + return json.Marshal((*stub)(entity)) +} + +func (*ChatStatisticsChannel) GetClass() string { + return ClassChatStatistics +} + +func (*ChatStatisticsChannel) GetType() string { + return TypeChatStatisticsChannel +} + +func (*ChatStatisticsChannel) ChatStatisticsType() string { + return TypeChatStatisticsChannel +} + +func (chatStatisticsChannel *ChatStatisticsChannel) UnmarshalJSON(data []byte) error { + var tmp struct { + Period *DateRange `json:"period"` + MemberCount *StatisticalValue `json:"member_count"` + MeanViewCount *StatisticalValue `json:"mean_view_count"` + MeanShareCount *StatisticalValue `json:"mean_share_count"` + EnabledNotificationsPercentage float64 `json:"enabled_notifications_percentage"` + MemberCountGraph json.RawMessage `json:"member_count_graph"` + JoinGraph json.RawMessage `json:"join_graph"` + MuteGraph json.RawMessage `json:"mute_graph"` + ViewCountByHourGraph json.RawMessage `json:"view_count_by_hour_graph"` + ViewCountBySourceGraph json.RawMessage `json:"view_count_by_source_graph"` + JoinBySourceGraph json.RawMessage `json:"join_by_source_graph"` + LanguageGraph json.RawMessage `json:"language_graph"` + MessageInteractionGraph json.RawMessage `json:"message_interaction_graph"` + InstantViewInteractionGraph json.RawMessage `json:"instant_view_interaction_graph"` + RecentMessageInteractions []*ChatStatisticsMessageInteractionInfo `json:"recent_message_interactions"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatStatisticsChannel.Period = tmp.Period + chatStatisticsChannel.MemberCount = tmp.MemberCount + chatStatisticsChannel.MeanViewCount = tmp.MeanViewCount + chatStatisticsChannel.MeanShareCount = tmp.MeanShareCount + chatStatisticsChannel.EnabledNotificationsPercentage = tmp.EnabledNotificationsPercentage + chatStatisticsChannel.RecentMessageInteractions = tmp.RecentMessageInteractions + + fieldMemberCountGraph, _ := UnmarshalStatisticalGraph(tmp.MemberCountGraph) + chatStatisticsChannel.MemberCountGraph = fieldMemberCountGraph + + fieldJoinGraph, _ := UnmarshalStatisticalGraph(tmp.JoinGraph) + chatStatisticsChannel.JoinGraph = fieldJoinGraph + + fieldMuteGraph, _ := UnmarshalStatisticalGraph(tmp.MuteGraph) + chatStatisticsChannel.MuteGraph = fieldMuteGraph + + fieldViewCountByHourGraph, _ := UnmarshalStatisticalGraph(tmp.ViewCountByHourGraph) + chatStatisticsChannel.ViewCountByHourGraph = fieldViewCountByHourGraph + + fieldViewCountBySourceGraph, _ := UnmarshalStatisticalGraph(tmp.ViewCountBySourceGraph) + chatStatisticsChannel.ViewCountBySourceGraph = fieldViewCountBySourceGraph + + fieldJoinBySourceGraph, _ := UnmarshalStatisticalGraph(tmp.JoinBySourceGraph) + chatStatisticsChannel.JoinBySourceGraph = fieldJoinBySourceGraph + + fieldLanguageGraph, _ := UnmarshalStatisticalGraph(tmp.LanguageGraph) + chatStatisticsChannel.LanguageGraph = fieldLanguageGraph + + fieldMessageInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.MessageInteractionGraph) + chatStatisticsChannel.MessageInteractionGraph = fieldMessageInteractionGraph + + fieldInstantViewInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.InstantViewInteractionGraph) + chatStatisticsChannel.InstantViewInteractionGraph = fieldInstantViewInteractionGraph + + return nil +} + +// A detailed statistics about a message +type MessageStatistics struct { + meta + // A graph containing number of message views and shares + MessageInteractionGraph StatisticalGraph `json:"message_interaction_graph"` +} + +func (entity *MessageStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*MessageStatistics) GetClass() string { + return ClassMessageStatistics +} + +func (*MessageStatistics) GetType() string { + return TypeMessageStatistics +} + +func (messageStatistics *MessageStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + MessageInteractionGraph json.RawMessage `json:"message_interaction_graph"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldMessageInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.MessageInteractionGraph) + messageStatistics.MessageInteractionGraph = fieldMessageInteractionGraph + + return nil +} + +// The user authorization state has changed +type UpdateAuthorizationState struct { + meta + // New authorization state + AuthorizationState AuthorizationState `json:"authorization_state"` +} + +func (entity *UpdateAuthorizationState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateAuthorizationState + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateAuthorizationState) GetClass() string { + return ClassUpdate +} + +func (*UpdateAuthorizationState) GetType() string { + return TypeUpdateAuthorizationState +} + +func (*UpdateAuthorizationState) UpdateType() string { + return TypeUpdateAuthorizationState +} + +func (updateAuthorizationState *UpdateAuthorizationState) UnmarshalJSON(data []byte) error { + var tmp struct { + AuthorizationState json.RawMessage `json:"authorization_state"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldAuthorizationState, _ := UnmarshalAuthorizationState(tmp.AuthorizationState) + updateAuthorizationState.AuthorizationState = fieldAuthorizationState + + return nil +} + +// A new message was received; can also be an outgoing message +type UpdateNewMessage struct { + meta + // The new message + Message *Message `json:"message"` +} + +func (entity *UpdateNewMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewMessage + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewMessage) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewMessage) GetType() string { + return TypeUpdateNewMessage +} + +func (*UpdateNewMessage) UpdateType() string { + return TypeUpdateNewMessage +} + +// 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 { + meta + // The chat identifier of the sent message + ChatId int64 `json:"chat_id"` + // A temporary message identifier + MessageId int64 `json:"message_id"` +} + +func (entity *UpdateMessageSendAcknowledged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageSendAcknowledged + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageSendAcknowledged) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageSendAcknowledged) GetType() string { + return TypeUpdateMessageSendAcknowledged +} + +func (*UpdateMessageSendAcknowledged) UpdateType() string { + return TypeUpdateMessageSendAcknowledged +} + +// A message has been successfully sent +type UpdateMessageSendSucceeded struct { + 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"` +} + +func (entity *UpdateMessageSendSucceeded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageSendSucceeded + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageSendSucceeded) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageSendSucceeded) GetType() string { + return TypeUpdateMessageSendSucceeded +} + +func (*UpdateMessageSendSucceeded) UpdateType() string { + return TypeUpdateMessageSendSucceeded +} + +// 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 { + meta + // Contains information about the message which failed to send + 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"` +} + +func (entity *UpdateMessageSendFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageSendFailed + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageSendFailed) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageSendFailed) GetType() string { + return TypeUpdateMessageSendFailed +} + +func (*UpdateMessageSendFailed) UpdateType() string { + return TypeUpdateMessageSendFailed +} + +// The message content has changed +type UpdateMessageContent struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // New message content + NewContent MessageContent `json:"new_content"` +} + +func (entity *UpdateMessageContent) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageContent + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageContent) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageContent) GetType() string { + return TypeUpdateMessageContent +} + +func (*UpdateMessageContent) UpdateType() string { + return TypeUpdateMessageContent +} + +func (updateMessageContent *UpdateMessageContent) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + MessageId int64 `json:"message_id"` + NewContent json.RawMessage `json:"new_content"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateMessageContent.ChatId = tmp.ChatId + updateMessageContent.MessageId = tmp.MessageId + + fieldNewContent, _ := UnmarshalMessageContent(tmp.NewContent) + updateMessageContent.NewContent = fieldNewContent + + return nil +} + +// A message was edited. Changes in the message content will come in a separate updateMessageContent +type UpdateMessageEdited struct { + 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"` +} + +func (entity *UpdateMessageEdited) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageEdited + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageEdited) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageEdited) GetType() string { + return TypeUpdateMessageEdited +} + +func (*UpdateMessageEdited) UpdateType() string { + return TypeUpdateMessageEdited +} + +func (updateMessageEdited *UpdateMessageEdited) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + MessageId int64 `json:"message_id"` + EditDate int32 `json:"edit_date"` + ReplyMarkup json.RawMessage `json:"reply_markup"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateMessageEdited.ChatId = tmp.ChatId + updateMessageEdited.MessageId = tmp.MessageId + updateMessageEdited.EditDate = tmp.EditDate + + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + updateMessageEdited.ReplyMarkup = fieldReplyMarkup + + return nil +} + +// The message pinned state was changed +type UpdateMessageIsPinned struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The message identifier + MessageId int64 `json:"message_id"` + // True, if the message is pinned + IsPinned bool `json:"is_pinned"` +} + +func (entity *UpdateMessageIsPinned) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageIsPinned + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageIsPinned) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageIsPinned) GetType() string { + return TypeUpdateMessageIsPinned +} + +func (*UpdateMessageIsPinned) UpdateType() string { + return TypeUpdateMessageIsPinned +} + +// The information about interactions with a message has changed +type UpdateMessageInteractionInfo struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // New information about interactions with the message; may be null + InteractionInfo *MessageInteractionInfo `json:"interaction_info"` +} + +func (entity *UpdateMessageInteractionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageInteractionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageInteractionInfo) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageInteractionInfo) GetType() string { + return TypeUpdateMessageInteractionInfo +} + +func (*UpdateMessageInteractionInfo) UpdateType() string { + return TypeUpdateMessageInteractionInfo +} + +// 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 { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` +} + +func (entity *UpdateMessageContentOpened) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageContentOpened + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageContentOpened) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageContentOpened) GetType() string { + return TypeUpdateMessageContentOpened +} + +func (*UpdateMessageContentOpened) UpdateType() string { + return TypeUpdateMessageContentOpened +} + +// A message with an unread mention was read +type UpdateMessageMentionRead struct { + 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"` +} + +func (entity *UpdateMessageMentionRead) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageMentionRead + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageMentionRead) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageMentionRead) GetType() string { + return TypeUpdateMessageMentionRead +} + +func (*UpdateMessageMentionRead) UpdateType() string { + return TypeUpdateMessageMentionRead +} + +// A message with a live location was viewed. When the update is received, the application is supposed to update the live location +type UpdateMessageLiveLocationViewed struct { + meta + // Identifier of the chat with the live location message + ChatId int64 `json:"chat_id"` + // Identifier of the message with live location + MessageId int64 `json:"message_id"` +} + +func (entity *UpdateMessageLiveLocationViewed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageLiveLocationViewed + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageLiveLocationViewed) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageLiveLocationViewed) GetType() string { + return TypeUpdateMessageLiveLocationViewed +} + +func (*UpdateMessageLiveLocationViewed) UpdateType() string { + return TypeUpdateMessageLiveLocationViewed +} + +// A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the application. The chat field changes will be reported through separate updates +type UpdateNewChat struct { + meta + // The chat + Chat *Chat `json:"chat"` +} + +func (entity *UpdateNewChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewChat + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewChat) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewChat) GetType() string { + return TypeUpdateNewChat +} + +func (*UpdateNewChat) UpdateType() string { + return TypeUpdateNewChat +} + +// The title of a chat was changed +type UpdateChatTitle struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new chat title + Title string `json:"title"` +} + +func (entity *UpdateChatTitle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatTitle + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatTitle) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatTitle) GetType() string { + return TypeUpdateChatTitle +} + +func (*UpdateChatTitle) UpdateType() string { + return TypeUpdateChatTitle +} + +// A chat photo was changed +type UpdateChatPhoto struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new chat photo; may be null + Photo *ChatPhotoInfo `json:"photo"` +} + +func (entity *UpdateChatPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatPhoto) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatPhoto) GetType() string { + return TypeUpdateChatPhoto +} + +func (*UpdateChatPhoto) UpdateType() string { + return TypeUpdateChatPhoto +} + +// 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 +} + +// 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 { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new last message in the chat; may be null + LastMessage *Message `json:"last_message"` + // The new chat positions in the chat lists + Positions []*ChatPosition `json:"positions"` +} + +func (entity *UpdateChatLastMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatLastMessage + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatLastMessage) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatLastMessage) GetType() string { + return TypeUpdateChatLastMessage +} + +func (*UpdateChatLastMessage) UpdateType() string { + return TypeUpdateChatLastMessage +} + +// The position of a chat in a chat list has changed. Instead of this update updateChatLastMessage or updateChatDraftMessage might be sent +type UpdateChatPosition struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New chat position. If new order is 0, then the chat needs to be removed from the list + Position *ChatPosition `json:"position"` +} + +func (entity *UpdateChatPosition) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatPosition + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatPosition) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatPosition) GetType() string { + return TypeUpdateChatPosition +} + +func (*UpdateChatPosition) UpdateType() string { + return TypeUpdateChatPosition +} + +// A chat was marked as unread or was read +type UpdateChatIsMarkedAsUnread struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of is_marked_as_unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` +} + +func (entity *UpdateChatIsMarkedAsUnread) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatIsMarkedAsUnread + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatIsMarkedAsUnread) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatIsMarkedAsUnread) GetType() string { + return TypeUpdateChatIsMarkedAsUnread +} + +func (*UpdateChatIsMarkedAsUnread) UpdateType() string { + return TypeUpdateChatIsMarkedAsUnread +} + +// A chat was blocked or unblocked +type UpdateChatIsBlocked struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of is_blocked + IsBlocked bool `json:"is_blocked"` +} + +func (entity *UpdateChatIsBlocked) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatIsBlocked + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatIsBlocked) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatIsBlocked) GetType() string { + return TypeUpdateChatIsBlocked +} + +func (*UpdateChatIsBlocked) UpdateType() string { + return TypeUpdateChatIsBlocked +} + +// A chat's has_scheduled_messages field has changed +type UpdateChatHasScheduledMessages struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of has_scheduled_messages + HasScheduledMessages bool `json:"has_scheduled_messages"` +} + +func (entity *UpdateChatHasScheduledMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatHasScheduledMessages + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatHasScheduledMessages) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatHasScheduledMessages) GetType() string { + return TypeUpdateChatHasScheduledMessages +} + +func (*UpdateChatHasScheduledMessages) UpdateType() string { + return TypeUpdateChatHasScheduledMessages +} + +// The value of the default disable_notification parameter, used when a message is sent to the chat, was changed +type UpdateChatDefaultDisableNotification struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new default_disable_notification value + DefaultDisableNotification bool `json:"default_disable_notification"` +} + +func (entity *UpdateChatDefaultDisableNotification) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatDefaultDisableNotification + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatDefaultDisableNotification) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatDefaultDisableNotification) GetType() string { + return TypeUpdateChatDefaultDisableNotification +} + +func (*UpdateChatDefaultDisableNotification) UpdateType() string { + return TypeUpdateChatDefaultDisableNotification +} + +// Incoming messages were read or number of unread messages has been changed +type UpdateChatReadInbox struct { + 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"` +} + +func (entity *UpdateChatReadInbox) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatReadInbox + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatReadInbox) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatReadInbox) GetType() string { + return TypeUpdateChatReadInbox +} + +func (*UpdateChatReadInbox) UpdateType() string { + return TypeUpdateChatReadInbox +} + +// Outgoing messages were read +type UpdateChatReadOutbox struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of last read outgoing message + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` +} + +func (entity *UpdateChatReadOutbox) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatReadOutbox + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatReadOutbox) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatReadOutbox) GetType() string { + return TypeUpdateChatReadOutbox +} + +func (*UpdateChatReadOutbox) UpdateType() string { + return TypeUpdateChatReadOutbox +} + +// The chat unread_mention_count has changed +type UpdateChatUnreadMentionCount struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The number of unread mention messages left in the chat + UnreadMentionCount int32 `json:"unread_mention_count"` +} + +func (entity *UpdateChatUnreadMentionCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatUnreadMentionCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatUnreadMentionCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatUnreadMentionCount) GetType() string { + return TypeUpdateChatUnreadMentionCount +} + +func (*UpdateChatUnreadMentionCount) UpdateType() string { + return TypeUpdateChatUnreadMentionCount +} + +// Notification settings for a chat were changed +type UpdateChatNotificationSettings struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new notification settings + NotificationSettings *ChatNotificationSettings `json:"notification_settings"` +} + +func (entity *UpdateChatNotificationSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatNotificationSettings + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatNotificationSettings) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatNotificationSettings) GetType() string { + return TypeUpdateChatNotificationSettings +} + +func (*UpdateChatNotificationSettings) UpdateType() string { + return TypeUpdateChatNotificationSettings +} + +// Notification settings for some type of chats were updated +type UpdateScopeNotificationSettings struct { + meta + // Types of chats for which notification settings were updated + Scope NotificationSettingsScope `json:"scope"` + // The new notification settings + NotificationSettings *ScopeNotificationSettings `json:"notification_settings"` +} + +func (entity *UpdateScopeNotificationSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateScopeNotificationSettings + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateScopeNotificationSettings) GetClass() string { + return ClassUpdate +} + +func (*UpdateScopeNotificationSettings) GetType() string { + return TypeUpdateScopeNotificationSettings +} + +func (*UpdateScopeNotificationSettings) UpdateType() string { + return TypeUpdateScopeNotificationSettings +} + +func (updateScopeNotificationSettings *UpdateScopeNotificationSettings) UnmarshalJSON(data []byte) error { + var tmp struct { + Scope json.RawMessage `json:"scope"` + NotificationSettings *ScopeNotificationSettings `json:"notification_settings"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateScopeNotificationSettings.NotificationSettings = tmp.NotificationSettings + + fieldScope, _ := UnmarshalNotificationSettingsScope(tmp.Scope) + updateScopeNotificationSettings.Scope = fieldScope + + return nil +} + +// The chat action bar was changed +type UpdateChatActionBar struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new value of the action bar; may be null + ActionBar ChatActionBar `json:"action_bar"` +} + +func (entity *UpdateChatActionBar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatActionBar + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatActionBar) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatActionBar) GetType() string { + return TypeUpdateChatActionBar +} + +func (*UpdateChatActionBar) UpdateType() string { + return TypeUpdateChatActionBar +} + +func (updateChatActionBar *UpdateChatActionBar) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + ActionBar json.RawMessage `json:"action_bar"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateChatActionBar.ChatId = tmp.ChatId + + fieldActionBar, _ := UnmarshalChatActionBar(tmp.ActionBar) + updateChatActionBar.ActionBar = fieldActionBar + + return nil +} + +// 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 { + 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"` +} + +func (entity *UpdateChatReplyMarkup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatReplyMarkup + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatReplyMarkup) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatReplyMarkup) GetType() string { + return TypeUpdateChatReplyMarkup +} + +func (*UpdateChatReplyMarkup) UpdateType() string { + return TypeUpdateChatReplyMarkup +} + +// 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 +type UpdateChatDraftMessage struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new draft message; may be null + DraftMessage *DraftMessage `json:"draft_message"` + // The new chat positions in the chat lists + Positions []*ChatPosition `json:"positions"` +} + +func (entity *UpdateChatDraftMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatDraftMessage + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatDraftMessage) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatDraftMessage) GetType() string { + return TypeUpdateChatDraftMessage +} + +func (*UpdateChatDraftMessage) UpdateType() string { + return TypeUpdateChatDraftMessage +} + +// The list of chat filters or a chat filter has changed +type UpdateChatFilters struct { + meta + // The new list of chat filters + ChatFilters []*ChatFilterInfo `json:"chat_filters"` +} + +func (entity *UpdateChatFilters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatFilters + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatFilters) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatFilters) GetType() string { + return TypeUpdateChatFilters +} + +func (*UpdateChatFilters) UpdateType() string { + return TypeUpdateChatFilters +} + +// 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 the 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 +} + +// Some messages were deleted +type UpdateDeleteMessages struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifiers of the deleted messages + MessageIds []int64 `json:"message_ids"` + // True, if the messages are permanently deleted by a user (as opposed to just becoming inaccessible) + 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"` +} + +func (entity *UpdateDeleteMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateDeleteMessages + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateDeleteMessages) GetClass() string { + return ClassUpdate +} + +func (*UpdateDeleteMessages) GetType() string { + return TypeUpdateDeleteMessages +} + +func (*UpdateDeleteMessages) UpdateType() string { + return TypeUpdateDeleteMessages +} + +// User activity in the chat has changed +type UpdateUserChatAction struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // If not 0, a message thread identifier in which the action was performed + MessageThreadId int64 `json:"message_thread_id"` + // Identifier of a user performing an action + UserId int32 `json:"user_id"` + // The action description + Action ChatAction `json:"action"` +} + +func (entity *UpdateUserChatAction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateUserChatAction + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateUserChatAction) GetClass() string { + return ClassUpdate +} + +func (*UpdateUserChatAction) GetType() string { + return TypeUpdateUserChatAction +} + +func (*UpdateUserChatAction) UpdateType() string { + return TypeUpdateUserChatAction +} + +func (updateUserChatAction *UpdateUserChatAction) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + MessageThreadId int64 `json:"message_thread_id"` + UserId int32 `json:"user_id"` + Action json.RawMessage `json:"action"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateUserChatAction.ChatId = tmp.ChatId + updateUserChatAction.MessageThreadId = tmp.MessageThreadId + updateUserChatAction.UserId = tmp.UserId + + fieldAction, _ := UnmarshalChatAction(tmp.Action) + updateUserChatAction.Action = fieldAction + + return nil +} + +// The user went online or offline +type UpdateUserStatus struct { + meta + // User identifier + UserId int32 `json:"user_id"` + // New status of the user + Status UserStatus `json:"status"` +} + +func (entity *UpdateUserStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateUserStatus + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateUserStatus) GetClass() string { + return ClassUpdate +} + +func (*UpdateUserStatus) GetType() string { + return TypeUpdateUserStatus +} + +func (*UpdateUserStatus) UpdateType() string { + return TypeUpdateUserStatus +} + +func (updateUserStatus *UpdateUserStatus) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int32 `json:"user_id"` + Status json.RawMessage `json:"status"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateUserStatus.UserId = tmp.UserId + + fieldStatus, _ := UnmarshalUserStatus(tmp.Status) + updateUserStatus.Status = fieldStatus + + return nil +} + +// Some data of a user has changed. This update is guaranteed to come before the user identifier is returned to the application +type UpdateUser struct { + meta + // New data about the user + User *User `json:"user"` +} + +func (entity *UpdateUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateUser + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateUser) GetClass() string { + return ClassUpdate +} + +func (*UpdateUser) GetType() string { + return TypeUpdateUser +} + +func (*UpdateUser) UpdateType() string { + return TypeUpdateUser +} + +// Some data of a basic group has changed. This update is guaranteed to come before the basic group identifier is returned to the application +type UpdateBasicGroup struct { + meta + // New data about the group + BasicGroup *BasicGroup `json:"basic_group"` +} + +func (entity *UpdateBasicGroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateBasicGroup + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateBasicGroup) GetClass() string { + return ClassUpdate +} + +func (*UpdateBasicGroup) GetType() string { + return TypeUpdateBasicGroup +} + +func (*UpdateBasicGroup) UpdateType() string { + return TypeUpdateBasicGroup +} + +// Some data of a supergroup or a channel has changed. This update is guaranteed to come before the supergroup identifier is returned to the application +type UpdateSupergroup struct { + meta + // New data about the supergroup + Supergroup *Supergroup `json:"supergroup"` +} + +func (entity *UpdateSupergroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSupergroup + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSupergroup) GetClass() string { + return ClassUpdate +} + +func (*UpdateSupergroup) GetType() string { + return TypeUpdateSupergroup +} + +func (*UpdateSupergroup) UpdateType() string { + return TypeUpdateSupergroup +} + +// Some data of a secret chat has changed. This update is guaranteed to come before the secret chat identifier is returned to the application +type UpdateSecretChat struct { + meta + // New data about the secret chat + SecretChat *SecretChat `json:"secret_chat"` +} + +func (entity *UpdateSecretChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSecretChat + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSecretChat) GetClass() string { + return ClassUpdate +} + +func (*UpdateSecretChat) GetType() string { + return TypeUpdateSecretChat +} + +func (*UpdateSecretChat) UpdateType() string { + return TypeUpdateSecretChat +} + +// Some data from userFullInfo has been changed +type UpdateUserFullInfo struct { + meta + // User identifier + UserId int32 `json:"user_id"` + // New full information about the user + UserFullInfo *UserFullInfo `json:"user_full_info"` +} + +func (entity *UpdateUserFullInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateUserFullInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateUserFullInfo) GetClass() string { + return ClassUpdate +} + +func (*UpdateUserFullInfo) GetType() string { + return TypeUpdateUserFullInfo +} + +func (*UpdateUserFullInfo) UpdateType() string { + return TypeUpdateUserFullInfo +} + +// Some data from basicGroupFullInfo has been changed +type UpdateBasicGroupFullInfo struct { + 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"` +} + +func (entity *UpdateBasicGroupFullInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateBasicGroupFullInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateBasicGroupFullInfo) GetClass() string { + return ClassUpdate +} + +func (*UpdateBasicGroupFullInfo) GetType() string { + return TypeUpdateBasicGroupFullInfo +} + +func (*UpdateBasicGroupFullInfo) UpdateType() string { + return TypeUpdateBasicGroupFullInfo +} + +// Some data from supergroupFullInfo has been changed +type UpdateSupergroupFullInfo struct { + meta + // Identifier of the supergroup or channel + SupergroupId int32 `json:"supergroup_id"` + // New full information about the supergroup + SupergroupFullInfo *SupergroupFullInfo `json:"supergroup_full_info"` +} + +func (entity *UpdateSupergroupFullInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSupergroupFullInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSupergroupFullInfo) GetClass() string { + return ClassUpdate +} + +func (*UpdateSupergroupFullInfo) GetType() string { + return TypeUpdateSupergroupFullInfo +} + +func (*UpdateSupergroupFullInfo) UpdateType() string { + return TypeUpdateSupergroupFullInfo +} + +// Service notification from the server. Upon receiving this the application must show a popup with the content of the notification +type UpdateServiceNotification struct { + 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"` +} + +func (entity *UpdateServiceNotification) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateServiceNotification + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateServiceNotification) GetClass() string { + return ClassUpdate +} + +func (*UpdateServiceNotification) GetType() string { + return TypeUpdateServiceNotification +} + +func (*UpdateServiceNotification) UpdateType() string { + return TypeUpdateServiceNotification +} + +func (updateServiceNotification *UpdateServiceNotification) UnmarshalJSON(data []byte) error { + var tmp struct { + Type string `json:"type"` + Content json.RawMessage `json:"content"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateServiceNotification.Type = tmp.Type + + fieldContent, _ := UnmarshalMessageContent(tmp.Content) + updateServiceNotification.Content = fieldContent + + return nil +} + +// Information about a file was updated +type UpdateFile struct { + meta + // New data about the file + File *File `json:"file"` +} + +func (entity *UpdateFile) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateFile + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateFile) GetClass() string { + return ClassUpdate +} + +func (*UpdateFile) GetType() string { + return TypeUpdateFile +} + +func (*UpdateFile) UpdateType() string { + return TypeUpdateFile +} + +// The file generation process needs to be started by the application +type UpdateFileGenerationStart struct { + 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 application + Conversion string `json:"conversion"` +} + +func (entity *UpdateFileGenerationStart) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateFileGenerationStart + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateFileGenerationStart) GetClass() string { + return ClassUpdate +} + +func (*UpdateFileGenerationStart) GetType() string { + return TypeUpdateFileGenerationStart +} + +func (*UpdateFileGenerationStart) UpdateType() string { + return TypeUpdateFileGenerationStart +} + +// File generation is no longer needed +type UpdateFileGenerationStop struct { + meta + // Unique identifier for the generation process + GenerationId JsonInt64 `json:"generation_id"` +} + +func (entity *UpdateFileGenerationStop) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateFileGenerationStop + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateFileGenerationStop) GetClass() string { + return ClassUpdate +} + +func (*UpdateFileGenerationStop) GetType() string { + return TypeUpdateFileGenerationStop +} + +func (*UpdateFileGenerationStop) UpdateType() string { + return TypeUpdateFileGenerationStop +} + +// New call was created or information about a call was updated +type UpdateCall struct { + meta + // New data about a call + Call *Call `json:"call"` +} + +func (entity *UpdateCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateCall + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateCall) GetClass() string { + return ClassUpdate +} + +func (*UpdateCall) GetType() string { + return TypeUpdateCall +} + +func (*UpdateCall) UpdateType() string { + return TypeUpdateCall +} + +// New call signaling data arrived +type UpdateNewCallSignalingData struct { + meta + // The call identifier + CallId int32 `json:"call_id"` + // The data + Data []byte `json:"data"` +} + +func (entity *UpdateNewCallSignalingData) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewCallSignalingData + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewCallSignalingData) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewCallSignalingData) GetType() string { + return TypeUpdateNewCallSignalingData +} + +func (*UpdateNewCallSignalingData) UpdateType() string { + return TypeUpdateNewCallSignalingData +} + +// Some privacy setting rules have been changed +type UpdateUserPrivacySettingRules struct { + meta + // The privacy setting + Setting UserPrivacySetting `json:"setting"` + // New privacy rules + Rules *UserPrivacySettingRules `json:"rules"` +} + +func (entity *UpdateUserPrivacySettingRules) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateUserPrivacySettingRules + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateUserPrivacySettingRules) GetClass() string { + return ClassUpdate +} + +func (*UpdateUserPrivacySettingRules) GetType() string { + return TypeUpdateUserPrivacySettingRules +} + +func (*UpdateUserPrivacySettingRules) UpdateType() string { + return TypeUpdateUserPrivacySettingRules +} + +func (updateUserPrivacySettingRules *UpdateUserPrivacySettingRules) UnmarshalJSON(data []byte) error { + var tmp struct { + Setting json.RawMessage `json:"setting"` + Rules *UserPrivacySettingRules `json:"rules"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateUserPrivacySettingRules.Rules = tmp.Rules + + fieldSetting, _ := UnmarshalUserPrivacySetting(tmp.Setting) + updateUserPrivacySettingRules.Setting = fieldSetting + + return nil +} + +// Number of unread messages in a chat list has changed. This update is sent only if the message database is used +type UpdateUnreadMessageCount struct { + meta + // The chat list with changed number of unread messages + ChatList ChatList `json:"chat_list"` + // Total number of unread messages + UnreadCount int32 `json:"unread_count"` + // Total number of unread messages in unmuted chats + UnreadUnmutedCount int32 `json:"unread_unmuted_count"` +} + +func (entity *UpdateUnreadMessageCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateUnreadMessageCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateUnreadMessageCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateUnreadMessageCount) GetType() string { + return TypeUpdateUnreadMessageCount +} + +func (*UpdateUnreadMessageCount) UpdateType() string { + return TypeUpdateUnreadMessageCount +} + +func (updateUnreadMessageCount *UpdateUnreadMessageCount) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatList json.RawMessage `json:"chat_list"` + UnreadCount int32 `json:"unread_count"` + UnreadUnmutedCount int32 `json:"unread_unmuted_count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateUnreadMessageCount.UnreadCount = tmp.UnreadCount + updateUnreadMessageCount.UnreadUnmutedCount = tmp.UnreadUnmutedCount + + fieldChatList, _ := UnmarshalChatList(tmp.ChatList) + updateUnreadMessageCount.ChatList = fieldChatList + + return nil +} + +// Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if the message database is used +type UpdateUnreadChatCount struct { + meta + // The chat list with changed number of unread messages + ChatList ChatList `json:"chat_list"` + // Approximate total number of chats in the chat list + TotalCount int32 `json:"total_count"` + // 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"` +} + +func (entity *UpdateUnreadChatCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateUnreadChatCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateUnreadChatCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateUnreadChatCount) GetType() string { + return TypeUpdateUnreadChatCount +} + +func (*UpdateUnreadChatCount) UpdateType() string { + return TypeUpdateUnreadChatCount +} + +func (updateUnreadChatCount *UpdateUnreadChatCount) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatList json.RawMessage `json:"chat_list"` + TotalCount int32 `json:"total_count"` + UnreadCount int32 `json:"unread_count"` + UnreadUnmutedCount int32 `json:"unread_unmuted_count"` + MarkedAsUnreadCount int32 `json:"marked_as_unread_count"` + MarkedAsUnreadUnmutedCount int32 `json:"marked_as_unread_unmuted_count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateUnreadChatCount.TotalCount = tmp.TotalCount + updateUnreadChatCount.UnreadCount = tmp.UnreadCount + updateUnreadChatCount.UnreadUnmutedCount = tmp.UnreadUnmutedCount + updateUnreadChatCount.MarkedAsUnreadCount = tmp.MarkedAsUnreadCount + updateUnreadChatCount.MarkedAsUnreadUnmutedCount = tmp.MarkedAsUnreadUnmutedCount + + fieldChatList, _ := UnmarshalChatList(tmp.ChatList) + updateUnreadChatCount.ChatList = fieldChatList + + return nil +} + +// An option changed its value +type UpdateOption struct { + meta + // The option name + Name string `json:"name"` + // The new option value + Value OptionValue `json:"value"` +} + +func (entity *UpdateOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateOption + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateOption) GetClass() string { + return ClassUpdate +} + +func (*UpdateOption) GetType() string { + return TypeUpdateOption +} + +func (*UpdateOption) UpdateType() string { + return TypeUpdateOption +} + +func (updateOption *UpdateOption) UnmarshalJSON(data []byte) error { + var tmp struct { + Name string `json:"name"` + Value json.RawMessage `json:"value"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateOption.Name = tmp.Name + + fieldValue, _ := UnmarshalOptionValue(tmp.Value) + updateOption.Value = fieldValue + + return nil +} + +// A sticker set has changed +type UpdateStickerSet struct { + meta + // The sticker set + StickerSet *StickerSet `json:"sticker_set"` +} + +func (entity *UpdateStickerSet) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateStickerSet + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateStickerSet) GetClass() string { + return ClassUpdate +} + +func (*UpdateStickerSet) GetType() string { + return TypeUpdateStickerSet +} + +func (*UpdateStickerSet) UpdateType() string { + return TypeUpdateStickerSet +} + +// The list of installed sticker sets was updated +type UpdateInstalledStickerSets struct { + 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"` +} + +func (entity *UpdateInstalledStickerSets) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateInstalledStickerSets + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateInstalledStickerSets) GetClass() string { + return ClassUpdate +} + +func (*UpdateInstalledStickerSets) GetType() string { + return TypeUpdateInstalledStickerSets +} + +func (*UpdateInstalledStickerSets) UpdateType() string { + return TypeUpdateInstalledStickerSets +} + +// The list of trending sticker sets was updated or some of them were viewed +type UpdateTrendingStickerSets struct { + meta + // The prefix of the list of trending sticker sets with the newest trending sticker sets + StickerSets *StickerSets `json:"sticker_sets"` +} + +func (entity *UpdateTrendingStickerSets) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateTrendingStickerSets + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateTrendingStickerSets) GetClass() string { + return ClassUpdate +} + +func (*UpdateTrendingStickerSets) GetType() string { + return TypeUpdateTrendingStickerSets +} + +func (*UpdateTrendingStickerSets) UpdateType() string { + return TypeUpdateTrendingStickerSets +} + +// The list of recently used stickers was updated +type UpdateRecentStickers struct { + 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"` +} + +func (entity *UpdateRecentStickers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateRecentStickers + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateRecentStickers) GetClass() string { + return ClassUpdate +} + +func (*UpdateRecentStickers) GetType() string { + return TypeUpdateRecentStickers +} + +func (*UpdateRecentStickers) UpdateType() string { + return TypeUpdateRecentStickers +} + +// The list of favorite stickers was updated +type UpdateFavoriteStickers struct { + meta + // The new list of file identifiers of favorite stickers + StickerIds []int32 `json:"sticker_ids"` +} + +func (entity *UpdateFavoriteStickers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateFavoriteStickers + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateFavoriteStickers) GetClass() string { + return ClassUpdate +} + +func (*UpdateFavoriteStickers) GetType() string { + return TypeUpdateFavoriteStickers +} + +func (*UpdateFavoriteStickers) UpdateType() string { + return TypeUpdateFavoriteStickers +} + +// The list of saved animations was updated +type UpdateSavedAnimations struct { + meta + // The new list of file identifiers of saved animations + AnimationIds []int32 `json:"animation_ids"` +} + +func (entity *UpdateSavedAnimations) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSavedAnimations + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSavedAnimations) GetClass() string { + return ClassUpdate +} + +func (*UpdateSavedAnimations) GetType() string { + return TypeUpdateSavedAnimations +} + +func (*UpdateSavedAnimations) UpdateType() string { + return TypeUpdateSavedAnimations +} + +// 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 +} + +// Some language pack strings have been updated +type UpdateLanguagePackStrings struct { + 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"` +} + +func (entity *UpdateLanguagePackStrings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateLanguagePackStrings + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateLanguagePackStrings) GetClass() string { + return ClassUpdate +} + +func (*UpdateLanguagePackStrings) GetType() string { + return TypeUpdateLanguagePackStrings +} + +func (*UpdateLanguagePackStrings) UpdateType() string { + return TypeUpdateLanguagePackStrings +} + +// The connection state has changed. This update must be used only to show a human-readable description of the connection state +type UpdateConnectionState struct { + meta + // The new connection state + State ConnectionState `json:"state"` +} + +func (entity *UpdateConnectionState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateConnectionState + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateConnectionState) GetClass() string { + return ClassUpdate +} + +func (*UpdateConnectionState) GetType() string { + return TypeUpdateConnectionState +} + +func (*UpdateConnectionState) UpdateType() string { + return TypeUpdateConnectionState +} + +func (updateConnectionState *UpdateConnectionState) UnmarshalJSON(data []byte) error { + var tmp struct { + State json.RawMessage `json:"state"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldState, _ := UnmarshalConnectionState(tmp.State) + updateConnectionState.State = fieldState + + return nil +} + +// 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 { + 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"` +} + +func (entity *UpdateTermsOfService) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateTermsOfService + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateTermsOfService) GetClass() string { + return ClassUpdate +} + +func (*UpdateTermsOfService) GetType() string { + return TypeUpdateTermsOfService +} + +func (*UpdateTermsOfService) UpdateType() string { + return TypeUpdateTermsOfService +} + +// The list of users nearby has changed. The update is guaranteed to be sent only 60 seconds after a successful searchChatsNearby request +type UpdateUsersNearby struct { + meta + // The new list of users nearby + UsersNearby []*ChatNearby `json:"users_nearby"` +} + +func (entity *UpdateUsersNearby) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateUsersNearby + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateUsersNearby) GetClass() string { + return ClassUpdate +} + +func (*UpdateUsersNearby) GetType() string { + return TypeUpdateUsersNearby +} + +func (*UpdateUsersNearby) UpdateType() string { + return TypeUpdateUsersNearby +} + +// The list of supported dice emojis has changed +type UpdateDiceEmojis struct { + meta + // The new list of supported dice emojis + Emojis []string `json:"emojis"` +} + +func (entity *UpdateDiceEmojis) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateDiceEmojis + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateDiceEmojis) GetClass() string { + return ClassUpdate +} + +func (*UpdateDiceEmojis) GetType() string { + return TypeUpdateDiceEmojis +} + +func (*UpdateDiceEmojis) UpdateType() string { + return TypeUpdateDiceEmojis +} + +// The parameters of animation search through GetOption("animation_search_bot_username") bot has changed +type UpdateAnimationSearchParameters struct { + meta + // Name of the animation search provider + Provider string `json:"provider"` + // The new list of emojis suggested for searching + Emojis []string `json:"emojis"` +} + +func (entity *UpdateAnimationSearchParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateAnimationSearchParameters + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateAnimationSearchParameters) GetClass() string { + return ClassUpdate +} + +func (*UpdateAnimationSearchParameters) GetType() string { + return TypeUpdateAnimationSearchParameters +} + +func (*UpdateAnimationSearchParameters) UpdateType() string { + return TypeUpdateAnimationSearchParameters +} + +// The list of suggested to the user actions has changed +type UpdateSuggestedActions struct { + meta + // Added suggested actions + AddedActions []SuggestedAction `json:"added_actions"` + // Removed suggested actions + RemovedActions []SuggestedAction `json:"removed_actions"` +} + +func (entity *UpdateSuggestedActions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSuggestedActions + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSuggestedActions) GetClass() string { + return ClassUpdate +} + +func (*UpdateSuggestedActions) GetType() string { + return TypeUpdateSuggestedActions +} + +func (*UpdateSuggestedActions) UpdateType() string { + return TypeUpdateSuggestedActions +} + +func (updateSuggestedActions *UpdateSuggestedActions) UnmarshalJSON(data []byte) error { + var tmp struct { + AddedActions []json.RawMessage `json:"added_actions"` + RemovedActions []json.RawMessage `json:"removed_actions"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldAddedActions, _ := UnmarshalListOfSuggestedAction(tmp.AddedActions) + updateSuggestedActions.AddedActions = fieldAddedActions + + fieldRemovedActions, _ := UnmarshalListOfSuggestedAction(tmp.RemovedActions) + updateSuggestedActions.RemovedActions = fieldRemovedActions + + return nil +} + +// A new incoming inline query; for bots only +type UpdateNewInlineQuery struct { + meta + // Unique query identifier + Id JsonInt64 `json:"id"` + // Identifier of the user who sent the query + SenderUserId int32 `json:"sender_user_id"` + // User location; 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"` +} + +func (entity *UpdateNewInlineQuery) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewInlineQuery + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewInlineQuery) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewInlineQuery) GetType() string { + return TypeUpdateNewInlineQuery +} + +func (*UpdateNewInlineQuery) UpdateType() string { + return TypeUpdateNewInlineQuery +} + +// The user has chosen a result of an inline query; for bots only +type UpdateNewChosenInlineResult struct { + meta + // Identifier of the user who sent the query + SenderUserId int32 `json:"sender_user_id"` + // User location; 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"` +} + +func (entity *UpdateNewChosenInlineResult) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewChosenInlineResult + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewChosenInlineResult) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewChosenInlineResult) GetType() string { + return TypeUpdateNewChosenInlineResult +} + +func (*UpdateNewChosenInlineResult) UpdateType() string { + return TypeUpdateNewChosenInlineResult +} + +// A new incoming callback query; for bots only +type UpdateNewCallbackQuery struct { + 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 where 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"` +} + +func (entity *UpdateNewCallbackQuery) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewCallbackQuery + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewCallbackQuery) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewCallbackQuery) GetType() string { + return TypeUpdateNewCallbackQuery +} + +func (*UpdateNewCallbackQuery) UpdateType() string { + return TypeUpdateNewCallbackQuery +} + +func (updateNewCallbackQuery *UpdateNewCallbackQuery) UnmarshalJSON(data []byte) error { + 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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateNewCallbackQuery.Id = tmp.Id + updateNewCallbackQuery.SenderUserId = tmp.SenderUserId + updateNewCallbackQuery.ChatId = tmp.ChatId + updateNewCallbackQuery.MessageId = tmp.MessageId + updateNewCallbackQuery.ChatInstance = tmp.ChatInstance + + fieldPayload, _ := UnmarshalCallbackQueryPayload(tmp.Payload) + updateNewCallbackQuery.Payload = fieldPayload + + return nil +} + +// A new incoming callback query from a message sent via a bot; for bots only +type UpdateNewInlineCallbackQuery struct { + 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"` +} + +func (entity *UpdateNewInlineCallbackQuery) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewInlineCallbackQuery + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewInlineCallbackQuery) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewInlineCallbackQuery) GetType() string { + return TypeUpdateNewInlineCallbackQuery +} + +func (*UpdateNewInlineCallbackQuery) UpdateType() string { + return TypeUpdateNewInlineCallbackQuery +} + +func (updateNewInlineCallbackQuery *UpdateNewInlineCallbackQuery) UnmarshalJSON(data []byte) error { + 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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateNewInlineCallbackQuery.Id = tmp.Id + updateNewInlineCallbackQuery.SenderUserId = tmp.SenderUserId + updateNewInlineCallbackQuery.InlineMessageId = tmp.InlineMessageId + updateNewInlineCallbackQuery.ChatInstance = tmp.ChatInstance + + fieldPayload, _ := UnmarshalCallbackQueryPayload(tmp.Payload) + updateNewInlineCallbackQuery.Payload = fieldPayload + + return nil +} + +// A new incoming shipping query; for bots only. Only for invoices with flexible price +type UpdateNewShippingQuery struct { + 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"` +} + +func (entity *UpdateNewShippingQuery) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewShippingQuery + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewShippingQuery) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewShippingQuery) GetType() string { + return TypeUpdateNewShippingQuery +} + +func (*UpdateNewShippingQuery) UpdateType() string { + return TypeUpdateNewShippingQuery +} + +// A new incoming pre-checkout query; for bots only. Contains full information about a checkout +type UpdateNewPreCheckoutQuery struct { + 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"` +} + +func (entity *UpdateNewPreCheckoutQuery) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewPreCheckoutQuery + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewPreCheckoutQuery) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewPreCheckoutQuery) GetType() string { + return TypeUpdateNewPreCheckoutQuery +} + +func (*UpdateNewPreCheckoutQuery) UpdateType() string { + return TypeUpdateNewPreCheckoutQuery +} + +// A new incoming event; for bots only +type UpdateNewCustomEvent struct { + meta + // A JSON-serialized event + Event string `json:"event"` +} + +func (entity *UpdateNewCustomEvent) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewCustomEvent + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewCustomEvent) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewCustomEvent) GetType() string { + return TypeUpdateNewCustomEvent +} + +func (*UpdateNewCustomEvent) UpdateType() string { + return TypeUpdateNewCustomEvent +} + +// A new incoming query; for bots only +type UpdateNewCustomQuery struct { + meta + // The query identifier + Id JsonInt64 `json:"id"` + // JSON-serialized query data + Data string `json:"data"` + // Query timeout + Timeout int32 `json:"timeout"` +} + +func (entity *UpdateNewCustomQuery) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewCustomQuery + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewCustomQuery) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewCustomQuery) GetType() string { + return TypeUpdateNewCustomQuery +} + +func (*UpdateNewCustomQuery) UpdateType() string { + return TypeUpdateNewCustomQuery +} + +// 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 +} + +// A user changed the answer to a poll; for bots only +type UpdatePollAnswer struct { + meta + // Unique poll identifier + PollId JsonInt64 `json:"poll_id"` + // The user, who changed the answer to the poll + UserId int32 `json:"user_id"` + // 0-based identifiers of answer options, chosen by the user + OptionIds []int32 `json:"option_ids"` +} + +func (entity *UpdatePollAnswer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdatePollAnswer + + return json.Marshal((*stub)(entity)) +} + +func (*UpdatePollAnswer) GetClass() string { + return ClassUpdate +} + +func (*UpdatePollAnswer) GetType() string { + return TypeUpdatePollAnswer +} + +func (*UpdatePollAnswer) UpdateType() string { + return TypeUpdatePollAnswer +} + +// 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 +} + +func (updates *Updates) UnmarshalJSON(data []byte) error { + var tmp struct { + Updates []json.RawMessage `json:"updates"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldUpdates, _ := UnmarshalListOfUpdate(tmp.Updates) + updates.Updates = fieldUpdates + + return nil +} + +// 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"` + // The 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"` + // Pass true to additionally redirect stderr to the log file. Ignored on Windows + RedirectStderr bool `json:"redirect_stderr"` +} + +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 +} + +// A simple object containing a number; for testing only +type TestInt struct { + meta + // Number + Value int32 `json:"value"` +} + +func (entity *TestInt) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TestInt + + return json.Marshal((*stub)(entity)) +} + +func (*TestInt) GetClass() string { + return ClassTestInt +} + +func (*TestInt) GetType() string { + return TypeTestInt +} + +// A simple object containing a string; for testing only +type TestString struct { + meta + // String + Value string `json:"value"` +} + +func (entity *TestString) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TestString + + return json.Marshal((*stub)(entity)) +} + +func (*TestString) GetClass() string { + return ClassTestString +} + +func (*TestString) GetType() string { + return TypeTestString +} + +// A simple object containing a sequence of bytes; for testing only +type TestBytes struct { + meta + // Bytes + Value []byte `json:"value"` +} + +func (entity *TestBytes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TestBytes + + return json.Marshal((*stub)(entity)) +} + +func (*TestBytes) GetClass() string { + return ClassTestBytes +} + +func (*TestBytes) GetType() string { + return TypeTestBytes +} + +// A simple object containing a vector of numbers; for testing only +type TestVectorInt struct { + meta + // Vector of numbers + Value []int32 `json:"value"` +} + +func (entity *TestVectorInt) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TestVectorInt + + return json.Marshal((*stub)(entity)) +} + +func (*TestVectorInt) GetClass() string { + return ClassTestVectorInt +} + +func (*TestVectorInt) GetType() string { + return TypeTestVectorInt +} + +// A simple object containing a vector of objects that hold a number; for testing only +type TestVectorIntObject struct { + meta + // Vector of objects + Value []*TestInt `json:"value"` +} + +func (entity *TestVectorIntObject) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TestVectorIntObject + + return json.Marshal((*stub)(entity)) +} + +func (*TestVectorIntObject) GetClass() string { + return ClassTestVectorIntObject +} + +func (*TestVectorIntObject) GetType() string { + return TypeTestVectorIntObject +} + +// A simple object containing a vector of strings; for testing only +type TestVectorString struct { + meta + // Vector of strings + Value []string `json:"value"` +} + +func (entity *TestVectorString) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TestVectorString + + return json.Marshal((*stub)(entity)) +} + +func (*TestVectorString) GetClass() string { + return ClassTestVectorString +} + +func (*TestVectorString) GetType() string { + return TypeTestVectorString +} + +// A simple object containing a vector of objects that hold a string; for testing only +type TestVectorStringObject struct { + meta + // Vector of objects + Value []*TestString `json:"value"` +} + +func (entity *TestVectorStringObject) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TestVectorStringObject + + return json.Marshal((*stub)(entity)) +} + +func (*TestVectorStringObject) GetClass() string { + return ClassTestVectorStringObject +} + +func (*TestVectorStringObject) GetType() string { + return TypeTestVectorStringObject +} diff --git a/client/unmarshaler.go b/client/unmarshaler.go new file mode 100755 index 0000000..367bf89 --- /dev/null +++ b/client/unmarshaler.go @@ -0,0 +1,13356 @@ +// AUTOGENERATED + +package client + +import ( + "encoding/json" + "fmt" +) + +func UnmarshalAuthenticationCodeType(data json.RawMessage) (AuthenticationCodeType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeAuthenticationCodeTypeTelegramMessage: + return UnmarshalAuthenticationCodeTypeTelegramMessage(data) + + case TypeAuthenticationCodeTypeSms: + return UnmarshalAuthenticationCodeTypeSms(data) + + case TypeAuthenticationCodeTypeCall: + return UnmarshalAuthenticationCodeTypeCall(data) + + case TypeAuthenticationCodeTypeFlashCall: + return UnmarshalAuthenticationCodeTypeFlashCall(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfAuthenticationCodeType(dataList []json.RawMessage) ([]AuthenticationCodeType, error) { + list := []AuthenticationCodeType{} + + for _, data := range dataList { + entity, err := UnmarshalAuthenticationCodeType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalAuthorizationState(data json.RawMessage) (AuthorizationState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeAuthorizationStateWaitTdlibParameters: + return UnmarshalAuthorizationStateWaitTdlibParameters(data) + + case TypeAuthorizationStateWaitEncryptionKey: + return UnmarshalAuthorizationStateWaitEncryptionKey(data) + + case TypeAuthorizationStateWaitPhoneNumber: + return UnmarshalAuthorizationStateWaitPhoneNumber(data) + + case TypeAuthorizationStateWaitCode: + return UnmarshalAuthorizationStateWaitCode(data) + + case TypeAuthorizationStateWaitOtherDeviceConfirmation: + return UnmarshalAuthorizationStateWaitOtherDeviceConfirmation(data) + + case TypeAuthorizationStateWaitRegistration: + return UnmarshalAuthorizationStateWaitRegistration(data) + + case TypeAuthorizationStateWaitPassword: + return UnmarshalAuthorizationStateWaitPassword(data) + + case TypeAuthorizationStateReady: + return UnmarshalAuthorizationStateReady(data) + + case TypeAuthorizationStateLoggingOut: + return UnmarshalAuthorizationStateLoggingOut(data) + + case TypeAuthorizationStateClosing: + return UnmarshalAuthorizationStateClosing(data) + + case TypeAuthorizationStateClosed: + return UnmarshalAuthorizationStateClosed(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfAuthorizationState(dataList []json.RawMessage) ([]AuthorizationState, error) { + list := []AuthorizationState{} + + for _, data := range dataList { + entity, err := UnmarshalAuthorizationState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputFile(data json.RawMessage) (InputFile, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputFileId: + return UnmarshalInputFileId(data) + + case TypeInputFileRemote: + return UnmarshalInputFileRemote(data) + + case TypeInputFileLocal: + return UnmarshalInputFileLocal(data) + + case TypeInputFileGenerated: + return UnmarshalInputFileGenerated(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputFile(dataList []json.RawMessage) ([]InputFile, error) { + list := []InputFile{} + + for _, data := range dataList { + entity, err := UnmarshalInputFile(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalThumbnailFormat(data json.RawMessage) (ThumbnailFormat, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeThumbnailFormatJpeg: + return UnmarshalThumbnailFormatJpeg(data) + + case TypeThumbnailFormatPng: + return UnmarshalThumbnailFormatPng(data) + + case TypeThumbnailFormatWebp: + return UnmarshalThumbnailFormatWebp(data) + + case TypeThumbnailFormatGif: + return UnmarshalThumbnailFormatGif(data) + + case TypeThumbnailFormatTgs: + return UnmarshalThumbnailFormatTgs(data) + + case TypeThumbnailFormatMpeg4: + return UnmarshalThumbnailFormatMpeg4(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfThumbnailFormat(dataList []json.RawMessage) ([]ThumbnailFormat, error) { + list := []ThumbnailFormat{} + + for _, data := range dataList { + entity, err := UnmarshalThumbnailFormat(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalMaskPoint(data json.RawMessage) (MaskPoint, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMaskPointForehead: + return UnmarshalMaskPointForehead(data) + + case TypeMaskPointEyes: + return UnmarshalMaskPointEyes(data) + + case TypeMaskPointMouth: + return UnmarshalMaskPointMouth(data) + + case TypeMaskPointChin: + return UnmarshalMaskPointChin(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMaskPoint(dataList []json.RawMessage) ([]MaskPoint, error) { + list := []MaskPoint{} + + for _, data := range dataList { + entity, err := UnmarshalMaskPoint(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPollType(data json.RawMessage) (PollType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePollTypeRegular: + return UnmarshalPollTypeRegular(data) + + case TypePollTypeQuiz: + return UnmarshalPollTypeQuiz(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPollType(dataList []json.RawMessage) ([]PollType, error) { + list := []PollType{} + + for _, data := range dataList { + entity, err := UnmarshalPollType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalUserType(data json.RawMessage) (UserType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUserTypeRegular: + return UnmarshalUserTypeRegular(data) + + case TypeUserTypeDeleted: + return UnmarshalUserTypeDeleted(data) + + case TypeUserTypeBot: + return UnmarshalUserTypeBot(data) + + case TypeUserTypeUnknown: + return UnmarshalUserTypeUnknown(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUserType(dataList []json.RawMessage) ([]UserType, error) { + list := []UserType{} + + for _, data := range dataList { + entity, err := UnmarshalUserType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputChatPhoto(data json.RawMessage) (InputChatPhoto, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputChatPhotoPrevious: + return UnmarshalInputChatPhotoPrevious(data) + + case TypeInputChatPhotoStatic: + return UnmarshalInputChatPhotoStatic(data) + + case TypeInputChatPhotoAnimation: + return UnmarshalInputChatPhotoAnimation(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputChatPhoto(dataList []json.RawMessage) ([]InputChatPhoto, error) { + list := []InputChatPhoto{} + + for _, data := range dataList { + entity, err := UnmarshalInputChatPhoto(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChatMemberStatus(data json.RawMessage) (ChatMemberStatus, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatMemberStatusCreator: + return UnmarshalChatMemberStatusCreator(data) + + case TypeChatMemberStatusAdministrator: + return UnmarshalChatMemberStatusAdministrator(data) + + case TypeChatMemberStatusMember: + return UnmarshalChatMemberStatusMember(data) + + case TypeChatMemberStatusRestricted: + return UnmarshalChatMemberStatusRestricted(data) + + case TypeChatMemberStatusLeft: + return UnmarshalChatMemberStatusLeft(data) + + case TypeChatMemberStatusBanned: + return UnmarshalChatMemberStatusBanned(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatMemberStatus(dataList []json.RawMessage) ([]ChatMemberStatus, error) { + list := []ChatMemberStatus{} + + for _, data := range dataList { + entity, err := UnmarshalChatMemberStatus(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChatMembersFilter(data json.RawMessage) (ChatMembersFilter, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatMembersFilterContacts: + return UnmarshalChatMembersFilterContacts(data) + + case TypeChatMembersFilterAdministrators: + return UnmarshalChatMembersFilterAdministrators(data) + + case TypeChatMembersFilterMembers: + return UnmarshalChatMembersFilterMembers(data) + + case TypeChatMembersFilterMention: + return UnmarshalChatMembersFilterMention(data) + + case TypeChatMembersFilterRestricted: + return UnmarshalChatMembersFilterRestricted(data) + + case TypeChatMembersFilterBanned: + return UnmarshalChatMembersFilterBanned(data) + + case TypeChatMembersFilterBots: + return UnmarshalChatMembersFilterBots(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatMembersFilter(dataList []json.RawMessage) ([]ChatMembersFilter, error) { + list := []ChatMembersFilter{} + + for _, data := range dataList { + entity, err := UnmarshalChatMembersFilter(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSupergroupMembersFilter(data json.RawMessage) (SupergroupMembersFilter, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSupergroupMembersFilterRecent: + return UnmarshalSupergroupMembersFilterRecent(data) + + case TypeSupergroupMembersFilterContacts: + return UnmarshalSupergroupMembersFilterContacts(data) + + case TypeSupergroupMembersFilterAdministrators: + return UnmarshalSupergroupMembersFilterAdministrators(data) + + case TypeSupergroupMembersFilterSearch: + return UnmarshalSupergroupMembersFilterSearch(data) + + case TypeSupergroupMembersFilterRestricted: + return UnmarshalSupergroupMembersFilterRestricted(data) + + case TypeSupergroupMembersFilterBanned: + return UnmarshalSupergroupMembersFilterBanned(data) + + case TypeSupergroupMembersFilterMention: + return UnmarshalSupergroupMembersFilterMention(data) + + case TypeSupergroupMembersFilterBots: + return UnmarshalSupergroupMembersFilterBots(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSupergroupMembersFilter(dataList []json.RawMessage) ([]SupergroupMembersFilter, error) { + list := []SupergroupMembersFilter{} + + for _, data := range dataList { + entity, err := UnmarshalSupergroupMembersFilter(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSecretChatState(data json.RawMessage) (SecretChatState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSecretChatStatePending: + return UnmarshalSecretChatStatePending(data) + + case TypeSecretChatStateReady: + return UnmarshalSecretChatStateReady(data) + + case TypeSecretChatStateClosed: + return UnmarshalSecretChatStateClosed(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSecretChatState(dataList []json.RawMessage) ([]SecretChatState, error) { + list := []SecretChatState{} + + for _, data := range dataList { + entity, err := UnmarshalSecretChatState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalMessageSender(data json.RawMessage) (MessageSender, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageSenderUser: + return UnmarshalMessageSenderUser(data) + + case TypeMessageSenderChat: + return UnmarshalMessageSenderChat(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageSender(dataList []json.RawMessage) ([]MessageSender, error) { + list := []MessageSender{} + + for _, data := range dataList { + entity, err := UnmarshalMessageSender(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalMessageForwardOrigin(data json.RawMessage) (MessageForwardOrigin, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageForwardOriginUser: + return UnmarshalMessageForwardOriginUser(data) + + case TypeMessageForwardOriginChat: + return UnmarshalMessageForwardOriginChat(data) + + case TypeMessageForwardOriginHiddenUser: + return UnmarshalMessageForwardOriginHiddenUser(data) + + case TypeMessageForwardOriginChannel: + return UnmarshalMessageForwardOriginChannel(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageForwardOrigin(dataList []json.RawMessage) ([]MessageForwardOrigin, error) { + list := []MessageForwardOrigin{} + + for _, data := range dataList { + entity, err := UnmarshalMessageForwardOrigin(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalMessageSendingState(data json.RawMessage) (MessageSendingState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageSendingStatePending: + return UnmarshalMessageSendingStatePending(data) + + case TypeMessageSendingStateFailed: + return UnmarshalMessageSendingStateFailed(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageSendingState(dataList []json.RawMessage) ([]MessageSendingState, error) { + list := []MessageSendingState{} + + for _, data := range dataList { + entity, err := UnmarshalMessageSendingState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalNotificationSettingsScope(data json.RawMessage) (NotificationSettingsScope, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeNotificationSettingsScopePrivateChats: + return UnmarshalNotificationSettingsScopePrivateChats(data) + + case TypeNotificationSettingsScopeGroupChats: + return UnmarshalNotificationSettingsScopeGroupChats(data) + + case TypeNotificationSettingsScopeChannelChats: + return UnmarshalNotificationSettingsScopeChannelChats(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfNotificationSettingsScope(dataList []json.RawMessage) ([]NotificationSettingsScope, error) { + list := []NotificationSettingsScope{} + + for _, data := range dataList { + entity, err := UnmarshalNotificationSettingsScope(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChatType(data json.RawMessage) (ChatType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatTypePrivate: + return UnmarshalChatTypePrivate(data) + + case TypeChatTypeBasicGroup: + return UnmarshalChatTypeBasicGroup(data) + + case TypeChatTypeSupergroup: + return UnmarshalChatTypeSupergroup(data) + + case TypeChatTypeSecret: + return UnmarshalChatTypeSecret(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatType(dataList []json.RawMessage) ([]ChatType, error) { + list := []ChatType{} + + for _, data := range dataList { + entity, err := UnmarshalChatType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChatList(data json.RawMessage) (ChatList, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatListMain: + return UnmarshalChatListMain(data) + + case TypeChatListArchive: + return UnmarshalChatListArchive(data) + + case TypeChatListFilter: + return UnmarshalChatListFilter(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatList(dataList []json.RawMessage) ([]ChatList, error) { + list := []ChatList{} + + for _, data := range dataList { + entity, err := UnmarshalChatList(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChatSource(data json.RawMessage) (ChatSource, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatSourceMtprotoProxy: + return UnmarshalChatSourceMtprotoProxy(data) + + case TypeChatSourcePublicServiceAnnouncement: + return UnmarshalChatSourcePublicServiceAnnouncement(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatSource(dataList []json.RawMessage) ([]ChatSource, error) { + list := []ChatSource{} + + for _, data := range dataList { + entity, err := UnmarshalChatSource(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPublicChatType(data json.RawMessage) (PublicChatType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePublicChatTypeHasUsername: + return UnmarshalPublicChatTypeHasUsername(data) + + case TypePublicChatTypeIsLocationBased: + return UnmarshalPublicChatTypeIsLocationBased(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPublicChatType(dataList []json.RawMessage) ([]PublicChatType, error) { + list := []PublicChatType{} + + for _, data := range dataList { + entity, err := UnmarshalPublicChatType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChatActionBar(data json.RawMessage) (ChatActionBar, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatActionBarReportSpam: + return UnmarshalChatActionBarReportSpam(data) + + case TypeChatActionBarReportUnrelatedLocation: + return UnmarshalChatActionBarReportUnrelatedLocation(data) + + case TypeChatActionBarReportAddBlock: + return UnmarshalChatActionBarReportAddBlock(data) + + case TypeChatActionBarAddContact: + return UnmarshalChatActionBarAddContact(data) + + case TypeChatActionBarSharePhoneNumber: + return UnmarshalChatActionBarSharePhoneNumber(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatActionBar(dataList []json.RawMessage) ([]ChatActionBar, error) { + list := []ChatActionBar{} + + for _, data := range dataList { + entity, err := UnmarshalChatActionBar(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalKeyboardButtonType(data json.RawMessage) (KeyboardButtonType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeKeyboardButtonTypeText: + return UnmarshalKeyboardButtonTypeText(data) + + case TypeKeyboardButtonTypeRequestPhoneNumber: + return UnmarshalKeyboardButtonTypeRequestPhoneNumber(data) + + case TypeKeyboardButtonTypeRequestLocation: + return UnmarshalKeyboardButtonTypeRequestLocation(data) + + case TypeKeyboardButtonTypeRequestPoll: + return UnmarshalKeyboardButtonTypeRequestPoll(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfKeyboardButtonType(dataList []json.RawMessage) ([]KeyboardButtonType, error) { + list := []KeyboardButtonType{} + + for _, data := range dataList { + entity, err := UnmarshalKeyboardButtonType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInlineKeyboardButtonType(data json.RawMessage) (InlineKeyboardButtonType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInlineKeyboardButtonTypeUrl: + return UnmarshalInlineKeyboardButtonTypeUrl(data) + + case TypeInlineKeyboardButtonTypeLoginUrl: + return UnmarshalInlineKeyboardButtonTypeLoginUrl(data) + + case TypeInlineKeyboardButtonTypeCallback: + return UnmarshalInlineKeyboardButtonTypeCallback(data) + + case TypeInlineKeyboardButtonTypeCallbackWithPassword: + return UnmarshalInlineKeyboardButtonTypeCallbackWithPassword(data) + + case TypeInlineKeyboardButtonTypeCallbackGame: + return UnmarshalInlineKeyboardButtonTypeCallbackGame(data) + + case TypeInlineKeyboardButtonTypeSwitchInline: + return UnmarshalInlineKeyboardButtonTypeSwitchInline(data) + + case TypeInlineKeyboardButtonTypeBuy: + return UnmarshalInlineKeyboardButtonTypeBuy(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInlineKeyboardButtonType(dataList []json.RawMessage) ([]InlineKeyboardButtonType, error) { + list := []InlineKeyboardButtonType{} + + for _, data := range dataList { + entity, err := UnmarshalInlineKeyboardButtonType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalReplyMarkup(data json.RawMessage) (ReplyMarkup, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeReplyMarkupRemoveKeyboard: + return UnmarshalReplyMarkupRemoveKeyboard(data) + + case TypeReplyMarkupForceReply: + return UnmarshalReplyMarkupForceReply(data) + + case TypeReplyMarkupShowKeyboard: + return UnmarshalReplyMarkupShowKeyboard(data) + + case TypeReplyMarkupInlineKeyboard: + return UnmarshalReplyMarkupInlineKeyboard(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfReplyMarkup(dataList []json.RawMessage) ([]ReplyMarkup, error) { + list := []ReplyMarkup{} + + for _, data := range dataList { + entity, err := UnmarshalReplyMarkup(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalLoginUrlInfo(data json.RawMessage) (LoginUrlInfo, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeLoginUrlInfoOpen: + return UnmarshalLoginUrlInfoOpen(data) + + case TypeLoginUrlInfoRequestConfirmation: + return UnmarshalLoginUrlInfoRequestConfirmation(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfLoginUrlInfo(dataList []json.RawMessage) ([]LoginUrlInfo, error) { + list := []LoginUrlInfo{} + + for _, data := range dataList { + entity, err := UnmarshalLoginUrlInfo(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalRichText(data json.RawMessage) (RichText, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeRichTextPlain: + return UnmarshalRichTextPlain(data) + + case TypeRichTextBold: + return UnmarshalRichTextBold(data) + + case TypeRichTextItalic: + return UnmarshalRichTextItalic(data) + + case TypeRichTextUnderline: + return UnmarshalRichTextUnderline(data) + + case TypeRichTextStrikethrough: + return UnmarshalRichTextStrikethrough(data) + + case TypeRichTextFixed: + return UnmarshalRichTextFixed(data) + + case TypeRichTextUrl: + return UnmarshalRichTextUrl(data) + + case TypeRichTextEmailAddress: + return UnmarshalRichTextEmailAddress(data) + + case TypeRichTextSubscript: + return UnmarshalRichTextSubscript(data) + + case TypeRichTextSuperscript: + return UnmarshalRichTextSuperscript(data) + + case TypeRichTextMarked: + return UnmarshalRichTextMarked(data) + + case TypeRichTextPhoneNumber: + return UnmarshalRichTextPhoneNumber(data) + + case TypeRichTextIcon: + return UnmarshalRichTextIcon(data) + + case TypeRichTextReference: + return UnmarshalRichTextReference(data) + + case TypeRichTextAnchor: + return UnmarshalRichTextAnchor(data) + + case TypeRichTextAnchorLink: + return UnmarshalRichTextAnchorLink(data) + + case TypeRichTexts: + return UnmarshalRichTexts(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfRichText(dataList []json.RawMessage) ([]RichText, error) { + list := []RichText{} + + for _, data := range dataList { + entity, err := UnmarshalRichText(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPageBlockHorizontalAlignment(data json.RawMessage) (PageBlockHorizontalAlignment, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePageBlockHorizontalAlignmentLeft: + return UnmarshalPageBlockHorizontalAlignmentLeft(data) + + case TypePageBlockHorizontalAlignmentCenter: + return UnmarshalPageBlockHorizontalAlignmentCenter(data) + + case TypePageBlockHorizontalAlignmentRight: + return UnmarshalPageBlockHorizontalAlignmentRight(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPageBlockHorizontalAlignment(dataList []json.RawMessage) ([]PageBlockHorizontalAlignment, error) { + list := []PageBlockHorizontalAlignment{} + + for _, data := range dataList { + entity, err := UnmarshalPageBlockHorizontalAlignment(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPageBlockVerticalAlignment(data json.RawMessage) (PageBlockVerticalAlignment, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePageBlockVerticalAlignmentTop: + return UnmarshalPageBlockVerticalAlignmentTop(data) + + case TypePageBlockVerticalAlignmentMiddle: + return UnmarshalPageBlockVerticalAlignmentMiddle(data) + + case TypePageBlockVerticalAlignmentBottom: + return UnmarshalPageBlockVerticalAlignmentBottom(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPageBlockVerticalAlignment(dataList []json.RawMessage) ([]PageBlockVerticalAlignment, error) { + list := []PageBlockVerticalAlignment{} + + for _, data := range dataList { + entity, err := UnmarshalPageBlockVerticalAlignment(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPageBlock(data json.RawMessage) (PageBlock, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePageBlockTitle: + return UnmarshalPageBlockTitle(data) + + case TypePageBlockSubtitle: + return UnmarshalPageBlockSubtitle(data) + + case TypePageBlockAuthorDate: + return UnmarshalPageBlockAuthorDate(data) + + case TypePageBlockHeader: + return UnmarshalPageBlockHeader(data) + + case TypePageBlockSubheader: + return UnmarshalPageBlockSubheader(data) + + case TypePageBlockKicker: + return UnmarshalPageBlockKicker(data) + + case TypePageBlockParagraph: + return UnmarshalPageBlockParagraph(data) + + case TypePageBlockPreformatted: + return UnmarshalPageBlockPreformatted(data) + + case TypePageBlockFooter: + return UnmarshalPageBlockFooter(data) + + case TypePageBlockDivider: + return UnmarshalPageBlockDivider(data) + + case TypePageBlockAnchor: + return UnmarshalPageBlockAnchor(data) + + case TypePageBlockList: + return UnmarshalPageBlockList(data) + + case TypePageBlockBlockQuote: + return UnmarshalPageBlockBlockQuote(data) + + case TypePageBlockPullQuote: + return UnmarshalPageBlockPullQuote(data) + + case TypePageBlockAnimation: + return UnmarshalPageBlockAnimation(data) + + case TypePageBlockAudio: + return UnmarshalPageBlockAudio(data) + + case TypePageBlockPhoto: + return UnmarshalPageBlockPhoto(data) + + case TypePageBlockVideo: + return UnmarshalPageBlockVideo(data) + + case TypePageBlockVoiceNote: + return UnmarshalPageBlockVoiceNote(data) + + case TypePageBlockCover: + return UnmarshalPageBlockCover(data) + + case TypePageBlockEmbedded: + return UnmarshalPageBlockEmbedded(data) + + case TypePageBlockEmbeddedPost: + return UnmarshalPageBlockEmbeddedPost(data) + + case TypePageBlockCollage: + return UnmarshalPageBlockCollage(data) + + case TypePageBlockSlideshow: + return UnmarshalPageBlockSlideshow(data) + + case TypePageBlockChatLink: + return UnmarshalPageBlockChatLink(data) + + case TypePageBlockTable: + return UnmarshalPageBlockTable(data) + + case TypePageBlockDetails: + return UnmarshalPageBlockDetails(data) + + case TypePageBlockRelatedArticles: + return UnmarshalPageBlockRelatedArticles(data) + + case TypePageBlockMap: + return UnmarshalPageBlockMap(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPageBlock(dataList []json.RawMessage) ([]PageBlock, error) { + list := []PageBlock{} + + for _, data := range dataList { + entity, err := UnmarshalPageBlock(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputCredentials(data json.RawMessage) (InputCredentials, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputCredentialsSaved: + return UnmarshalInputCredentialsSaved(data) + + case TypeInputCredentialsNew: + return UnmarshalInputCredentialsNew(data) + + case TypeInputCredentialsAndroidPay: + return UnmarshalInputCredentialsAndroidPay(data) + + case TypeInputCredentialsApplePay: + return UnmarshalInputCredentialsApplePay(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputCredentials(dataList []json.RawMessage) ([]InputCredentials, error) { + list := []InputCredentials{} + + for _, data := range dataList { + entity, err := UnmarshalInputCredentials(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPassportElementType(data json.RawMessage) (PassportElementType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePassportElementTypePersonalDetails: + return UnmarshalPassportElementTypePersonalDetails(data) + + case TypePassportElementTypePassport: + return UnmarshalPassportElementTypePassport(data) + + case TypePassportElementTypeDriverLicense: + return UnmarshalPassportElementTypeDriverLicense(data) + + case TypePassportElementTypeIdentityCard: + return UnmarshalPassportElementTypeIdentityCard(data) + + case TypePassportElementTypeInternalPassport: + return UnmarshalPassportElementTypeInternalPassport(data) + + case TypePassportElementTypeAddress: + return UnmarshalPassportElementTypeAddress(data) + + case TypePassportElementTypeUtilityBill: + return UnmarshalPassportElementTypeUtilityBill(data) + + case TypePassportElementTypeBankStatement: + return UnmarshalPassportElementTypeBankStatement(data) + + case TypePassportElementTypeRentalAgreement: + return UnmarshalPassportElementTypeRentalAgreement(data) + + case TypePassportElementTypePassportRegistration: + return UnmarshalPassportElementTypePassportRegistration(data) + + case TypePassportElementTypeTemporaryRegistration: + return UnmarshalPassportElementTypeTemporaryRegistration(data) + + case TypePassportElementTypePhoneNumber: + return UnmarshalPassportElementTypePhoneNumber(data) + + case TypePassportElementTypeEmailAddress: + return UnmarshalPassportElementTypeEmailAddress(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPassportElementType(dataList []json.RawMessage) ([]PassportElementType, error) { + list := []PassportElementType{} + + for _, data := range dataList { + entity, err := UnmarshalPassportElementType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPassportElement(data json.RawMessage) (PassportElement, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePassportElementPersonalDetails: + return UnmarshalPassportElementPersonalDetails(data) + + case TypePassportElementPassport: + return UnmarshalPassportElementPassport(data) + + case TypePassportElementDriverLicense: + return UnmarshalPassportElementDriverLicense(data) + + case TypePassportElementIdentityCard: + return UnmarshalPassportElementIdentityCard(data) + + case TypePassportElementInternalPassport: + return UnmarshalPassportElementInternalPassport(data) + + case TypePassportElementAddress: + return UnmarshalPassportElementAddress(data) + + case TypePassportElementUtilityBill: + return UnmarshalPassportElementUtilityBill(data) + + case TypePassportElementBankStatement: + return UnmarshalPassportElementBankStatement(data) + + case TypePassportElementRentalAgreement: + return UnmarshalPassportElementRentalAgreement(data) + + case TypePassportElementPassportRegistration: + return UnmarshalPassportElementPassportRegistration(data) + + case TypePassportElementTemporaryRegistration: + return UnmarshalPassportElementTemporaryRegistration(data) + + case TypePassportElementPhoneNumber: + return UnmarshalPassportElementPhoneNumber(data) + + case TypePassportElementEmailAddress: + return UnmarshalPassportElementEmailAddress(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPassportElement(dataList []json.RawMessage) ([]PassportElement, error) { + list := []PassportElement{} + + for _, data := range dataList { + entity, err := UnmarshalPassportElement(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputPassportElement(data json.RawMessage) (InputPassportElement, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputPassportElementPersonalDetails: + return UnmarshalInputPassportElementPersonalDetails(data) + + case TypeInputPassportElementPassport: + return UnmarshalInputPassportElementPassport(data) + + case TypeInputPassportElementDriverLicense: + return UnmarshalInputPassportElementDriverLicense(data) + + case TypeInputPassportElementIdentityCard: + return UnmarshalInputPassportElementIdentityCard(data) + + case TypeInputPassportElementInternalPassport: + return UnmarshalInputPassportElementInternalPassport(data) + + case TypeInputPassportElementAddress: + return UnmarshalInputPassportElementAddress(data) + + case TypeInputPassportElementUtilityBill: + return UnmarshalInputPassportElementUtilityBill(data) + + case TypeInputPassportElementBankStatement: + return UnmarshalInputPassportElementBankStatement(data) + + case TypeInputPassportElementRentalAgreement: + return UnmarshalInputPassportElementRentalAgreement(data) + + case TypeInputPassportElementPassportRegistration: + return UnmarshalInputPassportElementPassportRegistration(data) + + case TypeInputPassportElementTemporaryRegistration: + return UnmarshalInputPassportElementTemporaryRegistration(data) + + case TypeInputPassportElementPhoneNumber: + return UnmarshalInputPassportElementPhoneNumber(data) + + case TypeInputPassportElementEmailAddress: + return UnmarshalInputPassportElementEmailAddress(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputPassportElement(dataList []json.RawMessage) ([]InputPassportElement, error) { + list := []InputPassportElement{} + + for _, data := range dataList { + entity, err := UnmarshalInputPassportElement(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPassportElementErrorSource(data json.RawMessage) (PassportElementErrorSource, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePassportElementErrorSourceUnspecified: + return UnmarshalPassportElementErrorSourceUnspecified(data) + + case TypePassportElementErrorSourceDataField: + return UnmarshalPassportElementErrorSourceDataField(data) + + case TypePassportElementErrorSourceFrontSide: + return UnmarshalPassportElementErrorSourceFrontSide(data) + + case TypePassportElementErrorSourceReverseSide: + return UnmarshalPassportElementErrorSourceReverseSide(data) + + case TypePassportElementErrorSourceSelfie: + return UnmarshalPassportElementErrorSourceSelfie(data) + + case TypePassportElementErrorSourceTranslationFile: + return UnmarshalPassportElementErrorSourceTranslationFile(data) + + case TypePassportElementErrorSourceTranslationFiles: + return UnmarshalPassportElementErrorSourceTranslationFiles(data) + + case TypePassportElementErrorSourceFile: + return UnmarshalPassportElementErrorSourceFile(data) + + case TypePassportElementErrorSourceFiles: + return UnmarshalPassportElementErrorSourceFiles(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPassportElementErrorSource(dataList []json.RawMessage) ([]PassportElementErrorSource, error) { + list := []PassportElementErrorSource{} + + for _, data := range dataList { + entity, err := UnmarshalPassportElementErrorSource(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputPassportElementErrorSource(data json.RawMessage) (InputPassportElementErrorSource, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputPassportElementErrorSourceUnspecified: + return UnmarshalInputPassportElementErrorSourceUnspecified(data) + + case TypeInputPassportElementErrorSourceDataField: + return UnmarshalInputPassportElementErrorSourceDataField(data) + + case TypeInputPassportElementErrorSourceFrontSide: + return UnmarshalInputPassportElementErrorSourceFrontSide(data) + + case TypeInputPassportElementErrorSourceReverseSide: + return UnmarshalInputPassportElementErrorSourceReverseSide(data) + + case TypeInputPassportElementErrorSourceSelfie: + return UnmarshalInputPassportElementErrorSourceSelfie(data) + + case TypeInputPassportElementErrorSourceTranslationFile: + return UnmarshalInputPassportElementErrorSourceTranslationFile(data) + + case TypeInputPassportElementErrorSourceTranslationFiles: + return UnmarshalInputPassportElementErrorSourceTranslationFiles(data) + + case TypeInputPassportElementErrorSourceFile: + return UnmarshalInputPassportElementErrorSourceFile(data) + + case TypeInputPassportElementErrorSourceFiles: + return UnmarshalInputPassportElementErrorSourceFiles(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputPassportElementErrorSource(dataList []json.RawMessage) ([]InputPassportElementErrorSource, error) { + list := []InputPassportElementErrorSource{} + + for _, data := range dataList { + entity, err := UnmarshalInputPassportElementErrorSource(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageText: + return UnmarshalMessageText(data) + + case TypeMessageAnimation: + return UnmarshalMessageAnimation(data) + + case TypeMessageAudio: + return UnmarshalMessageAudio(data) + + case TypeMessageDocument: + return UnmarshalMessageDocument(data) + + case TypeMessagePhoto: + return UnmarshalMessagePhoto(data) + + case TypeMessageExpiredPhoto: + return UnmarshalMessageExpiredPhoto(data) + + case TypeMessageSticker: + return UnmarshalMessageSticker(data) + + case TypeMessageVideo: + return UnmarshalMessageVideo(data) + + case TypeMessageExpiredVideo: + return UnmarshalMessageExpiredVideo(data) + + case TypeMessageVideoNote: + return UnmarshalMessageVideoNote(data) + + case TypeMessageVoiceNote: + return UnmarshalMessageVoiceNote(data) + + case TypeMessageLocation: + return UnmarshalMessageLocation(data) + + case TypeMessageVenue: + return UnmarshalMessageVenue(data) + + case TypeMessageContact: + return UnmarshalMessageContact(data) + + case TypeMessageDice: + return UnmarshalMessageDice(data) + + case TypeMessageGame: + return UnmarshalMessageGame(data) + + case TypeMessagePoll: + return UnmarshalMessagePoll(data) + + case TypeMessageInvoice: + return UnmarshalMessageInvoice(data) + + case TypeMessageCall: + return UnmarshalMessageCall(data) + + case TypeMessageBasicGroupChatCreate: + return UnmarshalMessageBasicGroupChatCreate(data) + + case TypeMessageSupergroupChatCreate: + return UnmarshalMessageSupergroupChatCreate(data) + + case TypeMessageChatChangeTitle: + return UnmarshalMessageChatChangeTitle(data) + + case TypeMessageChatChangePhoto: + return UnmarshalMessageChatChangePhoto(data) + + case TypeMessageChatDeletePhoto: + return UnmarshalMessageChatDeletePhoto(data) + + case TypeMessageChatAddMembers: + return UnmarshalMessageChatAddMembers(data) + + case TypeMessageChatJoinByLink: + return UnmarshalMessageChatJoinByLink(data) + + case TypeMessageChatDeleteMember: + return UnmarshalMessageChatDeleteMember(data) + + case TypeMessageChatUpgradeTo: + return UnmarshalMessageChatUpgradeTo(data) + + case TypeMessageChatUpgradeFrom: + return UnmarshalMessageChatUpgradeFrom(data) + + case TypeMessagePinMessage: + return UnmarshalMessagePinMessage(data) + + case TypeMessageScreenshotTaken: + return UnmarshalMessageScreenshotTaken(data) + + case TypeMessageChatSetTtl: + return UnmarshalMessageChatSetTtl(data) + + case TypeMessageCustomServiceAction: + return UnmarshalMessageCustomServiceAction(data) + + case TypeMessageGameScore: + return UnmarshalMessageGameScore(data) + + case TypeMessagePaymentSuccessful: + return UnmarshalMessagePaymentSuccessful(data) + + case TypeMessagePaymentSuccessfulBot: + return UnmarshalMessagePaymentSuccessfulBot(data) + + case TypeMessageContactRegistered: + return UnmarshalMessageContactRegistered(data) + + case TypeMessageWebsiteConnected: + return UnmarshalMessageWebsiteConnected(data) + + case TypeMessagePassportDataSent: + return UnmarshalMessagePassportDataSent(data) + + case TypeMessagePassportDataReceived: + return UnmarshalMessagePassportDataReceived(data) + + case TypeMessageProximityAlertTriggered: + return UnmarshalMessageProximityAlertTriggered(data) + + case TypeMessageUnsupported: + return UnmarshalMessageUnsupported(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageContent(dataList []json.RawMessage) ([]MessageContent, error) { + list := []MessageContent{} + + for _, data := range dataList { + entity, err := UnmarshalMessageContent(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalTextEntityType(data json.RawMessage) (TextEntityType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTextEntityTypeMention: + return UnmarshalTextEntityTypeMention(data) + + case TypeTextEntityTypeHashtag: + return UnmarshalTextEntityTypeHashtag(data) + + case TypeTextEntityTypeCashtag: + return UnmarshalTextEntityTypeCashtag(data) + + case TypeTextEntityTypeBotCommand: + return UnmarshalTextEntityTypeBotCommand(data) + + case TypeTextEntityTypeUrl: + return UnmarshalTextEntityTypeUrl(data) + + case TypeTextEntityTypeEmailAddress: + return UnmarshalTextEntityTypeEmailAddress(data) + + case TypeTextEntityTypePhoneNumber: + return UnmarshalTextEntityTypePhoneNumber(data) + + case TypeTextEntityTypeBankCardNumber: + return UnmarshalTextEntityTypeBankCardNumber(data) + + case TypeTextEntityTypeBold: + return UnmarshalTextEntityTypeBold(data) + + case TypeTextEntityTypeItalic: + return UnmarshalTextEntityTypeItalic(data) + + case TypeTextEntityTypeUnderline: + return UnmarshalTextEntityTypeUnderline(data) + + case TypeTextEntityTypeStrikethrough: + return UnmarshalTextEntityTypeStrikethrough(data) + + case TypeTextEntityTypeCode: + return UnmarshalTextEntityTypeCode(data) + + case TypeTextEntityTypePre: + return UnmarshalTextEntityTypePre(data) + + case TypeTextEntityTypePreCode: + return UnmarshalTextEntityTypePreCode(data) + + case TypeTextEntityTypeTextUrl: + return UnmarshalTextEntityTypeTextUrl(data) + + case TypeTextEntityTypeMentionName: + return UnmarshalTextEntityTypeMentionName(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTextEntityType(dataList []json.RawMessage) ([]TextEntityType, error) { + list := []TextEntityType{} + + for _, data := range dataList { + entity, err := UnmarshalTextEntityType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalMessageSchedulingState(data json.RawMessage) (MessageSchedulingState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageSchedulingStateSendAtDate: + return UnmarshalMessageSchedulingStateSendAtDate(data) + + case TypeMessageSchedulingStateSendWhenOnline: + return UnmarshalMessageSchedulingStateSendWhenOnline(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageSchedulingState(dataList []json.RawMessage) ([]MessageSchedulingState, error) { + list := []MessageSchedulingState{} + + for _, data := range dataList { + entity, err := UnmarshalMessageSchedulingState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputMessageContent(data json.RawMessage) (InputMessageContent, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputMessageText: + return UnmarshalInputMessageText(data) + + case TypeInputMessageAnimation: + return UnmarshalInputMessageAnimation(data) + + case TypeInputMessageAudio: + return UnmarshalInputMessageAudio(data) + + case TypeInputMessageDocument: + return UnmarshalInputMessageDocument(data) + + case TypeInputMessagePhoto: + return UnmarshalInputMessagePhoto(data) + + case TypeInputMessageSticker: + return UnmarshalInputMessageSticker(data) + + case TypeInputMessageVideo: + return UnmarshalInputMessageVideo(data) + + case TypeInputMessageVideoNote: + return UnmarshalInputMessageVideoNote(data) + + case TypeInputMessageVoiceNote: + return UnmarshalInputMessageVoiceNote(data) + + case TypeInputMessageLocation: + return UnmarshalInputMessageLocation(data) + + case TypeInputMessageVenue: + return UnmarshalInputMessageVenue(data) + + case TypeInputMessageContact: + return UnmarshalInputMessageContact(data) + + case TypeInputMessageDice: + return UnmarshalInputMessageDice(data) + + case TypeInputMessageGame: + return UnmarshalInputMessageGame(data) + + case TypeInputMessageInvoice: + return UnmarshalInputMessageInvoice(data) + + case TypeInputMessagePoll: + return UnmarshalInputMessagePoll(data) + + case TypeInputMessageForwarded: + return UnmarshalInputMessageForwarded(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputMessageContent(dataList []json.RawMessage) ([]InputMessageContent, error) { + list := []InputMessageContent{} + + for _, data := range dataList { + entity, err := UnmarshalInputMessageContent(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSearchMessagesFilter(data json.RawMessage) (SearchMessagesFilter, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSearchMessagesFilterEmpty: + return UnmarshalSearchMessagesFilterEmpty(data) + + case TypeSearchMessagesFilterAnimation: + return UnmarshalSearchMessagesFilterAnimation(data) + + case TypeSearchMessagesFilterAudio: + return UnmarshalSearchMessagesFilterAudio(data) + + case TypeSearchMessagesFilterDocument: + return UnmarshalSearchMessagesFilterDocument(data) + + case TypeSearchMessagesFilterPhoto: + return UnmarshalSearchMessagesFilterPhoto(data) + + case TypeSearchMessagesFilterVideo: + return UnmarshalSearchMessagesFilterVideo(data) + + case TypeSearchMessagesFilterVoiceNote: + return UnmarshalSearchMessagesFilterVoiceNote(data) + + case TypeSearchMessagesFilterPhotoAndVideo: + return UnmarshalSearchMessagesFilterPhotoAndVideo(data) + + case TypeSearchMessagesFilterUrl: + return UnmarshalSearchMessagesFilterUrl(data) + + case TypeSearchMessagesFilterChatPhoto: + return UnmarshalSearchMessagesFilterChatPhoto(data) + + case TypeSearchMessagesFilterCall: + return UnmarshalSearchMessagesFilterCall(data) + + case TypeSearchMessagesFilterMissedCall: + return UnmarshalSearchMessagesFilterMissedCall(data) + + case TypeSearchMessagesFilterVideoNote: + return UnmarshalSearchMessagesFilterVideoNote(data) + + case TypeSearchMessagesFilterVoiceAndVideoNote: + return UnmarshalSearchMessagesFilterVoiceAndVideoNote(data) + + case TypeSearchMessagesFilterMention: + return UnmarshalSearchMessagesFilterMention(data) + + case TypeSearchMessagesFilterUnreadMention: + return UnmarshalSearchMessagesFilterUnreadMention(data) + + case TypeSearchMessagesFilterFailedToSend: + return UnmarshalSearchMessagesFilterFailedToSend(data) + + case TypeSearchMessagesFilterPinned: + return UnmarshalSearchMessagesFilterPinned(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSearchMessagesFilter(dataList []json.RawMessage) ([]SearchMessagesFilter, error) { + list := []SearchMessagesFilter{} + + for _, data := range dataList { + entity, err := UnmarshalSearchMessagesFilter(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChatAction(data json.RawMessage) (ChatAction, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatActionTyping: + return UnmarshalChatActionTyping(data) + + case TypeChatActionRecordingVideo: + return UnmarshalChatActionRecordingVideo(data) + + case TypeChatActionUploadingVideo: + return UnmarshalChatActionUploadingVideo(data) + + case TypeChatActionRecordingVoiceNote: + return UnmarshalChatActionRecordingVoiceNote(data) + + case TypeChatActionUploadingVoiceNote: + return UnmarshalChatActionUploadingVoiceNote(data) + + case TypeChatActionUploadingPhoto: + return UnmarshalChatActionUploadingPhoto(data) + + case TypeChatActionUploadingDocument: + return UnmarshalChatActionUploadingDocument(data) + + case TypeChatActionChoosingLocation: + return UnmarshalChatActionChoosingLocation(data) + + case TypeChatActionChoosingContact: + return UnmarshalChatActionChoosingContact(data) + + case TypeChatActionStartPlayingGame: + return UnmarshalChatActionStartPlayingGame(data) + + case TypeChatActionRecordingVideoNote: + return UnmarshalChatActionRecordingVideoNote(data) + + case TypeChatActionUploadingVideoNote: + return UnmarshalChatActionUploadingVideoNote(data) + + case TypeChatActionCancel: + return UnmarshalChatActionCancel(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatAction(dataList []json.RawMessage) ([]ChatAction, error) { + list := []ChatAction{} + + for _, data := range dataList { + entity, err := UnmarshalChatAction(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalUserStatus(data json.RawMessage) (UserStatus, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUserStatusEmpty: + return UnmarshalUserStatusEmpty(data) + + case TypeUserStatusOnline: + return UnmarshalUserStatusOnline(data) + + case TypeUserStatusOffline: + return UnmarshalUserStatusOffline(data) + + case TypeUserStatusRecently: + return UnmarshalUserStatusRecently(data) + + case TypeUserStatusLastWeek: + return UnmarshalUserStatusLastWeek(data) + + case TypeUserStatusLastMonth: + return UnmarshalUserStatusLastMonth(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUserStatus(dataList []json.RawMessage) ([]UserStatus, error) { + list := []UserStatus{} + + for _, data := range dataList { + entity, err := UnmarshalUserStatus(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCallDiscardReasonEmpty: + return UnmarshalCallDiscardReasonEmpty(data) + + case TypeCallDiscardReasonMissed: + return UnmarshalCallDiscardReasonMissed(data) + + case TypeCallDiscardReasonDeclined: + return UnmarshalCallDiscardReasonDeclined(data) + + case TypeCallDiscardReasonDisconnected: + return UnmarshalCallDiscardReasonDisconnected(data) + + case TypeCallDiscardReasonHungUp: + return UnmarshalCallDiscardReasonHungUp(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCallDiscardReason(dataList []json.RawMessage) ([]CallDiscardReason, error) { + list := []CallDiscardReason{} + + for _, data := range dataList { + entity, err := UnmarshalCallDiscardReason(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalCallServerType(data json.RawMessage) (CallServerType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCallServerTypeTelegramReflector: + return UnmarshalCallServerTypeTelegramReflector(data) + + case TypeCallServerTypeWebrtc: + return UnmarshalCallServerTypeWebrtc(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCallServerType(dataList []json.RawMessage) ([]CallServerType, error) { + list := []CallServerType{} + + for _, data := range dataList { + entity, err := UnmarshalCallServerType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalCallState(data json.RawMessage) (CallState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCallStatePending: + return UnmarshalCallStatePending(data) + + case TypeCallStateExchangingKeys: + return UnmarshalCallStateExchangingKeys(data) + + case TypeCallStateReady: + return UnmarshalCallStateReady(data) + + case TypeCallStateHangingUp: + return UnmarshalCallStateHangingUp(data) + + case TypeCallStateDiscarded: + return UnmarshalCallStateDiscarded(data) + + case TypeCallStateError: + return UnmarshalCallStateError(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCallState(dataList []json.RawMessage) ([]CallState, error) { + list := []CallState{} + + for _, data := range dataList { + entity, err := UnmarshalCallState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalCallProblem(data json.RawMessage) (CallProblem, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCallProblemEcho: + return UnmarshalCallProblemEcho(data) + + case TypeCallProblemNoise: + return UnmarshalCallProblemNoise(data) + + case TypeCallProblemInterruptions: + return UnmarshalCallProblemInterruptions(data) + + case TypeCallProblemDistortedSpeech: + return UnmarshalCallProblemDistortedSpeech(data) + + case TypeCallProblemSilentLocal: + return UnmarshalCallProblemSilentLocal(data) + + case TypeCallProblemSilentRemote: + return UnmarshalCallProblemSilentRemote(data) + + case TypeCallProblemDropped: + return UnmarshalCallProblemDropped(data) + + case TypeCallProblemDistortedVideo: + return UnmarshalCallProblemDistortedVideo(data) + + case TypeCallProblemPixelatedVideo: + return UnmarshalCallProblemPixelatedVideo(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCallProblem(dataList []json.RawMessage) ([]CallProblem, error) { + list := []CallProblem{} + + for _, data := range dataList { + entity, err := UnmarshalCallProblem(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalDiceStickers(data json.RawMessage) (DiceStickers, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeDiceStickersRegular: + return UnmarshalDiceStickersRegular(data) + + case TypeDiceStickersSlotMachine: + return UnmarshalDiceStickersSlotMachine(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfDiceStickers(dataList []json.RawMessage) ([]DiceStickers, error) { + list := []DiceStickers{} + + for _, data := range dataList { + entity, err := UnmarshalDiceStickers(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputInlineQueryResult(data json.RawMessage) (InputInlineQueryResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputInlineQueryResultAnimation: + return UnmarshalInputInlineQueryResultAnimation(data) + + case TypeInputInlineQueryResultArticle: + return UnmarshalInputInlineQueryResultArticle(data) + + case TypeInputInlineQueryResultAudio: + return UnmarshalInputInlineQueryResultAudio(data) + + case TypeInputInlineQueryResultContact: + return UnmarshalInputInlineQueryResultContact(data) + + case TypeInputInlineQueryResultDocument: + return UnmarshalInputInlineQueryResultDocument(data) + + case TypeInputInlineQueryResultGame: + return UnmarshalInputInlineQueryResultGame(data) + + case TypeInputInlineQueryResultLocation: + return UnmarshalInputInlineQueryResultLocation(data) + + case TypeInputInlineQueryResultPhoto: + return UnmarshalInputInlineQueryResultPhoto(data) + + case TypeInputInlineQueryResultSticker: + return UnmarshalInputInlineQueryResultSticker(data) + + case TypeInputInlineQueryResultVenue: + return UnmarshalInputInlineQueryResultVenue(data) + + case TypeInputInlineQueryResultVideo: + return UnmarshalInputInlineQueryResultVideo(data) + + case TypeInputInlineQueryResultVoiceNote: + return UnmarshalInputInlineQueryResultVoiceNote(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputInlineQueryResult(dataList []json.RawMessage) ([]InputInlineQueryResult, error) { + list := []InputInlineQueryResult{} + + for _, data := range dataList { + entity, err := UnmarshalInputInlineQueryResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInlineQueryResult(data json.RawMessage) (InlineQueryResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInlineQueryResultArticle: + return UnmarshalInlineQueryResultArticle(data) + + case TypeInlineQueryResultContact: + return UnmarshalInlineQueryResultContact(data) + + case TypeInlineQueryResultLocation: + return UnmarshalInlineQueryResultLocation(data) + + case TypeInlineQueryResultVenue: + return UnmarshalInlineQueryResultVenue(data) + + case TypeInlineQueryResultGame: + return UnmarshalInlineQueryResultGame(data) + + case TypeInlineQueryResultAnimation: + return UnmarshalInlineQueryResultAnimation(data) + + case TypeInlineQueryResultAudio: + return UnmarshalInlineQueryResultAudio(data) + + case TypeInlineQueryResultDocument: + return UnmarshalInlineQueryResultDocument(data) + + case TypeInlineQueryResultPhoto: + return UnmarshalInlineQueryResultPhoto(data) + + case TypeInlineQueryResultSticker: + return UnmarshalInlineQueryResultSticker(data) + + case TypeInlineQueryResultVideo: + return UnmarshalInlineQueryResultVideo(data) + + case TypeInlineQueryResultVoiceNote: + return UnmarshalInlineQueryResultVoiceNote(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInlineQueryResult(dataList []json.RawMessage) ([]InlineQueryResult, error) { + list := []InlineQueryResult{} + + for _, data := range dataList { + entity, err := UnmarshalInlineQueryResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalCallbackQueryPayload(data json.RawMessage) (CallbackQueryPayload, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCallbackQueryPayloadData: + return UnmarshalCallbackQueryPayloadData(data) + + case TypeCallbackQueryPayloadDataWithPassword: + return UnmarshalCallbackQueryPayloadDataWithPassword(data) + + case TypeCallbackQueryPayloadGame: + return UnmarshalCallbackQueryPayloadGame(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCallbackQueryPayload(dataList []json.RawMessage) ([]CallbackQueryPayload, error) { + list := []CallbackQueryPayload{} + + for _, data := range dataList { + entity, err := UnmarshalCallbackQueryPayload(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatEventMessageEdited: + return UnmarshalChatEventMessageEdited(data) + + case TypeChatEventMessageDeleted: + return UnmarshalChatEventMessageDeleted(data) + + case TypeChatEventPollStopped: + return UnmarshalChatEventPollStopped(data) + + case TypeChatEventMessagePinned: + return UnmarshalChatEventMessagePinned(data) + + case TypeChatEventMessageUnpinned: + return UnmarshalChatEventMessageUnpinned(data) + + case TypeChatEventMemberJoined: + return UnmarshalChatEventMemberJoined(data) + + case TypeChatEventMemberLeft: + return UnmarshalChatEventMemberLeft(data) + + case TypeChatEventMemberInvited: + return UnmarshalChatEventMemberInvited(data) + + case TypeChatEventMemberPromoted: + return UnmarshalChatEventMemberPromoted(data) + + case TypeChatEventMemberRestricted: + return UnmarshalChatEventMemberRestricted(data) + + case TypeChatEventTitleChanged: + return UnmarshalChatEventTitleChanged(data) + + case TypeChatEventPermissionsChanged: + return UnmarshalChatEventPermissionsChanged(data) + + case TypeChatEventDescriptionChanged: + return UnmarshalChatEventDescriptionChanged(data) + + case TypeChatEventUsernameChanged: + return UnmarshalChatEventUsernameChanged(data) + + case TypeChatEventPhotoChanged: + return UnmarshalChatEventPhotoChanged(data) + + case TypeChatEventInvitesToggled: + return UnmarshalChatEventInvitesToggled(data) + + case TypeChatEventLinkedChatChanged: + return UnmarshalChatEventLinkedChatChanged(data) + + case TypeChatEventSlowModeDelayChanged: + return UnmarshalChatEventSlowModeDelayChanged(data) + + case TypeChatEventSignMessagesToggled: + return UnmarshalChatEventSignMessagesToggled(data) + + case TypeChatEventStickerSetChanged: + return UnmarshalChatEventStickerSetChanged(data) + + case TypeChatEventLocationChanged: + return UnmarshalChatEventLocationChanged(data) + + case TypeChatEventIsAllHistoryAvailableToggled: + return UnmarshalChatEventIsAllHistoryAvailableToggled(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatEventAction(dataList []json.RawMessage) ([]ChatEventAction, error) { + list := []ChatEventAction{} + + for _, data := range dataList { + entity, err := UnmarshalChatEventAction(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalLanguagePackStringValue(data json.RawMessage) (LanguagePackStringValue, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeLanguagePackStringValueOrdinary: + return UnmarshalLanguagePackStringValueOrdinary(data) + + case TypeLanguagePackStringValuePluralized: + return UnmarshalLanguagePackStringValuePluralized(data) + + case TypeLanguagePackStringValueDeleted: + return UnmarshalLanguagePackStringValueDeleted(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfLanguagePackStringValue(dataList []json.RawMessage) ([]LanguagePackStringValue, error) { + list := []LanguagePackStringValue{} + + for _, data := range dataList { + entity, err := UnmarshalLanguagePackStringValue(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalDeviceToken(data json.RawMessage) (DeviceToken, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeDeviceTokenFirebaseCloudMessaging: + return UnmarshalDeviceTokenFirebaseCloudMessaging(data) + + case TypeDeviceTokenApplePush: + return UnmarshalDeviceTokenApplePush(data) + + case TypeDeviceTokenApplePushVoIP: + return UnmarshalDeviceTokenApplePushVoIP(data) + + case TypeDeviceTokenWindowsPush: + return UnmarshalDeviceTokenWindowsPush(data) + + case TypeDeviceTokenMicrosoftPush: + return UnmarshalDeviceTokenMicrosoftPush(data) + + case TypeDeviceTokenMicrosoftPushVoIP: + return UnmarshalDeviceTokenMicrosoftPushVoIP(data) + + case TypeDeviceTokenWebPush: + return UnmarshalDeviceTokenWebPush(data) + + case TypeDeviceTokenSimplePush: + return UnmarshalDeviceTokenSimplePush(data) + + case TypeDeviceTokenUbuntuPush: + return UnmarshalDeviceTokenUbuntuPush(data) + + case TypeDeviceTokenBlackBerryPush: + return UnmarshalDeviceTokenBlackBerryPush(data) + + case TypeDeviceTokenTizenPush: + return UnmarshalDeviceTokenTizenPush(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfDeviceToken(dataList []json.RawMessage) ([]DeviceToken, error) { + list := []DeviceToken{} + + for _, data := range dataList { + entity, err := UnmarshalDeviceToken(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalBackgroundFill(data json.RawMessage) (BackgroundFill, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBackgroundFillSolid: + return UnmarshalBackgroundFillSolid(data) + + case TypeBackgroundFillGradient: + return UnmarshalBackgroundFillGradient(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfBackgroundFill(dataList []json.RawMessage) ([]BackgroundFill, error) { + list := []BackgroundFill{} + + for _, data := range dataList { + entity, err := UnmarshalBackgroundFill(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalBackgroundType(data json.RawMessage) (BackgroundType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBackgroundTypeWallpaper: + return UnmarshalBackgroundTypeWallpaper(data) + + case TypeBackgroundTypePattern: + return UnmarshalBackgroundTypePattern(data) + + case TypeBackgroundTypeFill: + return UnmarshalBackgroundTypeFill(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfBackgroundType(dataList []json.RawMessage) ([]BackgroundType, error) { + list := []BackgroundType{} + + for _, data := range dataList { + entity, err := UnmarshalBackgroundType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputBackground(data json.RawMessage) (InputBackground, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputBackgroundLocal: + return UnmarshalInputBackgroundLocal(data) + + case TypeInputBackgroundRemote: + return UnmarshalInputBackgroundRemote(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputBackground(dataList []json.RawMessage) ([]InputBackground, error) { + list := []InputBackground{} + + for _, data := range dataList { + entity, err := UnmarshalInputBackground(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalCanTransferOwnershipResult(data json.RawMessage) (CanTransferOwnershipResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCanTransferOwnershipResultOk: + return UnmarshalCanTransferOwnershipResultOk(data) + + case TypeCanTransferOwnershipResultPasswordNeeded: + return UnmarshalCanTransferOwnershipResultPasswordNeeded(data) + + case TypeCanTransferOwnershipResultPasswordTooFresh: + return UnmarshalCanTransferOwnershipResultPasswordTooFresh(data) + + case TypeCanTransferOwnershipResultSessionTooFresh: + return UnmarshalCanTransferOwnershipResultSessionTooFresh(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCanTransferOwnershipResult(dataList []json.RawMessage) ([]CanTransferOwnershipResult, error) { + list := []CanTransferOwnershipResult{} + + for _, data := range dataList { + entity, err := UnmarshalCanTransferOwnershipResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalCheckChatUsernameResult(data json.RawMessage) (CheckChatUsernameResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCheckChatUsernameResultOk: + return UnmarshalCheckChatUsernameResultOk(data) + + case TypeCheckChatUsernameResultUsernameInvalid: + return UnmarshalCheckChatUsernameResultUsernameInvalid(data) + + case TypeCheckChatUsernameResultUsernameOccupied: + return UnmarshalCheckChatUsernameResultUsernameOccupied(data) + + case TypeCheckChatUsernameResultPublicChatsTooMuch: + return UnmarshalCheckChatUsernameResultPublicChatsTooMuch(data) + + case TypeCheckChatUsernameResultPublicGroupsUnavailable: + return UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCheckChatUsernameResult(dataList []json.RawMessage) ([]CheckChatUsernameResult, error) { + list := []CheckChatUsernameResult{} + + for _, data := range dataList { + entity, err := UnmarshalCheckChatUsernameResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePushMessageContentHidden: + return UnmarshalPushMessageContentHidden(data) + + case TypePushMessageContentAnimation: + return UnmarshalPushMessageContentAnimation(data) + + case TypePushMessageContentAudio: + return UnmarshalPushMessageContentAudio(data) + + case TypePushMessageContentContact: + return UnmarshalPushMessageContentContact(data) + + case TypePushMessageContentContactRegistered: + return UnmarshalPushMessageContentContactRegistered(data) + + case TypePushMessageContentDocument: + return UnmarshalPushMessageContentDocument(data) + + case TypePushMessageContentGame: + return UnmarshalPushMessageContentGame(data) + + case TypePushMessageContentGameScore: + return UnmarshalPushMessageContentGameScore(data) + + case TypePushMessageContentInvoice: + return UnmarshalPushMessageContentInvoice(data) + + case TypePushMessageContentLocation: + return UnmarshalPushMessageContentLocation(data) + + case TypePushMessageContentPhoto: + return UnmarshalPushMessageContentPhoto(data) + + case TypePushMessageContentPoll: + return UnmarshalPushMessageContentPoll(data) + + case TypePushMessageContentScreenshotTaken: + return UnmarshalPushMessageContentScreenshotTaken(data) + + case TypePushMessageContentSticker: + return UnmarshalPushMessageContentSticker(data) + + case TypePushMessageContentText: + return UnmarshalPushMessageContentText(data) + + case TypePushMessageContentVideo: + return UnmarshalPushMessageContentVideo(data) + + case TypePushMessageContentVideoNote: + return UnmarshalPushMessageContentVideoNote(data) + + case TypePushMessageContentVoiceNote: + return UnmarshalPushMessageContentVoiceNote(data) + + case TypePushMessageContentBasicGroupChatCreate: + return UnmarshalPushMessageContentBasicGroupChatCreate(data) + + case TypePushMessageContentChatAddMembers: + return UnmarshalPushMessageContentChatAddMembers(data) + + case TypePushMessageContentChatChangePhoto: + return UnmarshalPushMessageContentChatChangePhoto(data) + + case TypePushMessageContentChatChangeTitle: + return UnmarshalPushMessageContentChatChangeTitle(data) + + case TypePushMessageContentChatDeleteMember: + return UnmarshalPushMessageContentChatDeleteMember(data) + + case TypePushMessageContentChatJoinByLink: + return UnmarshalPushMessageContentChatJoinByLink(data) + + case TypePushMessageContentMessageForwards: + return UnmarshalPushMessageContentMessageForwards(data) + + case TypePushMessageContentMediaAlbum: + return UnmarshalPushMessageContentMediaAlbum(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPushMessageContent(dataList []json.RawMessage) ([]PushMessageContent, error) { + list := []PushMessageContent{} + + for _, data := range dataList { + entity, err := UnmarshalPushMessageContent(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalNotificationType(data json.RawMessage) (NotificationType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeNotificationTypeNewMessage: + return UnmarshalNotificationTypeNewMessage(data) + + case TypeNotificationTypeNewSecretChat: + return UnmarshalNotificationTypeNewSecretChat(data) + + case TypeNotificationTypeNewCall: + return UnmarshalNotificationTypeNewCall(data) + + case TypeNotificationTypeNewPushMessage: + return UnmarshalNotificationTypeNewPushMessage(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfNotificationType(dataList []json.RawMessage) ([]NotificationType, error) { + list := []NotificationType{} + + for _, data := range dataList { + entity, err := UnmarshalNotificationType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalNotificationGroupType(data json.RawMessage) (NotificationGroupType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeNotificationGroupTypeMessages: + return UnmarshalNotificationGroupTypeMessages(data) + + case TypeNotificationGroupTypeMentions: + return UnmarshalNotificationGroupTypeMentions(data) + + case TypeNotificationGroupTypeSecretChat: + return UnmarshalNotificationGroupTypeSecretChat(data) + + case TypeNotificationGroupTypeCalls: + return UnmarshalNotificationGroupTypeCalls(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfNotificationGroupType(dataList []json.RawMessage) ([]NotificationGroupType, error) { + list := []NotificationGroupType{} + + for _, data := range dataList { + entity, err := UnmarshalNotificationGroupType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalOptionValue(data json.RawMessage) (OptionValue, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeOptionValueBoolean: + return UnmarshalOptionValueBoolean(data) + + case TypeOptionValueEmpty: + return UnmarshalOptionValueEmpty(data) + + case TypeOptionValueInteger: + return UnmarshalOptionValueInteger(data) + + case TypeOptionValueString: + return UnmarshalOptionValueString(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfOptionValue(dataList []json.RawMessage) ([]OptionValue, error) { + list := []OptionValue{} + + for _, data := range dataList { + entity, err := UnmarshalOptionValue(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalJsonValue(data json.RawMessage) (JsonValue, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeJsonValueNull: + return UnmarshalJsonValueNull(data) + + case TypeJsonValueBoolean: + return UnmarshalJsonValueBoolean(data) + + case TypeJsonValueNumber: + return UnmarshalJsonValueNumber(data) + + case TypeJsonValueString: + return UnmarshalJsonValueString(data) + + case TypeJsonValueArray: + return UnmarshalJsonValueArray(data) + + case TypeJsonValueObject: + return UnmarshalJsonValueObject(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfJsonValue(dataList []json.RawMessage) ([]JsonValue, error) { + list := []JsonValue{} + + for _, data := range dataList { + entity, err := UnmarshalJsonValue(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalUserPrivacySettingRule(data json.RawMessage) (UserPrivacySettingRule, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUserPrivacySettingRuleAllowAll: + return UnmarshalUserPrivacySettingRuleAllowAll(data) + + case TypeUserPrivacySettingRuleAllowContacts: + return UnmarshalUserPrivacySettingRuleAllowContacts(data) + + case TypeUserPrivacySettingRuleAllowUsers: + return UnmarshalUserPrivacySettingRuleAllowUsers(data) + + case TypeUserPrivacySettingRuleAllowChatMembers: + return UnmarshalUserPrivacySettingRuleAllowChatMembers(data) + + case TypeUserPrivacySettingRuleRestrictAll: + return UnmarshalUserPrivacySettingRuleRestrictAll(data) + + case TypeUserPrivacySettingRuleRestrictContacts: + return UnmarshalUserPrivacySettingRuleRestrictContacts(data) + + case TypeUserPrivacySettingRuleRestrictUsers: + return UnmarshalUserPrivacySettingRuleRestrictUsers(data) + + case TypeUserPrivacySettingRuleRestrictChatMembers: + return UnmarshalUserPrivacySettingRuleRestrictChatMembers(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUserPrivacySettingRule(dataList []json.RawMessage) ([]UserPrivacySettingRule, error) { + list := []UserPrivacySettingRule{} + + for _, data := range dataList { + entity, err := UnmarshalUserPrivacySettingRule(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUserPrivacySettingShowStatus: + return UnmarshalUserPrivacySettingShowStatus(data) + + case TypeUserPrivacySettingShowProfilePhoto: + return UnmarshalUserPrivacySettingShowProfilePhoto(data) + + case TypeUserPrivacySettingShowLinkInForwardedMessages: + return UnmarshalUserPrivacySettingShowLinkInForwardedMessages(data) + + case TypeUserPrivacySettingShowPhoneNumber: + return UnmarshalUserPrivacySettingShowPhoneNumber(data) + + case TypeUserPrivacySettingAllowChatInvites: + return UnmarshalUserPrivacySettingAllowChatInvites(data) + + case TypeUserPrivacySettingAllowCalls: + return UnmarshalUserPrivacySettingAllowCalls(data) + + case TypeUserPrivacySettingAllowPeerToPeerCalls: + return UnmarshalUserPrivacySettingAllowPeerToPeerCalls(data) + + case TypeUserPrivacySettingAllowFindingByPhoneNumber: + return UnmarshalUserPrivacySettingAllowFindingByPhoneNumber(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUserPrivacySetting(dataList []json.RawMessage) ([]UserPrivacySetting, error) { + list := []UserPrivacySetting{} + + for _, data := range dataList { + entity, err := UnmarshalUserPrivacySetting(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChatReportReason(data json.RawMessage) (ChatReportReason, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatReportReasonSpam: + return UnmarshalChatReportReasonSpam(data) + + case TypeChatReportReasonViolence: + return UnmarshalChatReportReasonViolence(data) + + case TypeChatReportReasonPornography: + return UnmarshalChatReportReasonPornography(data) + + case TypeChatReportReasonChildAbuse: + return UnmarshalChatReportReasonChildAbuse(data) + + case TypeChatReportReasonCopyright: + return UnmarshalChatReportReasonCopyright(data) + + case TypeChatReportReasonUnrelatedLocation: + return UnmarshalChatReportReasonUnrelatedLocation(data) + + case TypeChatReportReasonCustom: + return UnmarshalChatReportReasonCustom(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatReportReason(dataList []json.RawMessage) ([]ChatReportReason, error) { + list := []ChatReportReason{} + + for _, data := range dataList { + entity, err := UnmarshalChatReportReason(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalFileType(data json.RawMessage) (FileType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeFileTypeNone: + return UnmarshalFileTypeNone(data) + + case TypeFileTypeAnimation: + return UnmarshalFileTypeAnimation(data) + + case TypeFileTypeAudio: + return UnmarshalFileTypeAudio(data) + + case TypeFileTypeDocument: + return UnmarshalFileTypeDocument(data) + + case TypeFileTypePhoto: + return UnmarshalFileTypePhoto(data) + + case TypeFileTypeProfilePhoto: + return UnmarshalFileTypeProfilePhoto(data) + + case TypeFileTypeSecret: + return UnmarshalFileTypeSecret(data) + + case TypeFileTypeSecretThumbnail: + return UnmarshalFileTypeSecretThumbnail(data) + + case TypeFileTypeSecure: + return UnmarshalFileTypeSecure(data) + + case TypeFileTypeSticker: + return UnmarshalFileTypeSticker(data) + + case TypeFileTypeThumbnail: + return UnmarshalFileTypeThumbnail(data) + + case TypeFileTypeUnknown: + return UnmarshalFileTypeUnknown(data) + + case TypeFileTypeVideo: + return UnmarshalFileTypeVideo(data) + + case TypeFileTypeVideoNote: + return UnmarshalFileTypeVideoNote(data) + + case TypeFileTypeVoiceNote: + return UnmarshalFileTypeVoiceNote(data) + + case TypeFileTypeWallpaper: + return UnmarshalFileTypeWallpaper(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfFileType(dataList []json.RawMessage) ([]FileType, error) { + list := []FileType{} + + for _, data := range dataList { + entity, err := UnmarshalFileType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalNetworkType(data json.RawMessage) (NetworkType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeNetworkTypeNone: + return UnmarshalNetworkTypeNone(data) + + case TypeNetworkTypeMobile: + return UnmarshalNetworkTypeMobile(data) + + case TypeNetworkTypeMobileRoaming: + return UnmarshalNetworkTypeMobileRoaming(data) + + case TypeNetworkTypeWiFi: + return UnmarshalNetworkTypeWiFi(data) + + case TypeNetworkTypeOther: + return UnmarshalNetworkTypeOther(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfNetworkType(dataList []json.RawMessage) ([]NetworkType, error) { + list := []NetworkType{} + + for _, data := range dataList { + entity, err := UnmarshalNetworkType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalNetworkStatisticsEntry(data json.RawMessage) (NetworkStatisticsEntry, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeNetworkStatisticsEntryFile: + return UnmarshalNetworkStatisticsEntryFile(data) + + case TypeNetworkStatisticsEntryCall: + return UnmarshalNetworkStatisticsEntryCall(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfNetworkStatisticsEntry(dataList []json.RawMessage) ([]NetworkStatisticsEntry, error) { + list := []NetworkStatisticsEntry{} + + for _, data := range dataList { + entity, err := UnmarshalNetworkStatisticsEntry(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalConnectionState(data json.RawMessage) (ConnectionState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeConnectionStateWaitingForNetwork: + return UnmarshalConnectionStateWaitingForNetwork(data) + + case TypeConnectionStateConnectingToProxy: + return UnmarshalConnectionStateConnectingToProxy(data) + + case TypeConnectionStateConnecting: + return UnmarshalConnectionStateConnecting(data) + + case TypeConnectionStateUpdating: + return UnmarshalConnectionStateUpdating(data) + + case TypeConnectionStateReady: + return UnmarshalConnectionStateReady(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfConnectionState(dataList []json.RawMessage) ([]ConnectionState, error) { + list := []ConnectionState{} + + for _, data := range dataList { + entity, err := UnmarshalConnectionState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalTopChatCategory(data json.RawMessage) (TopChatCategory, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTopChatCategoryUsers: + return UnmarshalTopChatCategoryUsers(data) + + case TypeTopChatCategoryBots: + return UnmarshalTopChatCategoryBots(data) + + case TypeTopChatCategoryGroups: + return UnmarshalTopChatCategoryGroups(data) + + case TypeTopChatCategoryChannels: + return UnmarshalTopChatCategoryChannels(data) + + case TypeTopChatCategoryInlineBots: + return UnmarshalTopChatCategoryInlineBots(data) + + case TypeTopChatCategoryCalls: + return UnmarshalTopChatCategoryCalls(data) + + case TypeTopChatCategoryForwardChats: + return UnmarshalTopChatCategoryForwardChats(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTopChatCategory(dataList []json.RawMessage) ([]TopChatCategory, error) { + list := []TopChatCategory{} + + for _, data := range dataList { + entity, err := UnmarshalTopChatCategory(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalTMeUrlType(data json.RawMessage) (TMeUrlType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTMeUrlTypeUser: + return UnmarshalTMeUrlTypeUser(data) + + case TypeTMeUrlTypeSupergroup: + return UnmarshalTMeUrlTypeSupergroup(data) + + case TypeTMeUrlTypeChatInvite: + return UnmarshalTMeUrlTypeChatInvite(data) + + case TypeTMeUrlTypeStickerSet: + return UnmarshalTMeUrlTypeStickerSet(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTMeUrlType(dataList []json.RawMessage) ([]TMeUrlType, error) { + list := []TMeUrlType{} + + for _, data := range dataList { + entity, err := UnmarshalTMeUrlType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSuggestedAction(data json.RawMessage) (SuggestedAction, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedActionEnableArchiveAndMuteNewChats: + return UnmarshalSuggestedActionEnableArchiveAndMuteNewChats(data) + + case TypeSuggestedActionCheckPhoneNumber: + return UnmarshalSuggestedActionCheckPhoneNumber(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedAction(dataList []json.RawMessage) ([]SuggestedAction, error) { + list := []SuggestedAction{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedAction(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalTextParseMode(data json.RawMessage) (TextParseMode, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTextParseModeMarkdown: + return UnmarshalTextParseModeMarkdown(data) + + case TypeTextParseModeHTML: + return UnmarshalTextParseModeHTML(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTextParseMode(dataList []json.RawMessage) ([]TextParseMode, error) { + list := []TextParseMode{} + + for _, data := range dataList { + entity, err := UnmarshalTextParseMode(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalProxyType(data json.RawMessage) (ProxyType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeProxyTypeSocks5: + return UnmarshalProxyTypeSocks5(data) + + case TypeProxyTypeHttp: + return UnmarshalProxyTypeHttp(data) + + case TypeProxyTypeMtproto: + return UnmarshalProxyTypeMtproto(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfProxyType(dataList []json.RawMessage) ([]ProxyType, error) { + list := []ProxyType{} + + for _, data := range dataList { + entity, err := UnmarshalProxyType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputSticker(data json.RawMessage) (InputSticker, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputStickerStatic: + return UnmarshalInputStickerStatic(data) + + case TypeInputStickerAnimated: + return UnmarshalInputStickerAnimated(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputSticker(dataList []json.RawMessage) ([]InputSticker, error) { + list := []InputSticker{} + + for _, data := range dataList { + entity, err := UnmarshalInputSticker(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalStatisticalGraph(data json.RawMessage) (StatisticalGraph, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStatisticalGraphData: + return UnmarshalStatisticalGraphData(data) + + case TypeStatisticalGraphAsync: + return UnmarshalStatisticalGraphAsync(data) + + case TypeStatisticalGraphError: + return UnmarshalStatisticalGraphError(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStatisticalGraph(dataList []json.RawMessage) ([]StatisticalGraph, error) { + list := []StatisticalGraph{} + + for _, data := range dataList { + entity, err := UnmarshalStatisticalGraph(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChatStatistics(data json.RawMessage) (ChatStatistics, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatStatisticsSupergroup: + return UnmarshalChatStatisticsSupergroup(data) + + case TypeChatStatisticsChannel: + return UnmarshalChatStatisticsChannel(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatStatistics(dataList []json.RawMessage) ([]ChatStatistics, error) { + list := []ChatStatistics{} + + for _, data := range dataList { + entity, err := UnmarshalChatStatistics(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalUpdate(data json.RawMessage) (Update, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUpdateAuthorizationState: + return UnmarshalUpdateAuthorizationState(data) + + case TypeUpdateNewMessage: + return UnmarshalUpdateNewMessage(data) + + case TypeUpdateMessageSendAcknowledged: + return UnmarshalUpdateMessageSendAcknowledged(data) + + case TypeUpdateMessageSendSucceeded: + return UnmarshalUpdateMessageSendSucceeded(data) + + case TypeUpdateMessageSendFailed: + return UnmarshalUpdateMessageSendFailed(data) + + case TypeUpdateMessageContent: + return UnmarshalUpdateMessageContent(data) + + case TypeUpdateMessageEdited: + return UnmarshalUpdateMessageEdited(data) + + case TypeUpdateMessageIsPinned: + return UnmarshalUpdateMessageIsPinned(data) + + case TypeUpdateMessageInteractionInfo: + return UnmarshalUpdateMessageInteractionInfo(data) + + case TypeUpdateMessageContentOpened: + return UnmarshalUpdateMessageContentOpened(data) + + case TypeUpdateMessageMentionRead: + return UnmarshalUpdateMessageMentionRead(data) + + case TypeUpdateMessageLiveLocationViewed: + return UnmarshalUpdateMessageLiveLocationViewed(data) + + case TypeUpdateNewChat: + return UnmarshalUpdateNewChat(data) + + case TypeUpdateChatTitle: + return UnmarshalUpdateChatTitle(data) + + case TypeUpdateChatPhoto: + return UnmarshalUpdateChatPhoto(data) + + case TypeUpdateChatPermissions: + return UnmarshalUpdateChatPermissions(data) + + case TypeUpdateChatLastMessage: + return UnmarshalUpdateChatLastMessage(data) + + case TypeUpdateChatPosition: + return UnmarshalUpdateChatPosition(data) + + case TypeUpdateChatIsMarkedAsUnread: + return UnmarshalUpdateChatIsMarkedAsUnread(data) + + case TypeUpdateChatIsBlocked: + return UnmarshalUpdateChatIsBlocked(data) + + case TypeUpdateChatHasScheduledMessages: + return UnmarshalUpdateChatHasScheduledMessages(data) + + case TypeUpdateChatDefaultDisableNotification: + return UnmarshalUpdateChatDefaultDisableNotification(data) + + case TypeUpdateChatReadInbox: + return UnmarshalUpdateChatReadInbox(data) + + case TypeUpdateChatReadOutbox: + return UnmarshalUpdateChatReadOutbox(data) + + case TypeUpdateChatUnreadMentionCount: + return UnmarshalUpdateChatUnreadMentionCount(data) + + case TypeUpdateChatNotificationSettings: + return UnmarshalUpdateChatNotificationSettings(data) + + case TypeUpdateScopeNotificationSettings: + return UnmarshalUpdateScopeNotificationSettings(data) + + case TypeUpdateChatActionBar: + return UnmarshalUpdateChatActionBar(data) + + case TypeUpdateChatReplyMarkup: + return UnmarshalUpdateChatReplyMarkup(data) + + case TypeUpdateChatDraftMessage: + return UnmarshalUpdateChatDraftMessage(data) + + case TypeUpdateChatFilters: + return UnmarshalUpdateChatFilters(data) + + case TypeUpdateChatOnlineMemberCount: + return UnmarshalUpdateChatOnlineMemberCount(data) + + case TypeUpdateNotification: + return UnmarshalUpdateNotification(data) + + case TypeUpdateNotificationGroup: + return UnmarshalUpdateNotificationGroup(data) + + case TypeUpdateActiveNotifications: + return UnmarshalUpdateActiveNotifications(data) + + case TypeUpdateHavePendingNotifications: + return UnmarshalUpdateHavePendingNotifications(data) + + case TypeUpdateDeleteMessages: + return UnmarshalUpdateDeleteMessages(data) + + case TypeUpdateUserChatAction: + return UnmarshalUpdateUserChatAction(data) + + case TypeUpdateUserStatus: + return UnmarshalUpdateUserStatus(data) + + case TypeUpdateUser: + return UnmarshalUpdateUser(data) + + case TypeUpdateBasicGroup: + return UnmarshalUpdateBasicGroup(data) + + case TypeUpdateSupergroup: + return UnmarshalUpdateSupergroup(data) + + case TypeUpdateSecretChat: + return UnmarshalUpdateSecretChat(data) + + case TypeUpdateUserFullInfo: + return UnmarshalUpdateUserFullInfo(data) + + case TypeUpdateBasicGroupFullInfo: + return UnmarshalUpdateBasicGroupFullInfo(data) + + case TypeUpdateSupergroupFullInfo: + return UnmarshalUpdateSupergroupFullInfo(data) + + case TypeUpdateServiceNotification: + return UnmarshalUpdateServiceNotification(data) + + case TypeUpdateFile: + return UnmarshalUpdateFile(data) + + case TypeUpdateFileGenerationStart: + return UnmarshalUpdateFileGenerationStart(data) + + case TypeUpdateFileGenerationStop: + return UnmarshalUpdateFileGenerationStop(data) + + case TypeUpdateCall: + return UnmarshalUpdateCall(data) + + case TypeUpdateNewCallSignalingData: + return UnmarshalUpdateNewCallSignalingData(data) + + case TypeUpdateUserPrivacySettingRules: + return UnmarshalUpdateUserPrivacySettingRules(data) + + case TypeUpdateUnreadMessageCount: + return UnmarshalUpdateUnreadMessageCount(data) + + case TypeUpdateUnreadChatCount: + return UnmarshalUpdateUnreadChatCount(data) + + case TypeUpdateOption: + return UnmarshalUpdateOption(data) + + case TypeUpdateStickerSet: + return UnmarshalUpdateStickerSet(data) + + case TypeUpdateInstalledStickerSets: + return UnmarshalUpdateInstalledStickerSets(data) + + case TypeUpdateTrendingStickerSets: + return UnmarshalUpdateTrendingStickerSets(data) + + case TypeUpdateRecentStickers: + return UnmarshalUpdateRecentStickers(data) + + case TypeUpdateFavoriteStickers: + return UnmarshalUpdateFavoriteStickers(data) + + case TypeUpdateSavedAnimations: + return UnmarshalUpdateSavedAnimations(data) + + case TypeUpdateSelectedBackground: + return UnmarshalUpdateSelectedBackground(data) + + case TypeUpdateLanguagePackStrings: + return UnmarshalUpdateLanguagePackStrings(data) + + case TypeUpdateConnectionState: + return UnmarshalUpdateConnectionState(data) + + case TypeUpdateTermsOfService: + return UnmarshalUpdateTermsOfService(data) + + case TypeUpdateUsersNearby: + return UnmarshalUpdateUsersNearby(data) + + case TypeUpdateDiceEmojis: + return UnmarshalUpdateDiceEmojis(data) + + case TypeUpdateAnimationSearchParameters: + return UnmarshalUpdateAnimationSearchParameters(data) + + case TypeUpdateSuggestedActions: + return UnmarshalUpdateSuggestedActions(data) + + case TypeUpdateNewInlineQuery: + return UnmarshalUpdateNewInlineQuery(data) + + case TypeUpdateNewChosenInlineResult: + return UnmarshalUpdateNewChosenInlineResult(data) + + case TypeUpdateNewCallbackQuery: + return UnmarshalUpdateNewCallbackQuery(data) + + case TypeUpdateNewInlineCallbackQuery: + return UnmarshalUpdateNewInlineCallbackQuery(data) + + case TypeUpdateNewShippingQuery: + return UnmarshalUpdateNewShippingQuery(data) + + case TypeUpdateNewPreCheckoutQuery: + return UnmarshalUpdateNewPreCheckoutQuery(data) + + case TypeUpdateNewCustomEvent: + return UnmarshalUpdateNewCustomEvent(data) + + case TypeUpdateNewCustomQuery: + return UnmarshalUpdateNewCustomQuery(data) + + case TypeUpdatePoll: + return UnmarshalUpdatePoll(data) + + case TypeUpdatePollAnswer: + return UnmarshalUpdatePollAnswer(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUpdate(dataList []json.RawMessage) ([]Update, error) { + list := []Update{} + + for _, data := range dataList { + entity, err := UnmarshalUpdate(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalLogStream(data json.RawMessage) (LogStream, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeLogStreamDefault: + return UnmarshalLogStreamDefault(data) + + case TypeLogStreamFile: + return UnmarshalLogStreamFile(data) + + case TypeLogStreamEmpty: + return UnmarshalLogStreamEmpty(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfLogStream(dataList []json.RawMessage) ([]LogStream, error) { + list := []LogStream{} + + for _, data := range dataList { + entity, err := UnmarshalLogStream(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalError(data json.RawMessage) (*Error, error) { + var resp Error + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalOk(data json.RawMessage) (*Ok, error) { + var resp Ok + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTdlibParameters(data json.RawMessage) (*TdlibParameters, error) { + var resp TdlibParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthenticationCodeTypeTelegramMessage(data json.RawMessage) (*AuthenticationCodeTypeTelegramMessage, error) { + var resp AuthenticationCodeTypeTelegramMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthenticationCodeTypeSms(data json.RawMessage) (*AuthenticationCodeTypeSms, error) { + var resp AuthenticationCodeTypeSms + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthenticationCodeTypeCall(data json.RawMessage) (*AuthenticationCodeTypeCall, error) { + var resp AuthenticationCodeTypeCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthenticationCodeTypeFlashCall(data json.RawMessage) (*AuthenticationCodeTypeFlashCall, error) { + var resp AuthenticationCodeTypeFlashCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthenticationCodeInfo(data json.RawMessage) (*AuthenticationCodeInfo, error) { + var resp AuthenticationCodeInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmailAddressAuthenticationCodeInfo(data json.RawMessage) (*EmailAddressAuthenticationCodeInfo, error) { + var resp EmailAddressAuthenticationCodeInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntity(data json.RawMessage) (*TextEntity, error) { + var resp TextEntity + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntities(data json.RawMessage) (*TextEntities, error) { + var resp TextEntities + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFormattedText(data json.RawMessage) (*FormattedText, error) { + var resp FormattedText + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTermsOfService(data json.RawMessage) (*TermsOfService, error) { + var resp TermsOfService + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthorizationStateWaitTdlibParameters(data json.RawMessage) (*AuthorizationStateWaitTdlibParameters, error) { + var resp AuthorizationStateWaitTdlibParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthorizationStateWaitEncryptionKey(data json.RawMessage) (*AuthorizationStateWaitEncryptionKey, error) { + var resp AuthorizationStateWaitEncryptionKey + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthorizationStateWaitPhoneNumber(data json.RawMessage) (*AuthorizationStateWaitPhoneNumber, error) { + var resp AuthorizationStateWaitPhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthorizationStateWaitCode(data json.RawMessage) (*AuthorizationStateWaitCode, error) { + var resp AuthorizationStateWaitCode + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthorizationStateWaitOtherDeviceConfirmation(data json.RawMessage) (*AuthorizationStateWaitOtherDeviceConfirmation, error) { + var resp AuthorizationStateWaitOtherDeviceConfirmation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthorizationStateWaitRegistration(data json.RawMessage) (*AuthorizationStateWaitRegistration, error) { + var resp AuthorizationStateWaitRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthorizationStateWaitPassword(data json.RawMessage) (*AuthorizationStateWaitPassword, error) { + var resp AuthorizationStateWaitPassword + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthorizationStateReady(data json.RawMessage) (*AuthorizationStateReady, error) { + var resp AuthorizationStateReady + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthorizationStateLoggingOut(data json.RawMessage) (*AuthorizationStateLoggingOut, error) { + var resp AuthorizationStateLoggingOut + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthorizationStateClosing(data json.RawMessage) (*AuthorizationStateClosing, error) { + var resp AuthorizationStateClosing + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthorizationStateClosed(data json.RawMessage) (*AuthorizationStateClosed, error) { + var resp AuthorizationStateClosed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPasswordState(data json.RawMessage) (*PasswordState, error) { + var resp PasswordState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRecoveryEmailAddress(data json.RawMessage) (*RecoveryEmailAddress, error) { + var resp RecoveryEmailAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTemporaryPasswordState(data json.RawMessage) (*TemporaryPasswordState, error) { + var resp TemporaryPasswordState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLocalFile(data json.RawMessage) (*LocalFile, error) { + var resp LocalFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRemoteFile(data json.RawMessage) (*RemoteFile, error) { + var resp RemoteFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFile(data json.RawMessage) (*File, error) { + var resp File + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputFileId(data json.RawMessage) (*InputFileId, error) { + var resp InputFileId + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputFileRemote(data json.RawMessage) (*InputFileRemote, error) { + var resp InputFileRemote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputFileLocal(data json.RawMessage) (*InputFileLocal, error) { + var resp InputFileLocal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputFileGenerated(data json.RawMessage) (*InputFileGenerated, error) { + var resp InputFileGenerated + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPhotoSize(data json.RawMessage) (*PhotoSize, error) { + var resp PhotoSize + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMinithumbnail(data json.RawMessage) (*Minithumbnail, error) { + var resp Minithumbnail + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalThumbnailFormatJpeg(data json.RawMessage) (*ThumbnailFormatJpeg, error) { + var resp ThumbnailFormatJpeg + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalThumbnailFormatPng(data json.RawMessage) (*ThumbnailFormatPng, error) { + var resp ThumbnailFormatPng + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalThumbnailFormatWebp(data json.RawMessage) (*ThumbnailFormatWebp, error) { + var resp ThumbnailFormatWebp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalThumbnailFormatGif(data json.RawMessage) (*ThumbnailFormatGif, error) { + var resp ThumbnailFormatGif + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalThumbnailFormatTgs(data json.RawMessage) (*ThumbnailFormatTgs, error) { + var resp ThumbnailFormatTgs + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalThumbnailFormatMpeg4(data json.RawMessage) (*ThumbnailFormatMpeg4, error) { + var resp ThumbnailFormatMpeg4 + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalThumbnail(data json.RawMessage) (*Thumbnail, error) { + var resp Thumbnail + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMaskPointForehead(data json.RawMessage) (*MaskPointForehead, error) { + var resp MaskPointForehead + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMaskPointEyes(data json.RawMessage) (*MaskPointEyes, error) { + var resp MaskPointEyes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMaskPointMouth(data json.RawMessage) (*MaskPointMouth, error) { + var resp MaskPointMouth + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMaskPointChin(data json.RawMessage) (*MaskPointChin, error) { + var resp MaskPointChin + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMaskPosition(data json.RawMessage) (*MaskPosition, error) { + var resp MaskPosition + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPollOption(data json.RawMessage) (*PollOption, error) { + var resp PollOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPollTypeRegular(data json.RawMessage) (*PollTypeRegular, error) { + var resp PollTypeRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPollTypeQuiz(data json.RawMessage) (*PollTypeQuiz, error) { + var resp PollTypeQuiz + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAnimation(data json.RawMessage) (*Animation, error) { + var resp Animation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAudio(data json.RawMessage) (*Audio, error) { + var resp Audio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDocument(data json.RawMessage) (*Document, error) { + var resp Document + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPhoto(data json.RawMessage) (*Photo, error) { + var resp Photo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSticker(data json.RawMessage) (*Sticker, error) { + var resp Sticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVideo(data json.RawMessage) (*Video, error) { + var resp Video + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVideoNote(data json.RawMessage) (*VideoNote, error) { + var resp VideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVoiceNote(data json.RawMessage) (*VoiceNote, error) { + var resp VoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalContact(data json.RawMessage) (*Contact, error) { + var resp Contact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLocation(data json.RawMessage) (*Location, error) { + var resp Location + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVenue(data json.RawMessage) (*Venue, error) { + var resp Venue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGame(data json.RawMessage) (*Game, error) { + var resp Game + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPoll(data json.RawMessage) (*Poll, error) { + var resp Poll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfilePhoto(data json.RawMessage) (*ProfilePhoto, error) { + var resp ProfilePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatPhotoInfo(data json.RawMessage) (*ChatPhotoInfo, error) { + var resp ChatPhotoInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserTypeRegular(data json.RawMessage) (*UserTypeRegular, error) { + var resp UserTypeRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserTypeDeleted(data json.RawMessage) (*UserTypeDeleted, error) { + var resp UserTypeDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserTypeBot(data json.RawMessage) (*UserTypeBot, error) { + var resp UserTypeBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserTypeUnknown(data json.RawMessage) (*UserTypeUnknown, error) { + var resp UserTypeUnknown + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotCommand(data json.RawMessage) (*BotCommand, error) { + var resp BotCommand + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotInfo(data json.RawMessage) (*BotInfo, error) { + var resp BotInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatLocation(data json.RawMessage) (*ChatLocation, error) { + var resp ChatLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAnimatedChatPhoto(data json.RawMessage) (*AnimatedChatPhoto, error) { + var resp AnimatedChatPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatPhoto(data json.RawMessage) (*ChatPhoto, error) { + var resp ChatPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatPhotos(data json.RawMessage) (*ChatPhotos, error) { + var resp ChatPhotos + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChatPhotoPrevious(data json.RawMessage) (*InputChatPhotoPrevious, error) { + var resp InputChatPhotoPrevious + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChatPhotoStatic(data json.RawMessage) (*InputChatPhotoStatic, error) { + var resp InputChatPhotoStatic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChatPhotoAnimation(data json.RawMessage) (*InputChatPhotoAnimation, error) { + var resp InputChatPhotoAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUser(data json.RawMessage) (*User, error) { + var resp User + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserFullInfo(data json.RawMessage) (*UserFullInfo, error) { + var resp UserFullInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUsers(data json.RawMessage) (*Users, error) { + var resp Users + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatAdministrator(data json.RawMessage) (*ChatAdministrator, error) { + var resp ChatAdministrator + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatAdministrators(data json.RawMessage) (*ChatAdministrators, error) { + var resp ChatAdministrators + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatPermissions(data json.RawMessage) (*ChatPermissions, error) { + var resp ChatPermissions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMemberStatusCreator(data json.RawMessage) (*ChatMemberStatusCreator, error) { + var resp ChatMemberStatusCreator + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMemberStatusAdministrator(data json.RawMessage) (*ChatMemberStatusAdministrator, error) { + var resp ChatMemberStatusAdministrator + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMemberStatusMember(data json.RawMessage) (*ChatMemberStatusMember, error) { + var resp ChatMemberStatusMember + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMemberStatusRestricted(data json.RawMessage) (*ChatMemberStatusRestricted, error) { + var resp ChatMemberStatusRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMemberStatusLeft(data json.RawMessage) (*ChatMemberStatusLeft, error) { + var resp ChatMemberStatusLeft + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMemberStatusBanned(data json.RawMessage) (*ChatMemberStatusBanned, error) { + var resp ChatMemberStatusBanned + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMember(data json.RawMessage) (*ChatMember, error) { + var resp ChatMember + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMembers(data json.RawMessage) (*ChatMembers, error) { + var resp ChatMembers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMembersFilterContacts(data json.RawMessage) (*ChatMembersFilterContacts, error) { + var resp ChatMembersFilterContacts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMembersFilterAdministrators(data json.RawMessage) (*ChatMembersFilterAdministrators, error) { + var resp ChatMembersFilterAdministrators + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMembersFilterMembers(data json.RawMessage) (*ChatMembersFilterMembers, error) { + var resp ChatMembersFilterMembers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMembersFilterMention(data json.RawMessage) (*ChatMembersFilterMention, error) { + var resp ChatMembersFilterMention + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMembersFilterRestricted(data json.RawMessage) (*ChatMembersFilterRestricted, error) { + var resp ChatMembersFilterRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMembersFilterBanned(data json.RawMessage) (*ChatMembersFilterBanned, error) { + var resp ChatMembersFilterBanned + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMembersFilterBots(data json.RawMessage) (*ChatMembersFilterBots, error) { + var resp ChatMembersFilterBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSupergroupMembersFilterRecent(data json.RawMessage) (*SupergroupMembersFilterRecent, error) { + var resp SupergroupMembersFilterRecent + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSupergroupMembersFilterContacts(data json.RawMessage) (*SupergroupMembersFilterContacts, error) { + var resp SupergroupMembersFilterContacts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSupergroupMembersFilterAdministrators(data json.RawMessage) (*SupergroupMembersFilterAdministrators, error) { + var resp SupergroupMembersFilterAdministrators + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSupergroupMembersFilterSearch(data json.RawMessage) (*SupergroupMembersFilterSearch, error) { + var resp SupergroupMembersFilterSearch + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSupergroupMembersFilterRestricted(data json.RawMessage) (*SupergroupMembersFilterRestricted, error) { + var resp SupergroupMembersFilterRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSupergroupMembersFilterBanned(data json.RawMessage) (*SupergroupMembersFilterBanned, error) { + var resp SupergroupMembersFilterBanned + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSupergroupMembersFilterMention(data json.RawMessage) (*SupergroupMembersFilterMention, error) { + var resp SupergroupMembersFilterMention + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSupergroupMembersFilterBots(data json.RawMessage) (*SupergroupMembersFilterBots, error) { + var resp SupergroupMembersFilterBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBasicGroup(data json.RawMessage) (*BasicGroup, error) { + var resp BasicGroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBasicGroupFullInfo(data json.RawMessage) (*BasicGroupFullInfo, error) { + var resp BasicGroupFullInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSupergroup(data json.RawMessage) (*Supergroup, error) { + var resp Supergroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSupergroupFullInfo(data json.RawMessage) (*SupergroupFullInfo, error) { + var resp SupergroupFullInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSecretChatStatePending(data json.RawMessage) (*SecretChatStatePending, error) { + var resp SecretChatStatePending + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSecretChatStateReady(data json.RawMessage) (*SecretChatStateReady, error) { + var resp SecretChatStateReady + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSecretChatStateClosed(data json.RawMessage) (*SecretChatStateClosed, error) { + var resp SecretChatStateClosed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSecretChat(data json.RawMessage) (*SecretChat, error) { + var resp SecretChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSenderUser(data json.RawMessage) (*MessageSenderUser, error) { + var resp MessageSenderUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSenderChat(data json.RawMessage) (*MessageSenderChat, error) { + var resp MessageSenderChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSenders(data json.RawMessage) (*MessageSenders, error) { + var resp MessageSenders + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageForwardOriginUser(data json.RawMessage) (*MessageForwardOriginUser, error) { + var resp MessageForwardOriginUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageForwardOriginChat(data json.RawMessage) (*MessageForwardOriginChat, error) { + var resp MessageForwardOriginChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageForwardOriginHiddenUser(data json.RawMessage) (*MessageForwardOriginHiddenUser, error) { + var resp MessageForwardOriginHiddenUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageForwardOriginChannel(data json.RawMessage) (*MessageForwardOriginChannel, error) { + var resp MessageForwardOriginChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageForwardInfo(data json.RawMessage) (*MessageForwardInfo, error) { + var resp MessageForwardInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageReplyInfo(data json.RawMessage) (*MessageReplyInfo, error) { + var resp MessageReplyInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageInteractionInfo(data json.RawMessage) (*MessageInteractionInfo, error) { + var resp MessageInteractionInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSendingStatePending(data json.RawMessage) (*MessageSendingStatePending, error) { + var resp MessageSendingStatePending + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSendingStateFailed(data json.RawMessage) (*MessageSendingStateFailed, error) { + var resp MessageSendingStateFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessage(data json.RawMessage) (*Message, error) { + var resp Message + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessages(data json.RawMessage) (*Messages, error) { + var resp Messages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFoundMessages(data json.RawMessage) (*FoundMessages, error) { + var resp FoundMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationSettingsScopePrivateChats(data json.RawMessage) (*NotificationSettingsScopePrivateChats, error) { + var resp NotificationSettingsScopePrivateChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationSettingsScopeGroupChats(data json.RawMessage) (*NotificationSettingsScopeGroupChats, error) { + var resp NotificationSettingsScopeGroupChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationSettingsScopeChannelChats(data json.RawMessage) (*NotificationSettingsScopeChannelChats, error) { + var resp NotificationSettingsScopeChannelChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatNotificationSettings(data json.RawMessage) (*ChatNotificationSettings, error) { + var resp ChatNotificationSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalScopeNotificationSettings(data json.RawMessage) (*ScopeNotificationSettings, error) { + var resp ScopeNotificationSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDraftMessage(data json.RawMessage) (*DraftMessage, error) { + var resp DraftMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatTypePrivate(data json.RawMessage) (*ChatTypePrivate, error) { + var resp ChatTypePrivate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatTypeBasicGroup(data json.RawMessage) (*ChatTypeBasicGroup, error) { + var resp ChatTypeBasicGroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatTypeSupergroup(data json.RawMessage) (*ChatTypeSupergroup, error) { + var resp ChatTypeSupergroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatTypeSecret(data json.RawMessage) (*ChatTypeSecret, error) { + var resp ChatTypeSecret + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatFilter(data json.RawMessage) (*ChatFilter, error) { + var resp ChatFilter + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatFilterInfo(data json.RawMessage) (*ChatFilterInfo, error) { + var resp ChatFilterInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRecommendedChatFilter(data json.RawMessage) (*RecommendedChatFilter, error) { + var resp RecommendedChatFilter + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRecommendedChatFilters(data json.RawMessage) (*RecommendedChatFilters, error) { + var resp RecommendedChatFilters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatListMain(data json.RawMessage) (*ChatListMain, error) { + var resp ChatListMain + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatListArchive(data json.RawMessage) (*ChatListArchive, error) { + var resp ChatListArchive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatListFilter(data json.RawMessage) (*ChatListFilter, error) { + var resp ChatListFilter + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatLists(data json.RawMessage) (*ChatLists, error) { + var resp ChatLists + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatSourceMtprotoProxy(data json.RawMessage) (*ChatSourceMtprotoProxy, error) { + var resp ChatSourceMtprotoProxy + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatSourcePublicServiceAnnouncement(data json.RawMessage) (*ChatSourcePublicServiceAnnouncement, error) { + var resp ChatSourcePublicServiceAnnouncement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatPosition(data json.RawMessage) (*ChatPosition, error) { + var resp ChatPosition + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChat(data json.RawMessage) (*Chat, error) { + var resp Chat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChats(data json.RawMessage) (*Chats, error) { + var resp Chats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatNearby(data json.RawMessage) (*ChatNearby, error) { + var resp ChatNearby + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatsNearby(data json.RawMessage) (*ChatsNearby, error) { + var resp ChatsNearby + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatInviteLink(data json.RawMessage) (*ChatInviteLink, error) { + var resp ChatInviteLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatInviteLinkInfo(data json.RawMessage) (*ChatInviteLinkInfo, error) { + var resp ChatInviteLinkInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPublicChatTypeHasUsername(data json.RawMessage) (*PublicChatTypeHasUsername, error) { + var resp PublicChatTypeHasUsername + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPublicChatTypeIsLocationBased(data json.RawMessage) (*PublicChatTypeIsLocationBased, error) { + var resp PublicChatTypeIsLocationBased + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionBarReportSpam(data json.RawMessage) (*ChatActionBarReportSpam, error) { + var resp ChatActionBarReportSpam + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionBarReportUnrelatedLocation(data json.RawMessage) (*ChatActionBarReportUnrelatedLocation, error) { + var resp ChatActionBarReportUnrelatedLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionBarReportAddBlock(data json.RawMessage) (*ChatActionBarReportAddBlock, error) { + var resp ChatActionBarReportAddBlock + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionBarAddContact(data json.RawMessage) (*ChatActionBarAddContact, error) { + var resp ChatActionBarAddContact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionBarSharePhoneNumber(data json.RawMessage) (*ChatActionBarSharePhoneNumber, error) { + var resp ChatActionBarSharePhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalKeyboardButtonTypeText(data json.RawMessage) (*KeyboardButtonTypeText, error) { + var resp KeyboardButtonTypeText + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalKeyboardButtonTypeRequestPhoneNumber(data json.RawMessage) (*KeyboardButtonTypeRequestPhoneNumber, error) { + var resp KeyboardButtonTypeRequestPhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalKeyboardButtonTypeRequestLocation(data json.RawMessage) (*KeyboardButtonTypeRequestLocation, error) { + var resp KeyboardButtonTypeRequestLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalKeyboardButtonTypeRequestPoll(data json.RawMessage) (*KeyboardButtonTypeRequestPoll, error) { + var resp KeyboardButtonTypeRequestPoll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalKeyboardButton(data json.RawMessage) (*KeyboardButton, error) { + var resp KeyboardButton + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineKeyboardButtonTypeUrl(data json.RawMessage) (*InlineKeyboardButtonTypeUrl, error) { + var resp InlineKeyboardButtonTypeUrl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineKeyboardButtonTypeLoginUrl(data json.RawMessage) (*InlineKeyboardButtonTypeLoginUrl, error) { + var resp InlineKeyboardButtonTypeLoginUrl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineKeyboardButtonTypeCallback(data json.RawMessage) (*InlineKeyboardButtonTypeCallback, error) { + var resp InlineKeyboardButtonTypeCallback + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineKeyboardButtonTypeCallbackWithPassword(data json.RawMessage) (*InlineKeyboardButtonTypeCallbackWithPassword, error) { + var resp InlineKeyboardButtonTypeCallbackWithPassword + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineKeyboardButtonTypeCallbackGame(data json.RawMessage) (*InlineKeyboardButtonTypeCallbackGame, error) { + var resp InlineKeyboardButtonTypeCallbackGame + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineKeyboardButtonTypeSwitchInline(data json.RawMessage) (*InlineKeyboardButtonTypeSwitchInline, error) { + var resp InlineKeyboardButtonTypeSwitchInline + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineKeyboardButtonTypeBuy(data json.RawMessage) (*InlineKeyboardButtonTypeBuy, error) { + var resp InlineKeyboardButtonTypeBuy + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineKeyboardButton(data json.RawMessage) (*InlineKeyboardButton, error) { + var resp InlineKeyboardButton + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReplyMarkupRemoveKeyboard(data json.RawMessage) (*ReplyMarkupRemoveKeyboard, error) { + var resp ReplyMarkupRemoveKeyboard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReplyMarkupForceReply(data json.RawMessage) (*ReplyMarkupForceReply, error) { + var resp ReplyMarkupForceReply + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReplyMarkupShowKeyboard(data json.RawMessage) (*ReplyMarkupShowKeyboard, error) { + var resp ReplyMarkupShowKeyboard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReplyMarkupInlineKeyboard(data json.RawMessage) (*ReplyMarkupInlineKeyboard, error) { + var resp ReplyMarkupInlineKeyboard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLoginUrlInfoOpen(data json.RawMessage) (*LoginUrlInfoOpen, error) { + var resp LoginUrlInfoOpen + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLoginUrlInfoRequestConfirmation(data json.RawMessage) (*LoginUrlInfoRequestConfirmation, error) { + var resp LoginUrlInfoRequestConfirmation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageThreadInfo(data json.RawMessage) (*MessageThreadInfo, error) { + var resp MessageThreadInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextPlain(data json.RawMessage) (*RichTextPlain, error) { + var resp RichTextPlain + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextBold(data json.RawMessage) (*RichTextBold, error) { + var resp RichTextBold + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextItalic(data json.RawMessage) (*RichTextItalic, error) { + var resp RichTextItalic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextUnderline(data json.RawMessage) (*RichTextUnderline, error) { + var resp RichTextUnderline + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextStrikethrough(data json.RawMessage) (*RichTextStrikethrough, error) { + var resp RichTextStrikethrough + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextFixed(data json.RawMessage) (*RichTextFixed, error) { + var resp RichTextFixed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextUrl(data json.RawMessage) (*RichTextUrl, error) { + var resp RichTextUrl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextEmailAddress(data json.RawMessage) (*RichTextEmailAddress, error) { + var resp RichTextEmailAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextSubscript(data json.RawMessage) (*RichTextSubscript, error) { + var resp RichTextSubscript + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextSuperscript(data json.RawMessage) (*RichTextSuperscript, error) { + var resp RichTextSuperscript + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextMarked(data json.RawMessage) (*RichTextMarked, error) { + var resp RichTextMarked + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextPhoneNumber(data json.RawMessage) (*RichTextPhoneNumber, error) { + var resp RichTextPhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextIcon(data json.RawMessage) (*RichTextIcon, error) { + var resp RichTextIcon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextReference(data json.RawMessage) (*RichTextReference, error) { + var resp RichTextReference + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextAnchor(data json.RawMessage) (*RichTextAnchor, error) { + var resp RichTextAnchor + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextAnchorLink(data json.RawMessage) (*RichTextAnchorLink, error) { + var resp RichTextAnchorLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTexts(data json.RawMessage) (*RichTexts, error) { + var resp RichTexts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockCaption(data json.RawMessage) (*PageBlockCaption, error) { + var resp PageBlockCaption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockListItem(data json.RawMessage) (*PageBlockListItem, error) { + var resp PageBlockListItem + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockHorizontalAlignmentLeft(data json.RawMessage) (*PageBlockHorizontalAlignmentLeft, error) { + var resp PageBlockHorizontalAlignmentLeft + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockHorizontalAlignmentCenter(data json.RawMessage) (*PageBlockHorizontalAlignmentCenter, error) { + var resp PageBlockHorizontalAlignmentCenter + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockHorizontalAlignmentRight(data json.RawMessage) (*PageBlockHorizontalAlignmentRight, error) { + var resp PageBlockHorizontalAlignmentRight + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockVerticalAlignmentTop(data json.RawMessage) (*PageBlockVerticalAlignmentTop, error) { + var resp PageBlockVerticalAlignmentTop + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockVerticalAlignmentMiddle(data json.RawMessage) (*PageBlockVerticalAlignmentMiddle, error) { + var resp PageBlockVerticalAlignmentMiddle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockVerticalAlignmentBottom(data json.RawMessage) (*PageBlockVerticalAlignmentBottom, error) { + var resp PageBlockVerticalAlignmentBottom + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockTableCell(data json.RawMessage) (*PageBlockTableCell, error) { + var resp PageBlockTableCell + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockRelatedArticle(data json.RawMessage) (*PageBlockRelatedArticle, error) { + var resp PageBlockRelatedArticle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockTitle(data json.RawMessage) (*PageBlockTitle, error) { + var resp PageBlockTitle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockSubtitle(data json.RawMessage) (*PageBlockSubtitle, error) { + var resp PageBlockSubtitle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockAuthorDate(data json.RawMessage) (*PageBlockAuthorDate, error) { + var resp PageBlockAuthorDate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockHeader(data json.RawMessage) (*PageBlockHeader, error) { + var resp PageBlockHeader + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockSubheader(data json.RawMessage) (*PageBlockSubheader, error) { + var resp PageBlockSubheader + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockKicker(data json.RawMessage) (*PageBlockKicker, error) { + var resp PageBlockKicker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockParagraph(data json.RawMessage) (*PageBlockParagraph, error) { + var resp PageBlockParagraph + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockPreformatted(data json.RawMessage) (*PageBlockPreformatted, error) { + var resp PageBlockPreformatted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockFooter(data json.RawMessage) (*PageBlockFooter, error) { + var resp PageBlockFooter + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockDivider(data json.RawMessage) (*PageBlockDivider, error) { + var resp PageBlockDivider + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockAnchor(data json.RawMessage) (*PageBlockAnchor, error) { + var resp PageBlockAnchor + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockList(data json.RawMessage) (*PageBlockList, error) { + var resp PageBlockList + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockBlockQuote(data json.RawMessage) (*PageBlockBlockQuote, error) { + var resp PageBlockBlockQuote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockPullQuote(data json.RawMessage) (*PageBlockPullQuote, error) { + var resp PageBlockPullQuote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockAnimation(data json.RawMessage) (*PageBlockAnimation, error) { + var resp PageBlockAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockAudio(data json.RawMessage) (*PageBlockAudio, error) { + var resp PageBlockAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockPhoto(data json.RawMessage) (*PageBlockPhoto, error) { + var resp PageBlockPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockVideo(data json.RawMessage) (*PageBlockVideo, error) { + var resp PageBlockVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockVoiceNote(data json.RawMessage) (*PageBlockVoiceNote, error) { + var resp PageBlockVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockCover(data json.RawMessage) (*PageBlockCover, error) { + var resp PageBlockCover + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockEmbedded(data json.RawMessage) (*PageBlockEmbedded, error) { + var resp PageBlockEmbedded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockEmbeddedPost(data json.RawMessage) (*PageBlockEmbeddedPost, error) { + var resp PageBlockEmbeddedPost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockCollage(data json.RawMessage) (*PageBlockCollage, error) { + var resp PageBlockCollage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockSlideshow(data json.RawMessage) (*PageBlockSlideshow, error) { + var resp PageBlockSlideshow + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockChatLink(data json.RawMessage) (*PageBlockChatLink, error) { + var resp PageBlockChatLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockTable(data json.RawMessage) (*PageBlockTable, error) { + var resp PageBlockTable + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockDetails(data json.RawMessage) (*PageBlockDetails, error) { + var resp PageBlockDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockRelatedArticles(data json.RawMessage) (*PageBlockRelatedArticles, error) { + var resp PageBlockRelatedArticles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockMap(data json.RawMessage) (*PageBlockMap, error) { + var resp PageBlockMap + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalWebPageInstantView(data json.RawMessage) (*WebPageInstantView, error) { + var resp WebPageInstantView + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalWebPage(data json.RawMessage) (*WebPage, error) { + var resp WebPage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCountryInfo(data json.RawMessage) (*CountryInfo, error) { + var resp CountryInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCountries(data json.RawMessage) (*Countries, error) { + var resp Countries + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPhoneNumberInfo(data json.RawMessage) (*PhoneNumberInfo, error) { + var resp PhoneNumberInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBankCardActionOpenUrl(data json.RawMessage) (*BankCardActionOpenUrl, error) { + var resp BankCardActionOpenUrl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBankCardInfo(data json.RawMessage) (*BankCardInfo, error) { + var resp BankCardInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAddress(data json.RawMessage) (*Address, error) { + var resp Address + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLabeledPricePart(data json.RawMessage) (*LabeledPricePart, error) { + var resp LabeledPricePart + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInvoice(data json.RawMessage) (*Invoice, error) { + var resp Invoice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalOrderInfo(data json.RawMessage) (*OrderInfo, error) { + var resp OrderInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalShippingOption(data json.RawMessage) (*ShippingOption, error) { + var resp ShippingOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSavedCredentials(data json.RawMessage) (*SavedCredentials, error) { + var resp SavedCredentials + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputCredentialsSaved(data json.RawMessage) (*InputCredentialsSaved, error) { + var resp InputCredentialsSaved + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputCredentialsNew(data json.RawMessage) (*InputCredentialsNew, error) { + var resp InputCredentialsNew + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputCredentialsAndroidPay(data json.RawMessage) (*InputCredentialsAndroidPay, error) { + var resp InputCredentialsAndroidPay + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputCredentialsApplePay(data json.RawMessage) (*InputCredentialsApplePay, error) { + var resp InputCredentialsApplePay + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaymentsProviderStripe(data json.RawMessage) (*PaymentsProviderStripe, error) { + var resp PaymentsProviderStripe + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaymentForm(data json.RawMessage) (*PaymentForm, error) { + var resp PaymentForm + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalValidatedOrderInfo(data json.RawMessage) (*ValidatedOrderInfo, error) { + var resp ValidatedOrderInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaymentResult(data json.RawMessage) (*PaymentResult, error) { + var resp PaymentResult + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaymentReceipt(data json.RawMessage) (*PaymentReceipt, error) { + var resp PaymentReceipt + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDatedFile(data json.RawMessage) (*DatedFile, error) { + var resp DatedFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypePersonalDetails(data json.RawMessage) (*PassportElementTypePersonalDetails, error) { + var resp PassportElementTypePersonalDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypePassport(data json.RawMessage) (*PassportElementTypePassport, error) { + var resp PassportElementTypePassport + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeDriverLicense(data json.RawMessage) (*PassportElementTypeDriverLicense, error) { + var resp PassportElementTypeDriverLicense + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeIdentityCard(data json.RawMessage) (*PassportElementTypeIdentityCard, error) { + var resp PassportElementTypeIdentityCard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeInternalPassport(data json.RawMessage) (*PassportElementTypeInternalPassport, error) { + var resp PassportElementTypeInternalPassport + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeAddress(data json.RawMessage) (*PassportElementTypeAddress, error) { + var resp PassportElementTypeAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeUtilityBill(data json.RawMessage) (*PassportElementTypeUtilityBill, error) { + var resp PassportElementTypeUtilityBill + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeBankStatement(data json.RawMessage) (*PassportElementTypeBankStatement, error) { + var resp PassportElementTypeBankStatement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeRentalAgreement(data json.RawMessage) (*PassportElementTypeRentalAgreement, error) { + var resp PassportElementTypeRentalAgreement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypePassportRegistration(data json.RawMessage) (*PassportElementTypePassportRegistration, error) { + var resp PassportElementTypePassportRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeTemporaryRegistration(data json.RawMessage) (*PassportElementTypeTemporaryRegistration, error) { + var resp PassportElementTypeTemporaryRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypePhoneNumber(data json.RawMessage) (*PassportElementTypePhoneNumber, error) { + var resp PassportElementTypePhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeEmailAddress(data json.RawMessage) (*PassportElementTypeEmailAddress, error) { + var resp PassportElementTypeEmailAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDate(data json.RawMessage) (*Date, error) { + var resp Date + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPersonalDetails(data json.RawMessage) (*PersonalDetails, error) { + var resp PersonalDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalIdentityDocument(data json.RawMessage) (*IdentityDocument, error) { + var resp IdentityDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputIdentityDocument(data json.RawMessage) (*InputIdentityDocument, error) { + var resp InputIdentityDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPersonalDocument(data json.RawMessage) (*PersonalDocument, error) { + var resp PersonalDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPersonalDocument(data json.RawMessage) (*InputPersonalDocument, error) { + var resp InputPersonalDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementPersonalDetails(data json.RawMessage) (*PassportElementPersonalDetails, error) { + var resp PassportElementPersonalDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementPassport(data json.RawMessage) (*PassportElementPassport, error) { + var resp PassportElementPassport + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementDriverLicense(data json.RawMessage) (*PassportElementDriverLicense, error) { + var resp PassportElementDriverLicense + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementIdentityCard(data json.RawMessage) (*PassportElementIdentityCard, error) { + var resp PassportElementIdentityCard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementInternalPassport(data json.RawMessage) (*PassportElementInternalPassport, error) { + var resp PassportElementInternalPassport + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementAddress(data json.RawMessage) (*PassportElementAddress, error) { + var resp PassportElementAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementUtilityBill(data json.RawMessage) (*PassportElementUtilityBill, error) { + var resp PassportElementUtilityBill + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementBankStatement(data json.RawMessage) (*PassportElementBankStatement, error) { + var resp PassportElementBankStatement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementRentalAgreement(data json.RawMessage) (*PassportElementRentalAgreement, error) { + var resp PassportElementRentalAgreement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementPassportRegistration(data json.RawMessage) (*PassportElementPassportRegistration, error) { + var resp PassportElementPassportRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTemporaryRegistration(data json.RawMessage) (*PassportElementTemporaryRegistration, error) { + var resp PassportElementTemporaryRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementPhoneNumber(data json.RawMessage) (*PassportElementPhoneNumber, error) { + var resp PassportElementPhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementEmailAddress(data json.RawMessage) (*PassportElementEmailAddress, error) { + var resp PassportElementEmailAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementPersonalDetails(data json.RawMessage) (*InputPassportElementPersonalDetails, error) { + var resp InputPassportElementPersonalDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementPassport(data json.RawMessage) (*InputPassportElementPassport, error) { + var resp InputPassportElementPassport + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementDriverLicense(data json.RawMessage) (*InputPassportElementDriverLicense, error) { + var resp InputPassportElementDriverLicense + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementIdentityCard(data json.RawMessage) (*InputPassportElementIdentityCard, error) { + var resp InputPassportElementIdentityCard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementInternalPassport(data json.RawMessage) (*InputPassportElementInternalPassport, error) { + var resp InputPassportElementInternalPassport + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementAddress(data json.RawMessage) (*InputPassportElementAddress, error) { + var resp InputPassportElementAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementUtilityBill(data json.RawMessage) (*InputPassportElementUtilityBill, error) { + var resp InputPassportElementUtilityBill + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementBankStatement(data json.RawMessage) (*InputPassportElementBankStatement, error) { + var resp InputPassportElementBankStatement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementRentalAgreement(data json.RawMessage) (*InputPassportElementRentalAgreement, error) { + var resp InputPassportElementRentalAgreement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementPassportRegistration(data json.RawMessage) (*InputPassportElementPassportRegistration, error) { + var resp InputPassportElementPassportRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementTemporaryRegistration(data json.RawMessage) (*InputPassportElementTemporaryRegistration, error) { + var resp InputPassportElementTemporaryRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementPhoneNumber(data json.RawMessage) (*InputPassportElementPhoneNumber, error) { + var resp InputPassportElementPhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementEmailAddress(data json.RawMessage) (*InputPassportElementEmailAddress, error) { + var resp InputPassportElementEmailAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElements(data json.RawMessage) (*PassportElements, error) { + var resp PassportElements + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceUnspecified(data json.RawMessage) (*PassportElementErrorSourceUnspecified, error) { + var resp PassportElementErrorSourceUnspecified + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceDataField(data json.RawMessage) (*PassportElementErrorSourceDataField, error) { + var resp PassportElementErrorSourceDataField + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceFrontSide(data json.RawMessage) (*PassportElementErrorSourceFrontSide, error) { + var resp PassportElementErrorSourceFrontSide + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceReverseSide(data json.RawMessage) (*PassportElementErrorSourceReverseSide, error) { + var resp PassportElementErrorSourceReverseSide + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceSelfie(data json.RawMessage) (*PassportElementErrorSourceSelfie, error) { + var resp PassportElementErrorSourceSelfie + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceTranslationFile(data json.RawMessage) (*PassportElementErrorSourceTranslationFile, error) { + var resp PassportElementErrorSourceTranslationFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceTranslationFiles(data json.RawMessage) (*PassportElementErrorSourceTranslationFiles, error) { + var resp PassportElementErrorSourceTranslationFiles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceFile(data json.RawMessage) (*PassportElementErrorSourceFile, error) { + var resp PassportElementErrorSourceFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceFiles(data json.RawMessage) (*PassportElementErrorSourceFiles, error) { + var resp PassportElementErrorSourceFiles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementError(data json.RawMessage) (*PassportElementError, error) { + var resp PassportElementError + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportSuitableElement(data json.RawMessage) (*PassportSuitableElement, error) { + var resp PassportSuitableElement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportRequiredElement(data json.RawMessage) (*PassportRequiredElement, error) { + var resp PassportRequiredElement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportAuthorizationForm(data json.RawMessage) (*PassportAuthorizationForm, error) { + var resp PassportAuthorizationForm + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementsWithErrors(data json.RawMessage) (*PassportElementsWithErrors, error) { + var resp PassportElementsWithErrors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEncryptedCredentials(data json.RawMessage) (*EncryptedCredentials, error) { + var resp EncryptedCredentials + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEncryptedPassportElement(data json.RawMessage) (*EncryptedPassportElement, error) { + var resp EncryptedPassportElement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceUnspecified(data json.RawMessage) (*InputPassportElementErrorSourceUnspecified, error) { + var resp InputPassportElementErrorSourceUnspecified + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceDataField(data json.RawMessage) (*InputPassportElementErrorSourceDataField, error) { + var resp InputPassportElementErrorSourceDataField + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceFrontSide(data json.RawMessage) (*InputPassportElementErrorSourceFrontSide, error) { + var resp InputPassportElementErrorSourceFrontSide + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceReverseSide(data json.RawMessage) (*InputPassportElementErrorSourceReverseSide, error) { + var resp InputPassportElementErrorSourceReverseSide + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceSelfie(data json.RawMessage) (*InputPassportElementErrorSourceSelfie, error) { + var resp InputPassportElementErrorSourceSelfie + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceTranslationFile(data json.RawMessage) (*InputPassportElementErrorSourceTranslationFile, error) { + var resp InputPassportElementErrorSourceTranslationFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceTranslationFiles(data json.RawMessage) (*InputPassportElementErrorSourceTranslationFiles, error) { + var resp InputPassportElementErrorSourceTranslationFiles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceFile(data json.RawMessage) (*InputPassportElementErrorSourceFile, error) { + var resp InputPassportElementErrorSourceFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceFiles(data json.RawMessage) (*InputPassportElementErrorSourceFiles, error) { + var resp InputPassportElementErrorSourceFiles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementError(data json.RawMessage) (*InputPassportElementError, error) { + var resp InputPassportElementError + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageText(data json.RawMessage) (*MessageText, error) { + var resp MessageText + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageAnimation(data json.RawMessage) (*MessageAnimation, error) { + var resp MessageAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageAudio(data json.RawMessage) (*MessageAudio, error) { + var resp MessageAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageDocument(data json.RawMessage) (*MessageDocument, error) { + var resp MessageDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePhoto(data json.RawMessage) (*MessagePhoto, error) { + var resp MessagePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageExpiredPhoto(data json.RawMessage) (*MessageExpiredPhoto, error) { + var resp MessageExpiredPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSticker(data json.RawMessage) (*MessageSticker, error) { + var resp MessageSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageVideo(data json.RawMessage) (*MessageVideo, error) { + var resp MessageVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageExpiredVideo(data json.RawMessage) (*MessageExpiredVideo, error) { + var resp MessageExpiredVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageVideoNote(data json.RawMessage) (*MessageVideoNote, error) { + var resp MessageVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageVoiceNote(data json.RawMessage) (*MessageVoiceNote, error) { + var resp MessageVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageLocation(data json.RawMessage) (*MessageLocation, error) { + var resp MessageLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageVenue(data json.RawMessage) (*MessageVenue, error) { + var resp MessageVenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageContact(data json.RawMessage) (*MessageContact, error) { + var resp MessageContact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageDice(data json.RawMessage) (*MessageDice, error) { + var resp MessageDice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageGame(data json.RawMessage) (*MessageGame, error) { + var resp MessageGame + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePoll(data json.RawMessage) (*MessagePoll, error) { + var resp MessagePoll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageInvoice(data json.RawMessage) (*MessageInvoice, error) { + var resp MessageInvoice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageCall(data json.RawMessage) (*MessageCall, error) { + var resp MessageCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageBasicGroupChatCreate(data json.RawMessage) (*MessageBasicGroupChatCreate, error) { + var resp MessageBasicGroupChatCreate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSupergroupChatCreate(data json.RawMessage) (*MessageSupergroupChatCreate, error) { + var resp MessageSupergroupChatCreate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChatChangeTitle(data json.RawMessage) (*MessageChatChangeTitle, error) { + var resp MessageChatChangeTitle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChatChangePhoto(data json.RawMessage) (*MessageChatChangePhoto, error) { + var resp MessageChatChangePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChatDeletePhoto(data json.RawMessage) (*MessageChatDeletePhoto, error) { + var resp MessageChatDeletePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChatAddMembers(data json.RawMessage) (*MessageChatAddMembers, error) { + var resp MessageChatAddMembers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChatJoinByLink(data json.RawMessage) (*MessageChatJoinByLink, error) { + var resp MessageChatJoinByLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChatDeleteMember(data json.RawMessage) (*MessageChatDeleteMember, error) { + var resp MessageChatDeleteMember + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChatUpgradeTo(data json.RawMessage) (*MessageChatUpgradeTo, error) { + var resp MessageChatUpgradeTo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChatUpgradeFrom(data json.RawMessage) (*MessageChatUpgradeFrom, error) { + var resp MessageChatUpgradeFrom + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePinMessage(data json.RawMessage) (*MessagePinMessage, error) { + var resp MessagePinMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageScreenshotTaken(data json.RawMessage) (*MessageScreenshotTaken, error) { + var resp MessageScreenshotTaken + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChatSetTtl(data json.RawMessage) (*MessageChatSetTtl, error) { + var resp MessageChatSetTtl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageCustomServiceAction(data json.RawMessage) (*MessageCustomServiceAction, error) { + var resp MessageCustomServiceAction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageGameScore(data json.RawMessage) (*MessageGameScore, error) { + var resp MessageGameScore + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePaymentSuccessful(data json.RawMessage) (*MessagePaymentSuccessful, error) { + var resp MessagePaymentSuccessful + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePaymentSuccessfulBot(data json.RawMessage) (*MessagePaymentSuccessfulBot, error) { + var resp MessagePaymentSuccessfulBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { + var resp MessageContactRegistered + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageWebsiteConnected(data json.RawMessage) (*MessageWebsiteConnected, error) { + var resp MessageWebsiteConnected + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePassportDataSent(data json.RawMessage) (*MessagePassportDataSent, error) { + var resp MessagePassportDataSent + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePassportDataReceived(data json.RawMessage) (*MessagePassportDataReceived, error) { + var resp MessagePassportDataReceived + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageProximityAlertTriggered(data json.RawMessage) (*MessageProximityAlertTriggered, error) { + var resp MessageProximityAlertTriggered + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageUnsupported(data json.RawMessage) (*MessageUnsupported, error) { + var resp MessageUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeMention(data json.RawMessage) (*TextEntityTypeMention, error) { + var resp TextEntityTypeMention + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeHashtag(data json.RawMessage) (*TextEntityTypeHashtag, error) { + var resp TextEntityTypeHashtag + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeCashtag(data json.RawMessage) (*TextEntityTypeCashtag, error) { + var resp TextEntityTypeCashtag + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeBotCommand(data json.RawMessage) (*TextEntityTypeBotCommand, error) { + var resp TextEntityTypeBotCommand + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeUrl(data json.RawMessage) (*TextEntityTypeUrl, error) { + var resp TextEntityTypeUrl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeEmailAddress(data json.RawMessage) (*TextEntityTypeEmailAddress, error) { + var resp TextEntityTypeEmailAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypePhoneNumber(data json.RawMessage) (*TextEntityTypePhoneNumber, error) { + var resp TextEntityTypePhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeBankCardNumber(data json.RawMessage) (*TextEntityTypeBankCardNumber, error) { + var resp TextEntityTypeBankCardNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeBold(data json.RawMessage) (*TextEntityTypeBold, error) { + var resp TextEntityTypeBold + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeItalic(data json.RawMessage) (*TextEntityTypeItalic, error) { + var resp TextEntityTypeItalic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeUnderline(data json.RawMessage) (*TextEntityTypeUnderline, error) { + var resp TextEntityTypeUnderline + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeStrikethrough(data json.RawMessage) (*TextEntityTypeStrikethrough, error) { + var resp TextEntityTypeStrikethrough + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeCode(data json.RawMessage) (*TextEntityTypeCode, error) { + var resp TextEntityTypeCode + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypePre(data json.RawMessage) (*TextEntityTypePre, error) { + var resp TextEntityTypePre + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypePreCode(data json.RawMessage) (*TextEntityTypePreCode, error) { + var resp TextEntityTypePreCode + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeTextUrl(data json.RawMessage) (*TextEntityTypeTextUrl, error) { + var resp TextEntityTypeTextUrl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntityTypeMentionName(data json.RawMessage) (*TextEntityTypeMentionName, error) { + var resp TextEntityTypeMentionName + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputThumbnail(data json.RawMessage) (*InputThumbnail, error) { + var resp InputThumbnail + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSchedulingStateSendAtDate(data json.RawMessage) (*MessageSchedulingStateSendAtDate, error) { + var resp MessageSchedulingStateSendAtDate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSchedulingStateSendWhenOnline(data json.RawMessage) (*MessageSchedulingStateSendWhenOnline, error) { + var resp MessageSchedulingStateSendWhenOnline + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSendOptions(data json.RawMessage) (*MessageSendOptions, error) { + var resp MessageSendOptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageCopyOptions(data json.RawMessage) (*MessageCopyOptions, error) { + var resp MessageCopyOptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageText(data json.RawMessage) (*InputMessageText, error) { + var resp InputMessageText + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageAnimation(data json.RawMessage) (*InputMessageAnimation, error) { + var resp InputMessageAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageAudio(data json.RawMessage) (*InputMessageAudio, error) { + var resp InputMessageAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageDocument(data json.RawMessage) (*InputMessageDocument, error) { + var resp InputMessageDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessagePhoto(data json.RawMessage) (*InputMessagePhoto, error) { + var resp InputMessagePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageSticker(data json.RawMessage) (*InputMessageSticker, error) { + var resp InputMessageSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageVideo(data json.RawMessage) (*InputMessageVideo, error) { + var resp InputMessageVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageVideoNote(data json.RawMessage) (*InputMessageVideoNote, error) { + var resp InputMessageVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageVoiceNote(data json.RawMessage) (*InputMessageVoiceNote, error) { + var resp InputMessageVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageLocation(data json.RawMessage) (*InputMessageLocation, error) { + var resp InputMessageLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageVenue(data json.RawMessage) (*InputMessageVenue, error) { + var resp InputMessageVenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageContact(data json.RawMessage) (*InputMessageContact, error) { + var resp InputMessageContact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageDice(data json.RawMessage) (*InputMessageDice, error) { + var resp InputMessageDice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageGame(data json.RawMessage) (*InputMessageGame, error) { + var resp InputMessageGame + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageInvoice(data json.RawMessage) (*InputMessageInvoice, error) { + var resp InputMessageInvoice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessagePoll(data json.RawMessage) (*InputMessagePoll, error) { + var resp InputMessagePoll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputMessageForwarded(data json.RawMessage) (*InputMessageForwarded, error) { + var resp InputMessageForwarded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterEmpty(data json.RawMessage) (*SearchMessagesFilterEmpty, error) { + var resp SearchMessagesFilterEmpty + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterAnimation(data json.RawMessage) (*SearchMessagesFilterAnimation, error) { + var resp SearchMessagesFilterAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterAudio(data json.RawMessage) (*SearchMessagesFilterAudio, error) { + var resp SearchMessagesFilterAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterDocument(data json.RawMessage) (*SearchMessagesFilterDocument, error) { + var resp SearchMessagesFilterDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterPhoto(data json.RawMessage) (*SearchMessagesFilterPhoto, error) { + var resp SearchMessagesFilterPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterVideo(data json.RawMessage) (*SearchMessagesFilterVideo, error) { + var resp SearchMessagesFilterVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterVoiceNote(data json.RawMessage) (*SearchMessagesFilterVoiceNote, error) { + var resp SearchMessagesFilterVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterPhotoAndVideo(data json.RawMessage) (*SearchMessagesFilterPhotoAndVideo, error) { + var resp SearchMessagesFilterPhotoAndVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterUrl(data json.RawMessage) (*SearchMessagesFilterUrl, error) { + var resp SearchMessagesFilterUrl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterChatPhoto(data json.RawMessage) (*SearchMessagesFilterChatPhoto, error) { + var resp SearchMessagesFilterChatPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterCall(data json.RawMessage) (*SearchMessagesFilterCall, error) { + var resp SearchMessagesFilterCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterMissedCall(data json.RawMessage) (*SearchMessagesFilterMissedCall, error) { + var resp SearchMessagesFilterMissedCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterVideoNote(data json.RawMessage) (*SearchMessagesFilterVideoNote, error) { + var resp SearchMessagesFilterVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterVoiceAndVideoNote(data json.RawMessage) (*SearchMessagesFilterVoiceAndVideoNote, error) { + var resp SearchMessagesFilterVoiceAndVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterMention(data json.RawMessage) (*SearchMessagesFilterMention, error) { + var resp SearchMessagesFilterMention + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterUnreadMention(data json.RawMessage) (*SearchMessagesFilterUnreadMention, error) { + var resp SearchMessagesFilterUnreadMention + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterFailedToSend(data json.RawMessage) (*SearchMessagesFilterFailedToSend, error) { + var resp SearchMessagesFilterFailedToSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesFilterPinned(data json.RawMessage) (*SearchMessagesFilterPinned, error) { + var resp SearchMessagesFilterPinned + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionTyping(data json.RawMessage) (*ChatActionTyping, error) { + var resp ChatActionTyping + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionRecordingVideo(data json.RawMessage) (*ChatActionRecordingVideo, error) { + var resp ChatActionRecordingVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionUploadingVideo(data json.RawMessage) (*ChatActionUploadingVideo, error) { + var resp ChatActionUploadingVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionRecordingVoiceNote(data json.RawMessage) (*ChatActionRecordingVoiceNote, error) { + var resp ChatActionRecordingVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionUploadingVoiceNote(data json.RawMessage) (*ChatActionUploadingVoiceNote, error) { + var resp ChatActionUploadingVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionUploadingPhoto(data json.RawMessage) (*ChatActionUploadingPhoto, error) { + var resp ChatActionUploadingPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionUploadingDocument(data json.RawMessage) (*ChatActionUploadingDocument, error) { + var resp ChatActionUploadingDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionChoosingLocation(data json.RawMessage) (*ChatActionChoosingLocation, error) { + var resp ChatActionChoosingLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionChoosingContact(data json.RawMessage) (*ChatActionChoosingContact, error) { + var resp ChatActionChoosingContact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionStartPlayingGame(data json.RawMessage) (*ChatActionStartPlayingGame, error) { + var resp ChatActionStartPlayingGame + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionRecordingVideoNote(data json.RawMessage) (*ChatActionRecordingVideoNote, error) { + var resp ChatActionRecordingVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionUploadingVideoNote(data json.RawMessage) (*ChatActionUploadingVideoNote, error) { + var resp ChatActionUploadingVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatActionCancel(data json.RawMessage) (*ChatActionCancel, error) { + var resp ChatActionCancel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserStatusEmpty(data json.RawMessage) (*UserStatusEmpty, error) { + var resp UserStatusEmpty + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserStatusOnline(data json.RawMessage) (*UserStatusOnline, error) { + var resp UserStatusOnline + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserStatusOffline(data json.RawMessage) (*UserStatusOffline, error) { + var resp UserStatusOffline + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserStatusRecently(data json.RawMessage) (*UserStatusRecently, error) { + var resp UserStatusRecently + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserStatusLastWeek(data json.RawMessage) (*UserStatusLastWeek, error) { + var resp UserStatusLastWeek + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserStatusLastMonth(data json.RawMessage) (*UserStatusLastMonth, error) { + var resp UserStatusLastMonth + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStickers(data json.RawMessage) (*Stickers, error) { + var resp Stickers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojis(data json.RawMessage) (*Emojis, error) { + var resp Emojis + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStickerSet(data json.RawMessage) (*StickerSet, error) { + var resp StickerSet + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStickerSetInfo(data json.RawMessage) (*StickerSetInfo, error) { + var resp StickerSetInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStickerSets(data json.RawMessage) (*StickerSets, error) { + var resp StickerSets + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallDiscardReasonEmpty(data json.RawMessage) (*CallDiscardReasonEmpty, error) { + var resp CallDiscardReasonEmpty + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallDiscardReasonMissed(data json.RawMessage) (*CallDiscardReasonMissed, error) { + var resp CallDiscardReasonMissed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallDiscardReasonDeclined(data json.RawMessage) (*CallDiscardReasonDeclined, error) { + var resp CallDiscardReasonDeclined + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallDiscardReasonDisconnected(data json.RawMessage) (*CallDiscardReasonDisconnected, error) { + var resp CallDiscardReasonDisconnected + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallDiscardReasonHungUp(data json.RawMessage) (*CallDiscardReasonHungUp, error) { + var resp CallDiscardReasonHungUp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProtocol(data json.RawMessage) (*CallProtocol, error) { + var resp CallProtocol + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallServerTypeTelegramReflector(data json.RawMessage) (*CallServerTypeTelegramReflector, error) { + var resp CallServerTypeTelegramReflector + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallServerTypeWebrtc(data json.RawMessage) (*CallServerTypeWebrtc, error) { + var resp CallServerTypeWebrtc + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallServer(data json.RawMessage) (*CallServer, error) { + var resp CallServer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallId(data json.RawMessage) (*CallId, error) { + var resp CallId + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallStatePending(data json.RawMessage) (*CallStatePending, error) { + var resp CallStatePending + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallStateExchangingKeys(data json.RawMessage) (*CallStateExchangingKeys, error) { + var resp CallStateExchangingKeys + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallStateReady(data json.RawMessage) (*CallStateReady, error) { + var resp CallStateReady + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallStateHangingUp(data json.RawMessage) (*CallStateHangingUp, error) { + var resp CallStateHangingUp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallStateDiscarded(data json.RawMessage) (*CallStateDiscarded, error) { + var resp CallStateDiscarded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallStateError(data json.RawMessage) (*CallStateError, error) { + var resp CallStateError + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemEcho(data json.RawMessage) (*CallProblemEcho, error) { + var resp CallProblemEcho + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemNoise(data json.RawMessage) (*CallProblemNoise, error) { + var resp CallProblemNoise + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemInterruptions(data json.RawMessage) (*CallProblemInterruptions, error) { + var resp CallProblemInterruptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemDistortedSpeech(data json.RawMessage) (*CallProblemDistortedSpeech, error) { + var resp CallProblemDistortedSpeech + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemSilentLocal(data json.RawMessage) (*CallProblemSilentLocal, error) { + var resp CallProblemSilentLocal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemSilentRemote(data json.RawMessage) (*CallProblemSilentRemote, error) { + var resp CallProblemSilentRemote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemDropped(data json.RawMessage) (*CallProblemDropped, error) { + var resp CallProblemDropped + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemDistortedVideo(data json.RawMessage) (*CallProblemDistortedVideo, error) { + var resp CallProblemDistortedVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallProblemPixelatedVideo(data json.RawMessage) (*CallProblemPixelatedVideo, error) { + var resp CallProblemPixelatedVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCall(data json.RawMessage) (*Call, error) { + var resp Call + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPhoneNumberAuthenticationSettings(data json.RawMessage) (*PhoneNumberAuthenticationSettings, error) { + var resp PhoneNumberAuthenticationSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAnimations(data json.RawMessage) (*Animations, error) { + var resp Animations + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDiceStickersRegular(data json.RawMessage) (*DiceStickersRegular, error) { + var resp DiceStickersRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDiceStickersSlotMachine(data json.RawMessage) (*DiceStickersSlotMachine, error) { + var resp DiceStickersSlotMachine + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalImportedContacts(data json.RawMessage) (*ImportedContacts, error) { + var resp ImportedContacts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalHttpUrl(data json.RawMessage) (*HttpUrl, error) { + var resp HttpUrl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputInlineQueryResultAnimation(data json.RawMessage) (*InputInlineQueryResultAnimation, error) { + var resp InputInlineQueryResultAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputInlineQueryResultArticle(data json.RawMessage) (*InputInlineQueryResultArticle, error) { + var resp InputInlineQueryResultArticle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputInlineQueryResultAudio(data json.RawMessage) (*InputInlineQueryResultAudio, error) { + var resp InputInlineQueryResultAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputInlineQueryResultContact(data json.RawMessage) (*InputInlineQueryResultContact, error) { + var resp InputInlineQueryResultContact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputInlineQueryResultDocument(data json.RawMessage) (*InputInlineQueryResultDocument, error) { + var resp InputInlineQueryResultDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputInlineQueryResultGame(data json.RawMessage) (*InputInlineQueryResultGame, error) { + var resp InputInlineQueryResultGame + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputInlineQueryResultLocation(data json.RawMessage) (*InputInlineQueryResultLocation, error) { + var resp InputInlineQueryResultLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputInlineQueryResultPhoto(data json.RawMessage) (*InputInlineQueryResultPhoto, error) { + var resp InputInlineQueryResultPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputInlineQueryResultSticker(data json.RawMessage) (*InputInlineQueryResultSticker, error) { + var resp InputInlineQueryResultSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputInlineQueryResultVenue(data json.RawMessage) (*InputInlineQueryResultVenue, error) { + var resp InputInlineQueryResultVenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputInlineQueryResultVideo(data json.RawMessage) (*InputInlineQueryResultVideo, error) { + var resp InputInlineQueryResultVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputInlineQueryResultVoiceNote(data json.RawMessage) (*InputInlineQueryResultVoiceNote, error) { + var resp InputInlineQueryResultVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultArticle(data json.RawMessage) (*InlineQueryResultArticle, error) { + var resp InlineQueryResultArticle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultContact(data json.RawMessage) (*InlineQueryResultContact, error) { + var resp InlineQueryResultContact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultLocation(data json.RawMessage) (*InlineQueryResultLocation, error) { + var resp InlineQueryResultLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultVenue(data json.RawMessage) (*InlineQueryResultVenue, error) { + var resp InlineQueryResultVenue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultGame(data json.RawMessage) (*InlineQueryResultGame, error) { + var resp InlineQueryResultGame + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultAnimation(data json.RawMessage) (*InlineQueryResultAnimation, error) { + var resp InlineQueryResultAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultAudio(data json.RawMessage) (*InlineQueryResultAudio, error) { + var resp InlineQueryResultAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultDocument(data json.RawMessage) (*InlineQueryResultDocument, error) { + var resp InlineQueryResultDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultPhoto(data json.RawMessage) (*InlineQueryResultPhoto, error) { + var resp InlineQueryResultPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultSticker(data json.RawMessage) (*InlineQueryResultSticker, error) { + var resp InlineQueryResultSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultVideo(data json.RawMessage) (*InlineQueryResultVideo, error) { + var resp InlineQueryResultVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResultVoiceNote(data json.RawMessage) (*InlineQueryResultVoiceNote, error) { + var resp InlineQueryResultVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInlineQueryResults(data json.RawMessage) (*InlineQueryResults, error) { + var resp InlineQueryResults + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallbackQueryPayloadData(data json.RawMessage) (*CallbackQueryPayloadData, error) { + var resp CallbackQueryPayloadData + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallbackQueryPayloadDataWithPassword(data json.RawMessage) (*CallbackQueryPayloadDataWithPassword, error) { + var resp CallbackQueryPayloadDataWithPassword + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallbackQueryPayloadGame(data json.RawMessage) (*CallbackQueryPayloadGame, error) { + var resp CallbackQueryPayloadGame + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCallbackQueryAnswer(data json.RawMessage) (*CallbackQueryAnswer, error) { + var resp CallbackQueryAnswer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCustomRequestResult(data json.RawMessage) (*CustomRequestResult, error) { + var resp CustomRequestResult + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGameHighScore(data json.RawMessage) (*GameHighScore, error) { + var resp GameHighScore + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGameHighScores(data json.RawMessage) (*GameHighScores, error) { + var resp GameHighScores + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventMessageEdited(data json.RawMessage) (*ChatEventMessageEdited, error) { + var resp ChatEventMessageEdited + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventMessageDeleted(data json.RawMessage) (*ChatEventMessageDeleted, error) { + var resp ChatEventMessageDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventPollStopped(data json.RawMessage) (*ChatEventPollStopped, error) { + var resp ChatEventPollStopped + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventMessagePinned(data json.RawMessage) (*ChatEventMessagePinned, error) { + var resp ChatEventMessagePinned + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventMessageUnpinned(data json.RawMessage) (*ChatEventMessageUnpinned, error) { + var resp ChatEventMessageUnpinned + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventMemberJoined(data json.RawMessage) (*ChatEventMemberJoined, error) { + var resp ChatEventMemberJoined + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventMemberLeft(data json.RawMessage) (*ChatEventMemberLeft, error) { + var resp ChatEventMemberLeft + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventMemberInvited(data json.RawMessage) (*ChatEventMemberInvited, error) { + var resp ChatEventMemberInvited + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventMemberPromoted(data json.RawMessage) (*ChatEventMemberPromoted, error) { + var resp ChatEventMemberPromoted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventMemberRestricted(data json.RawMessage) (*ChatEventMemberRestricted, error) { + var resp ChatEventMemberRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventTitleChanged(data json.RawMessage) (*ChatEventTitleChanged, error) { + var resp ChatEventTitleChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventPermissionsChanged(data json.RawMessage) (*ChatEventPermissionsChanged, error) { + var resp ChatEventPermissionsChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventDescriptionChanged(data json.RawMessage) (*ChatEventDescriptionChanged, error) { + var resp ChatEventDescriptionChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventUsernameChanged(data json.RawMessage) (*ChatEventUsernameChanged, error) { + var resp ChatEventUsernameChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventPhotoChanged(data json.RawMessage) (*ChatEventPhotoChanged, error) { + var resp ChatEventPhotoChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventInvitesToggled(data json.RawMessage) (*ChatEventInvitesToggled, error) { + var resp ChatEventInvitesToggled + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventLinkedChatChanged(data json.RawMessage) (*ChatEventLinkedChatChanged, error) { + var resp ChatEventLinkedChatChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventSlowModeDelayChanged(data json.RawMessage) (*ChatEventSlowModeDelayChanged, error) { + var resp ChatEventSlowModeDelayChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventSignMessagesToggled(data json.RawMessage) (*ChatEventSignMessagesToggled, error) { + var resp ChatEventSignMessagesToggled + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventStickerSetChanged(data json.RawMessage) (*ChatEventStickerSetChanged, error) { + var resp ChatEventStickerSetChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventLocationChanged(data json.RawMessage) (*ChatEventLocationChanged, error) { + var resp ChatEventLocationChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventIsAllHistoryAvailableToggled(data json.RawMessage) (*ChatEventIsAllHistoryAvailableToggled, error) { + var resp ChatEventIsAllHistoryAvailableToggled + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEvent(data json.RawMessage) (*ChatEvent, error) { + var resp ChatEvent + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEvents(data json.RawMessage) (*ChatEvents, error) { + var resp ChatEvents + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventLogFilters(data json.RawMessage) (*ChatEventLogFilters, error) { + var resp ChatEventLogFilters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLanguagePackStringValueOrdinary(data json.RawMessage) (*LanguagePackStringValueOrdinary, error) { + var resp LanguagePackStringValueOrdinary + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLanguagePackStringValuePluralized(data json.RawMessage) (*LanguagePackStringValuePluralized, error) { + var resp LanguagePackStringValuePluralized + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLanguagePackStringValueDeleted(data json.RawMessage) (*LanguagePackStringValueDeleted, error) { + var resp LanguagePackStringValueDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLanguagePackString(data json.RawMessage) (*LanguagePackString, error) { + var resp LanguagePackString + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLanguagePackStrings(data json.RawMessage) (*LanguagePackStrings, error) { + var resp LanguagePackStrings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLanguagePackInfo(data json.RawMessage) (*LanguagePackInfo, error) { + var resp LanguagePackInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLocalizationTargetInfo(data json.RawMessage) (*LocalizationTargetInfo, error) { + var resp LocalizationTargetInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeviceTokenFirebaseCloudMessaging(data json.RawMessage) (*DeviceTokenFirebaseCloudMessaging, error) { + var resp DeviceTokenFirebaseCloudMessaging + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeviceTokenApplePush(data json.RawMessage) (*DeviceTokenApplePush, error) { + var resp DeviceTokenApplePush + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeviceTokenApplePushVoIP(data json.RawMessage) (*DeviceTokenApplePushVoIP, error) { + var resp DeviceTokenApplePushVoIP + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeviceTokenWindowsPush(data json.RawMessage) (*DeviceTokenWindowsPush, error) { + var resp DeviceTokenWindowsPush + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeviceTokenMicrosoftPush(data json.RawMessage) (*DeviceTokenMicrosoftPush, error) { + var resp DeviceTokenMicrosoftPush + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeviceTokenMicrosoftPushVoIP(data json.RawMessage) (*DeviceTokenMicrosoftPushVoIP, error) { + var resp DeviceTokenMicrosoftPushVoIP + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeviceTokenWebPush(data json.RawMessage) (*DeviceTokenWebPush, error) { + var resp DeviceTokenWebPush + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeviceTokenSimplePush(data json.RawMessage) (*DeviceTokenSimplePush, error) { + var resp DeviceTokenSimplePush + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeviceTokenUbuntuPush(data json.RawMessage) (*DeviceTokenUbuntuPush, error) { + var resp DeviceTokenUbuntuPush + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeviceTokenBlackBerryPush(data json.RawMessage) (*DeviceTokenBlackBerryPush, error) { + var resp DeviceTokenBlackBerryPush + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeviceTokenTizenPush(data json.RawMessage) (*DeviceTokenTizenPush, error) { + var resp DeviceTokenTizenPush + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushReceiverId(data json.RawMessage) (*PushReceiverId, error) { + var resp PushReceiverId + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBackgroundFillSolid(data json.RawMessage) (*BackgroundFillSolid, error) { + var resp BackgroundFillSolid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBackgroundFillGradient(data json.RawMessage) (*BackgroundFillGradient, error) { + var resp BackgroundFillGradient + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBackgroundTypeWallpaper(data json.RawMessage) (*BackgroundTypeWallpaper, error) { + var resp BackgroundTypeWallpaper + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBackgroundTypePattern(data json.RawMessage) (*BackgroundTypePattern, error) { + var resp BackgroundTypePattern + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBackgroundTypeFill(data json.RawMessage) (*BackgroundTypeFill, error) { + var resp BackgroundTypeFill + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBackground(data json.RawMessage) (*Background, error) { + var resp Background + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBackgrounds(data json.RawMessage) (*Backgrounds, error) { + var resp Backgrounds + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputBackgroundLocal(data json.RawMessage) (*InputBackgroundLocal, error) { + var resp InputBackgroundLocal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputBackgroundRemote(data json.RawMessage) (*InputBackgroundRemote, error) { + var resp InputBackgroundRemote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalHashtags(data json.RawMessage) (*Hashtags, error) { + var resp Hashtags + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanTransferOwnershipResultOk(data json.RawMessage) (*CanTransferOwnershipResultOk, error) { + var resp CanTransferOwnershipResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanTransferOwnershipResultPasswordNeeded(data json.RawMessage) (*CanTransferOwnershipResultPasswordNeeded, error) { + var resp CanTransferOwnershipResultPasswordNeeded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanTransferOwnershipResultPasswordTooFresh(data json.RawMessage) (*CanTransferOwnershipResultPasswordTooFresh, error) { + var resp CanTransferOwnershipResultPasswordTooFresh + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanTransferOwnershipResultSessionTooFresh(data json.RawMessage) (*CanTransferOwnershipResultSessionTooFresh, error) { + var resp CanTransferOwnershipResultSessionTooFresh + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCheckChatUsernameResultOk(data json.RawMessage) (*CheckChatUsernameResultOk, error) { + var resp CheckChatUsernameResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCheckChatUsernameResultUsernameInvalid(data json.RawMessage) (*CheckChatUsernameResultUsernameInvalid, error) { + var resp CheckChatUsernameResultUsernameInvalid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCheckChatUsernameResultUsernameOccupied(data json.RawMessage) (*CheckChatUsernameResultUsernameOccupied, error) { + var resp CheckChatUsernameResultUsernameOccupied + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCheckChatUsernameResultPublicChatsTooMuch(data json.RawMessage) (*CheckChatUsernameResultPublicChatsTooMuch, error) { + var resp CheckChatUsernameResultPublicChatsTooMuch + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(data json.RawMessage) (*CheckChatUsernameResultPublicGroupsUnavailable, error) { + var resp CheckChatUsernameResultPublicGroupsUnavailable + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentHidden(data json.RawMessage) (*PushMessageContentHidden, error) { + var resp PushMessageContentHidden + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentAnimation(data json.RawMessage) (*PushMessageContentAnimation, error) { + var resp PushMessageContentAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentAudio(data json.RawMessage) (*PushMessageContentAudio, error) { + var resp PushMessageContentAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentContact(data json.RawMessage) (*PushMessageContentContact, error) { + var resp PushMessageContentContact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentContactRegistered(data json.RawMessage) (*PushMessageContentContactRegistered, error) { + var resp PushMessageContentContactRegistered + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentDocument(data json.RawMessage) (*PushMessageContentDocument, error) { + var resp PushMessageContentDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentGame(data json.RawMessage) (*PushMessageContentGame, error) { + var resp PushMessageContentGame + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentGameScore(data json.RawMessage) (*PushMessageContentGameScore, error) { + var resp PushMessageContentGameScore + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentInvoice(data json.RawMessage) (*PushMessageContentInvoice, error) { + var resp PushMessageContentInvoice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentLocation(data json.RawMessage) (*PushMessageContentLocation, error) { + var resp PushMessageContentLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentPhoto(data json.RawMessage) (*PushMessageContentPhoto, error) { + var resp PushMessageContentPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentPoll(data json.RawMessage) (*PushMessageContentPoll, error) { + var resp PushMessageContentPoll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentScreenshotTaken(data json.RawMessage) (*PushMessageContentScreenshotTaken, error) { + var resp PushMessageContentScreenshotTaken + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentSticker(data json.RawMessage) (*PushMessageContentSticker, error) { + var resp PushMessageContentSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentText(data json.RawMessage) (*PushMessageContentText, error) { + var resp PushMessageContentText + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentVideo(data json.RawMessage) (*PushMessageContentVideo, error) { + var resp PushMessageContentVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentVideoNote(data json.RawMessage) (*PushMessageContentVideoNote, error) { + var resp PushMessageContentVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentVoiceNote(data json.RawMessage) (*PushMessageContentVoiceNote, error) { + var resp PushMessageContentVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentBasicGroupChatCreate(data json.RawMessage) (*PushMessageContentBasicGroupChatCreate, error) { + var resp PushMessageContentBasicGroupChatCreate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChatAddMembers(data json.RawMessage) (*PushMessageContentChatAddMembers, error) { + var resp PushMessageContentChatAddMembers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChatChangePhoto(data json.RawMessage) (*PushMessageContentChatChangePhoto, error) { + var resp PushMessageContentChatChangePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChatChangeTitle(data json.RawMessage) (*PushMessageContentChatChangeTitle, error) { + var resp PushMessageContentChatChangeTitle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChatDeleteMember(data json.RawMessage) (*PushMessageContentChatDeleteMember, error) { + var resp PushMessageContentChatDeleteMember + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChatJoinByLink(data json.RawMessage) (*PushMessageContentChatJoinByLink, error) { + var resp PushMessageContentChatJoinByLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentMessageForwards(data json.RawMessage) (*PushMessageContentMessageForwards, error) { + var resp PushMessageContentMessageForwards + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentMediaAlbum(data json.RawMessage) (*PushMessageContentMediaAlbum, error) { + var resp PushMessageContentMediaAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationTypeNewMessage(data json.RawMessage) (*NotificationTypeNewMessage, error) { + var resp NotificationTypeNewMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationTypeNewSecretChat(data json.RawMessage) (*NotificationTypeNewSecretChat, error) { + var resp NotificationTypeNewSecretChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationTypeNewCall(data json.RawMessage) (*NotificationTypeNewCall, error) { + var resp NotificationTypeNewCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationTypeNewPushMessage(data json.RawMessage) (*NotificationTypeNewPushMessage, error) { + var resp NotificationTypeNewPushMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationGroupTypeMessages(data json.RawMessage) (*NotificationGroupTypeMessages, error) { + var resp NotificationGroupTypeMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationGroupTypeMentions(data json.RawMessage) (*NotificationGroupTypeMentions, error) { + var resp NotificationGroupTypeMentions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationGroupTypeSecretChat(data json.RawMessage) (*NotificationGroupTypeSecretChat, error) { + var resp NotificationGroupTypeSecretChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationGroupTypeCalls(data json.RawMessage) (*NotificationGroupTypeCalls, error) { + var resp NotificationGroupTypeCalls + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotification(data json.RawMessage) (*Notification, error) { + var resp Notification + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationGroup(data json.RawMessage) (*NotificationGroup, error) { + var resp NotificationGroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalOptionValueBoolean(data json.RawMessage) (*OptionValueBoolean, error) { + var resp OptionValueBoolean + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalOptionValueEmpty(data json.RawMessage) (*OptionValueEmpty, error) { + var resp OptionValueEmpty + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalOptionValueInteger(data json.RawMessage) (*OptionValueInteger, error) { + var resp OptionValueInteger + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalOptionValueString(data json.RawMessage) (*OptionValueString, error) { + var resp OptionValueString + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonObjectMember(data json.RawMessage) (*JsonObjectMember, error) { + var resp JsonObjectMember + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonValueNull(data json.RawMessage) (*JsonValueNull, error) { + var resp JsonValueNull + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonValueBoolean(data json.RawMessage) (*JsonValueBoolean, error) { + var resp JsonValueBoolean + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonValueNumber(data json.RawMessage) (*JsonValueNumber, error) { + var resp JsonValueNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonValueString(data json.RawMessage) (*JsonValueString, error) { + var resp JsonValueString + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonValueArray(data json.RawMessage) (*JsonValueArray, error) { + var resp JsonValueArray + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonValueObject(data json.RawMessage) (*JsonValueObject, error) { + var resp JsonValueObject + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingRuleAllowAll(data json.RawMessage) (*UserPrivacySettingRuleAllowAll, error) { + var resp UserPrivacySettingRuleAllowAll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingRuleAllowContacts(data json.RawMessage) (*UserPrivacySettingRuleAllowContacts, error) { + var resp UserPrivacySettingRuleAllowContacts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingRuleAllowUsers(data json.RawMessage) (*UserPrivacySettingRuleAllowUsers, error) { + var resp UserPrivacySettingRuleAllowUsers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingRuleAllowChatMembers(data json.RawMessage) (*UserPrivacySettingRuleAllowChatMembers, error) { + var resp UserPrivacySettingRuleAllowChatMembers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingRuleRestrictAll(data json.RawMessage) (*UserPrivacySettingRuleRestrictAll, error) { + var resp UserPrivacySettingRuleRestrictAll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingRuleRestrictContacts(data json.RawMessage) (*UserPrivacySettingRuleRestrictContacts, error) { + var resp UserPrivacySettingRuleRestrictContacts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingRuleRestrictUsers(data json.RawMessage) (*UserPrivacySettingRuleRestrictUsers, error) { + var resp UserPrivacySettingRuleRestrictUsers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingRuleRestrictChatMembers(data json.RawMessage) (*UserPrivacySettingRuleRestrictChatMembers, error) { + var resp UserPrivacySettingRuleRestrictChatMembers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingRules(data json.RawMessage) (*UserPrivacySettingRules, error) { + var resp UserPrivacySettingRules + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingShowStatus(data json.RawMessage) (*UserPrivacySettingShowStatus, error) { + var resp UserPrivacySettingShowStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingShowProfilePhoto(data json.RawMessage) (*UserPrivacySettingShowProfilePhoto, error) { + var resp UserPrivacySettingShowProfilePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingShowLinkInForwardedMessages(data json.RawMessage) (*UserPrivacySettingShowLinkInForwardedMessages, error) { + var resp UserPrivacySettingShowLinkInForwardedMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingShowPhoneNumber(data json.RawMessage) (*UserPrivacySettingShowPhoneNumber, error) { + var resp UserPrivacySettingShowPhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingAllowChatInvites(data json.RawMessage) (*UserPrivacySettingAllowChatInvites, error) { + var resp UserPrivacySettingAllowChatInvites + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingAllowCalls(data json.RawMessage) (*UserPrivacySettingAllowCalls, error) { + var resp UserPrivacySettingAllowCalls + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingAllowPeerToPeerCalls(data json.RawMessage) (*UserPrivacySettingAllowPeerToPeerCalls, error) { + var resp UserPrivacySettingAllowPeerToPeerCalls + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingAllowFindingByPhoneNumber(data json.RawMessage) (*UserPrivacySettingAllowFindingByPhoneNumber, error) { + var resp UserPrivacySettingAllowFindingByPhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAccountTtl(data json.RawMessage) (*AccountTtl, error) { + var resp AccountTtl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSession(data json.RawMessage) (*Session, error) { + var resp Session + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSessions(data json.RawMessage) (*Sessions, error) { + var resp Sessions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalConnectedWebsite(data json.RawMessage) (*ConnectedWebsite, error) { + var resp ConnectedWebsite + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalConnectedWebsites(data json.RawMessage) (*ConnectedWebsites, error) { + var resp ConnectedWebsites + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatReportReasonSpam(data json.RawMessage) (*ChatReportReasonSpam, error) { + var resp ChatReportReasonSpam + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatReportReasonViolence(data json.RawMessage) (*ChatReportReasonViolence, error) { + var resp ChatReportReasonViolence + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatReportReasonPornography(data json.RawMessage) (*ChatReportReasonPornography, error) { + var resp ChatReportReasonPornography + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatReportReasonChildAbuse(data json.RawMessage) (*ChatReportReasonChildAbuse, error) { + var resp ChatReportReasonChildAbuse + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatReportReasonCopyright(data json.RawMessage) (*ChatReportReasonCopyright, error) { + var resp ChatReportReasonCopyright + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatReportReasonUnrelatedLocation(data json.RawMessage) (*ChatReportReasonUnrelatedLocation, error) { + var resp ChatReportReasonUnrelatedLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatReportReasonCustom(data json.RawMessage) (*ChatReportReasonCustom, error) { + var resp ChatReportReasonCustom + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageLink(data json.RawMessage) (*MessageLink, error) { + var resp MessageLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageLinkInfo(data json.RawMessage) (*MessageLinkInfo, error) { + var resp MessageLinkInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFilePart(data json.RawMessage) (*FilePart, error) { + var resp FilePart + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeNone(data json.RawMessage) (*FileTypeNone, error) { + var resp FileTypeNone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeAnimation(data json.RawMessage) (*FileTypeAnimation, error) { + var resp FileTypeAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeAudio(data json.RawMessage) (*FileTypeAudio, error) { + var resp FileTypeAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeDocument(data json.RawMessage) (*FileTypeDocument, error) { + var resp FileTypeDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypePhoto(data json.RawMessage) (*FileTypePhoto, error) { + var resp FileTypePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeProfilePhoto(data json.RawMessage) (*FileTypeProfilePhoto, error) { + var resp FileTypeProfilePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSecret(data json.RawMessage) (*FileTypeSecret, error) { + var resp FileTypeSecret + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSecretThumbnail(data json.RawMessage) (*FileTypeSecretThumbnail, error) { + var resp FileTypeSecretThumbnail + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSecure(data json.RawMessage) (*FileTypeSecure, error) { + var resp FileTypeSecure + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSticker(data json.RawMessage) (*FileTypeSticker, error) { + var resp FileTypeSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeThumbnail(data json.RawMessage) (*FileTypeThumbnail, error) { + var resp FileTypeThumbnail + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeUnknown(data json.RawMessage) (*FileTypeUnknown, error) { + var resp FileTypeUnknown + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeVideo(data json.RawMessage) (*FileTypeVideo, error) { + var resp FileTypeVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeVideoNote(data json.RawMessage) (*FileTypeVideoNote, error) { + var resp FileTypeVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeVoiceNote(data json.RawMessage) (*FileTypeVoiceNote, error) { + var resp FileTypeVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeWallpaper(data json.RawMessage) (*FileTypeWallpaper, error) { + var resp FileTypeWallpaper + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStorageStatisticsByFileType(data json.RawMessage) (*StorageStatisticsByFileType, error) { + var resp StorageStatisticsByFileType + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStorageStatisticsByChat(data json.RawMessage) (*StorageStatisticsByChat, error) { + var resp StorageStatisticsByChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStorageStatistics(data json.RawMessage) (*StorageStatistics, error) { + var resp StorageStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStorageStatisticsFast(data json.RawMessage) (*StorageStatisticsFast, error) { + var resp StorageStatisticsFast + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDatabaseStatistics(data json.RawMessage) (*DatabaseStatistics, error) { + var resp DatabaseStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNetworkTypeNone(data json.RawMessage) (*NetworkTypeNone, error) { + var resp NetworkTypeNone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNetworkTypeMobile(data json.RawMessage) (*NetworkTypeMobile, error) { + var resp NetworkTypeMobile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNetworkTypeMobileRoaming(data json.RawMessage) (*NetworkTypeMobileRoaming, error) { + var resp NetworkTypeMobileRoaming + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNetworkTypeWiFi(data json.RawMessage) (*NetworkTypeWiFi, error) { + var resp NetworkTypeWiFi + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNetworkTypeOther(data json.RawMessage) (*NetworkTypeOther, error) { + var resp NetworkTypeOther + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNetworkStatisticsEntryFile(data json.RawMessage) (*NetworkStatisticsEntryFile, error) { + var resp NetworkStatisticsEntryFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNetworkStatisticsEntryCall(data json.RawMessage) (*NetworkStatisticsEntryCall, error) { + var resp NetworkStatisticsEntryCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNetworkStatistics(data json.RawMessage) (*NetworkStatistics, error) { + var resp NetworkStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAutoDownloadSettings(data json.RawMessage) (*AutoDownloadSettings, error) { + var resp AutoDownloadSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAutoDownloadSettingsPresets(data json.RawMessage) (*AutoDownloadSettingsPresets, error) { + var resp AutoDownloadSettingsPresets + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalConnectionStateWaitingForNetwork(data json.RawMessage) (*ConnectionStateWaitingForNetwork, error) { + var resp ConnectionStateWaitingForNetwork + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalConnectionStateConnectingToProxy(data json.RawMessage) (*ConnectionStateConnectingToProxy, error) { + var resp ConnectionStateConnectingToProxy + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalConnectionStateConnecting(data json.RawMessage) (*ConnectionStateConnecting, error) { + var resp ConnectionStateConnecting + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalConnectionStateUpdating(data json.RawMessage) (*ConnectionStateUpdating, error) { + var resp ConnectionStateUpdating + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalConnectionStateReady(data json.RawMessage) (*ConnectionStateReady, error) { + var resp ConnectionStateReady + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTopChatCategoryUsers(data json.RawMessage) (*TopChatCategoryUsers, error) { + var resp TopChatCategoryUsers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTopChatCategoryBots(data json.RawMessage) (*TopChatCategoryBots, error) { + var resp TopChatCategoryBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTopChatCategoryGroups(data json.RawMessage) (*TopChatCategoryGroups, error) { + var resp TopChatCategoryGroups + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTopChatCategoryChannels(data json.RawMessage) (*TopChatCategoryChannels, error) { + var resp TopChatCategoryChannels + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTopChatCategoryInlineBots(data json.RawMessage) (*TopChatCategoryInlineBots, error) { + var resp TopChatCategoryInlineBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTopChatCategoryCalls(data json.RawMessage) (*TopChatCategoryCalls, error) { + var resp TopChatCategoryCalls + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTopChatCategoryForwardChats(data json.RawMessage) (*TopChatCategoryForwardChats, error) { + var resp TopChatCategoryForwardChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTMeUrlTypeUser(data json.RawMessage) (*TMeUrlTypeUser, error) { + var resp TMeUrlTypeUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTMeUrlTypeSupergroup(data json.RawMessage) (*TMeUrlTypeSupergroup, error) { + var resp TMeUrlTypeSupergroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTMeUrlTypeChatInvite(data json.RawMessage) (*TMeUrlTypeChatInvite, error) { + var resp TMeUrlTypeChatInvite + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTMeUrlTypeStickerSet(data json.RawMessage) (*TMeUrlTypeStickerSet, error) { + var resp TMeUrlTypeStickerSet + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTMeUrl(data json.RawMessage) (*TMeUrl, error) { + var resp TMeUrl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTMeUrls(data json.RawMessage) (*TMeUrls, error) { + var resp TMeUrls + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedActionEnableArchiveAndMuteNewChats(data json.RawMessage) (*SuggestedActionEnableArchiveAndMuteNewChats, error) { + var resp SuggestedActionEnableArchiveAndMuteNewChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedActionCheckPhoneNumber(data json.RawMessage) (*SuggestedActionCheckPhoneNumber, error) { + var resp SuggestedActionCheckPhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCount(data json.RawMessage) (*Count, error) { + var resp Count + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalText(data json.RawMessage) (*Text, error) { + var resp Text + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSeconds(data json.RawMessage) (*Seconds, error) { + var resp Seconds + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeepLinkInfo(data json.RawMessage) (*DeepLinkInfo, error) { + var resp DeepLinkInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextParseModeMarkdown(data json.RawMessage) (*TextParseModeMarkdown, error) { + var resp TextParseModeMarkdown + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextParseModeHTML(data json.RawMessage) (*TextParseModeHTML, error) { + var resp TextParseModeHTML + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProxyTypeSocks5(data json.RawMessage) (*ProxyTypeSocks5, error) { + var resp ProxyTypeSocks5 + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProxyTypeHttp(data json.RawMessage) (*ProxyTypeHttp, error) { + var resp ProxyTypeHttp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProxyTypeMtproto(data json.RawMessage) (*ProxyTypeMtproto, error) { + var resp ProxyTypeMtproto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProxy(data json.RawMessage) (*Proxy, error) { + var resp Proxy + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProxies(data json.RawMessage) (*Proxies, error) { + var resp Proxies + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStickerStatic(data json.RawMessage) (*InputStickerStatic, error) { + var resp InputStickerStatic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStickerAnimated(data json.RawMessage) (*InputStickerAnimated, error) { + var resp InputStickerAnimated + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDateRange(data json.RawMessage) (*DateRange, error) { + var resp DateRange + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStatisticalValue(data json.RawMessage) (*StatisticalValue, error) { + var resp StatisticalValue + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStatisticalGraphData(data json.RawMessage) (*StatisticalGraphData, error) { + var resp StatisticalGraphData + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStatisticalGraphAsync(data json.RawMessage) (*StatisticalGraphAsync, error) { + var resp StatisticalGraphAsync + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStatisticalGraphError(data json.RawMessage) (*StatisticalGraphError, error) { + var resp StatisticalGraphError + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatStatisticsMessageInteractionInfo(data json.RawMessage) (*ChatStatisticsMessageInteractionInfo, error) { + var resp ChatStatisticsMessageInteractionInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatStatisticsMessageSenderInfo(data json.RawMessage) (*ChatStatisticsMessageSenderInfo, error) { + var resp ChatStatisticsMessageSenderInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatStatisticsAdministratorActionsInfo(data json.RawMessage) (*ChatStatisticsAdministratorActionsInfo, error) { + var resp ChatStatisticsAdministratorActionsInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatStatisticsInviterInfo(data json.RawMessage) (*ChatStatisticsInviterInfo, error) { + var resp ChatStatisticsInviterInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatStatisticsSupergroup(data json.RawMessage) (*ChatStatisticsSupergroup, error) { + var resp ChatStatisticsSupergroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatStatisticsChannel(data json.RawMessage) (*ChatStatisticsChannel, error) { + var resp ChatStatisticsChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageStatistics(data json.RawMessage) (*MessageStatistics, error) { + var resp MessageStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateAuthorizationState(data json.RawMessage) (*UpdateAuthorizationState, error) { + var resp UpdateAuthorizationState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewMessage(data json.RawMessage) (*UpdateNewMessage, error) { + var resp UpdateNewMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageSendAcknowledged(data json.RawMessage) (*UpdateMessageSendAcknowledged, error) { + var resp UpdateMessageSendAcknowledged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageSendSucceeded(data json.RawMessage) (*UpdateMessageSendSucceeded, error) { + var resp UpdateMessageSendSucceeded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageSendFailed(data json.RawMessage) (*UpdateMessageSendFailed, error) { + var resp UpdateMessageSendFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageContent(data json.RawMessage) (*UpdateMessageContent, error) { + var resp UpdateMessageContent + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageEdited(data json.RawMessage) (*UpdateMessageEdited, error) { + var resp UpdateMessageEdited + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageIsPinned(data json.RawMessage) (*UpdateMessageIsPinned, error) { + var resp UpdateMessageIsPinned + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageInteractionInfo(data json.RawMessage) (*UpdateMessageInteractionInfo, error) { + var resp UpdateMessageInteractionInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageContentOpened(data json.RawMessage) (*UpdateMessageContentOpened, error) { + var resp UpdateMessageContentOpened + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageMentionRead(data json.RawMessage) (*UpdateMessageMentionRead, error) { + var resp UpdateMessageMentionRead + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageLiveLocationViewed(data json.RawMessage) (*UpdateMessageLiveLocationViewed, error) { + var resp UpdateMessageLiveLocationViewed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewChat(data json.RawMessage) (*UpdateNewChat, error) { + var resp UpdateNewChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatTitle(data json.RawMessage) (*UpdateChatTitle, error) { + var resp UpdateChatTitle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatPhoto(data json.RawMessage) (*UpdateChatPhoto, error) { + var resp UpdateChatPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatPermissions(data json.RawMessage) (*UpdateChatPermissions, error) { + var resp UpdateChatPermissions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatLastMessage(data json.RawMessage) (*UpdateChatLastMessage, error) { + var resp UpdateChatLastMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatPosition(data json.RawMessage) (*UpdateChatPosition, error) { + var resp UpdateChatPosition + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatIsMarkedAsUnread(data json.RawMessage) (*UpdateChatIsMarkedAsUnread, error) { + var resp UpdateChatIsMarkedAsUnread + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatIsBlocked(data json.RawMessage) (*UpdateChatIsBlocked, error) { + var resp UpdateChatIsBlocked + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatHasScheduledMessages(data json.RawMessage) (*UpdateChatHasScheduledMessages, error) { + var resp UpdateChatHasScheduledMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatDefaultDisableNotification(data json.RawMessage) (*UpdateChatDefaultDisableNotification, error) { + var resp UpdateChatDefaultDisableNotification + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatReadInbox(data json.RawMessage) (*UpdateChatReadInbox, error) { + var resp UpdateChatReadInbox + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatReadOutbox(data json.RawMessage) (*UpdateChatReadOutbox, error) { + var resp UpdateChatReadOutbox + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatUnreadMentionCount(data json.RawMessage) (*UpdateChatUnreadMentionCount, error) { + var resp UpdateChatUnreadMentionCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatNotificationSettings(data json.RawMessage) (*UpdateChatNotificationSettings, error) { + var resp UpdateChatNotificationSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateScopeNotificationSettings(data json.RawMessage) (*UpdateScopeNotificationSettings, error) { + var resp UpdateScopeNotificationSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatActionBar(data json.RawMessage) (*UpdateChatActionBar, error) { + var resp UpdateChatActionBar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatReplyMarkup(data json.RawMessage) (*UpdateChatReplyMarkup, error) { + var resp UpdateChatReplyMarkup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatDraftMessage(data json.RawMessage) (*UpdateChatDraftMessage, error) { + var resp UpdateChatDraftMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatFilters(data json.RawMessage) (*UpdateChatFilters, error) { + var resp UpdateChatFilters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatOnlineMemberCount(data json.RawMessage) (*UpdateChatOnlineMemberCount, error) { + var resp UpdateChatOnlineMemberCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNotification(data json.RawMessage) (*UpdateNotification, error) { + var resp UpdateNotification + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNotificationGroup(data json.RawMessage) (*UpdateNotificationGroup, error) { + var resp UpdateNotificationGroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateActiveNotifications(data json.RawMessage) (*UpdateActiveNotifications, error) { + var resp UpdateActiveNotifications + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateHavePendingNotifications(data json.RawMessage) (*UpdateHavePendingNotifications, error) { + var resp UpdateHavePendingNotifications + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateDeleteMessages(data json.RawMessage) (*UpdateDeleteMessages, error) { + var resp UpdateDeleteMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateUserChatAction(data json.RawMessage) (*UpdateUserChatAction, error) { + var resp UpdateUserChatAction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateUserStatus(data json.RawMessage) (*UpdateUserStatus, error) { + var resp UpdateUserStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateUser(data json.RawMessage) (*UpdateUser, error) { + var resp UpdateUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateBasicGroup(data json.RawMessage) (*UpdateBasicGroup, error) { + var resp UpdateBasicGroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateSupergroup(data json.RawMessage) (*UpdateSupergroup, error) { + var resp UpdateSupergroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateSecretChat(data json.RawMessage) (*UpdateSecretChat, error) { + var resp UpdateSecretChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateUserFullInfo(data json.RawMessage) (*UpdateUserFullInfo, error) { + var resp UpdateUserFullInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateBasicGroupFullInfo(data json.RawMessage) (*UpdateBasicGroupFullInfo, error) { + var resp UpdateBasicGroupFullInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateSupergroupFullInfo(data json.RawMessage) (*UpdateSupergroupFullInfo, error) { + var resp UpdateSupergroupFullInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateServiceNotification(data json.RawMessage) (*UpdateServiceNotification, error) { + var resp UpdateServiceNotification + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateFile(data json.RawMessage) (*UpdateFile, error) { + var resp UpdateFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateFileGenerationStart(data json.RawMessage) (*UpdateFileGenerationStart, error) { + var resp UpdateFileGenerationStart + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateFileGenerationStop(data json.RawMessage) (*UpdateFileGenerationStop, error) { + var resp UpdateFileGenerationStop + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateCall(data json.RawMessage) (*UpdateCall, error) { + var resp UpdateCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewCallSignalingData(data json.RawMessage) (*UpdateNewCallSignalingData, error) { + var resp UpdateNewCallSignalingData + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateUserPrivacySettingRules(data json.RawMessage) (*UpdateUserPrivacySettingRules, error) { + var resp UpdateUserPrivacySettingRules + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateUnreadMessageCount(data json.RawMessage) (*UpdateUnreadMessageCount, error) { + var resp UpdateUnreadMessageCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateUnreadChatCount(data json.RawMessage) (*UpdateUnreadChatCount, error) { + var resp UpdateUnreadChatCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateOption(data json.RawMessage) (*UpdateOption, error) { + var resp UpdateOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateStickerSet(data json.RawMessage) (*UpdateStickerSet, error) { + var resp UpdateStickerSet + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateInstalledStickerSets(data json.RawMessage) (*UpdateInstalledStickerSets, error) { + var resp UpdateInstalledStickerSets + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateTrendingStickerSets(data json.RawMessage) (*UpdateTrendingStickerSets, error) { + var resp UpdateTrendingStickerSets + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateRecentStickers(data json.RawMessage) (*UpdateRecentStickers, error) { + var resp UpdateRecentStickers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateFavoriteStickers(data json.RawMessage) (*UpdateFavoriteStickers, error) { + var resp UpdateFavoriteStickers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateSavedAnimations(data json.RawMessage) (*UpdateSavedAnimations, error) { + var resp UpdateSavedAnimations + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateSelectedBackground(data json.RawMessage) (*UpdateSelectedBackground, error) { + var resp UpdateSelectedBackground + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateLanguagePackStrings(data json.RawMessage) (*UpdateLanguagePackStrings, error) { + var resp UpdateLanguagePackStrings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateConnectionState(data json.RawMessage) (*UpdateConnectionState, error) { + var resp UpdateConnectionState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateTermsOfService(data json.RawMessage) (*UpdateTermsOfService, error) { + var resp UpdateTermsOfService + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateUsersNearby(data json.RawMessage) (*UpdateUsersNearby, error) { + var resp UpdateUsersNearby + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateDiceEmojis(data json.RawMessage) (*UpdateDiceEmojis, error) { + var resp UpdateDiceEmojis + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateAnimationSearchParameters(data json.RawMessage) (*UpdateAnimationSearchParameters, error) { + var resp UpdateAnimationSearchParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateSuggestedActions(data json.RawMessage) (*UpdateSuggestedActions, error) { + var resp UpdateSuggestedActions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewInlineQuery(data json.RawMessage) (*UpdateNewInlineQuery, error) { + var resp UpdateNewInlineQuery + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewChosenInlineResult(data json.RawMessage) (*UpdateNewChosenInlineResult, error) { + var resp UpdateNewChosenInlineResult + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewCallbackQuery(data json.RawMessage) (*UpdateNewCallbackQuery, error) { + var resp UpdateNewCallbackQuery + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewInlineCallbackQuery(data json.RawMessage) (*UpdateNewInlineCallbackQuery, error) { + var resp UpdateNewInlineCallbackQuery + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewShippingQuery(data json.RawMessage) (*UpdateNewShippingQuery, error) { + var resp UpdateNewShippingQuery + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewPreCheckoutQuery(data json.RawMessage) (*UpdateNewPreCheckoutQuery, error) { + var resp UpdateNewPreCheckoutQuery + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewCustomEvent(data json.RawMessage) (*UpdateNewCustomEvent, error) { + var resp UpdateNewCustomEvent + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewCustomQuery(data json.RawMessage) (*UpdateNewCustomQuery, error) { + var resp UpdateNewCustomQuery + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdatePoll(data json.RawMessage) (*UpdatePoll, error) { + var resp UpdatePoll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdatePollAnswer(data json.RawMessage) (*UpdatePollAnswer, error) { + var resp UpdatePollAnswer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdates(data json.RawMessage) (*Updates, error) { + var resp Updates + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLogStreamDefault(data json.RawMessage) (*LogStreamDefault, error) { + var resp LogStreamDefault + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLogStreamFile(data json.RawMessage) (*LogStreamFile, error) { + var resp LogStreamFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLogStreamEmpty(data json.RawMessage) (*LogStreamEmpty, error) { + var resp LogStreamEmpty + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLogVerbosityLevel(data json.RawMessage) (*LogVerbosityLevel, error) { + var resp LogVerbosityLevel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLogTags(data json.RawMessage) (*LogTags, error) { + var resp LogTags + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTestInt(data json.RawMessage) (*TestInt, error) { + var resp TestInt + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTestString(data json.RawMessage) (*TestString, error) { + var resp TestString + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTestBytes(data json.RawMessage) (*TestBytes, error) { + var resp TestBytes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTestVectorInt(data json.RawMessage) (*TestVectorInt, error) { + var resp TestVectorInt + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTestVectorIntObject(data json.RawMessage) (*TestVectorIntObject, error) { + var resp TestVectorIntObject + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTestVectorString(data json.RawMessage) (*TestVectorString, error) { + var resp TestVectorString + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTestVectorStringObject(data json.RawMessage) (*TestVectorStringObject, error) { + var resp TestVectorStringObject + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalType(data json.RawMessage) (Type, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeError: + return UnmarshalError(data) + + case TypeOk: + return UnmarshalOk(data) + + case TypeTdlibParameters: + return UnmarshalTdlibParameters(data) + + case TypeAuthenticationCodeTypeTelegramMessage: + return UnmarshalAuthenticationCodeTypeTelegramMessage(data) + + case TypeAuthenticationCodeTypeSms: + return UnmarshalAuthenticationCodeTypeSms(data) + + case TypeAuthenticationCodeTypeCall: + return UnmarshalAuthenticationCodeTypeCall(data) + + case TypeAuthenticationCodeTypeFlashCall: + return UnmarshalAuthenticationCodeTypeFlashCall(data) + + case TypeAuthenticationCodeInfo: + return UnmarshalAuthenticationCodeInfo(data) + + case TypeEmailAddressAuthenticationCodeInfo: + return UnmarshalEmailAddressAuthenticationCodeInfo(data) + + case TypeTextEntity: + return UnmarshalTextEntity(data) + + case TypeTextEntities: + return UnmarshalTextEntities(data) + + case TypeFormattedText: + return UnmarshalFormattedText(data) + + case TypeTermsOfService: + return UnmarshalTermsOfService(data) + + case TypeAuthorizationStateWaitTdlibParameters: + return UnmarshalAuthorizationStateWaitTdlibParameters(data) + + case TypeAuthorizationStateWaitEncryptionKey: + return UnmarshalAuthorizationStateWaitEncryptionKey(data) + + case TypeAuthorizationStateWaitPhoneNumber: + return UnmarshalAuthorizationStateWaitPhoneNumber(data) + + case TypeAuthorizationStateWaitCode: + return UnmarshalAuthorizationStateWaitCode(data) + + case TypeAuthorizationStateWaitOtherDeviceConfirmation: + return UnmarshalAuthorizationStateWaitOtherDeviceConfirmation(data) + + case TypeAuthorizationStateWaitRegistration: + return UnmarshalAuthorizationStateWaitRegistration(data) + + case TypeAuthorizationStateWaitPassword: + return UnmarshalAuthorizationStateWaitPassword(data) + + case TypeAuthorizationStateReady: + return UnmarshalAuthorizationStateReady(data) + + case TypeAuthorizationStateLoggingOut: + return UnmarshalAuthorizationStateLoggingOut(data) + + case TypeAuthorizationStateClosing: + return UnmarshalAuthorizationStateClosing(data) + + case TypeAuthorizationStateClosed: + return UnmarshalAuthorizationStateClosed(data) + + case TypePasswordState: + return UnmarshalPasswordState(data) + + case TypeRecoveryEmailAddress: + return UnmarshalRecoveryEmailAddress(data) + + case TypeTemporaryPasswordState: + return UnmarshalTemporaryPasswordState(data) + + case TypeLocalFile: + return UnmarshalLocalFile(data) + + case TypeRemoteFile: + return UnmarshalRemoteFile(data) + + case TypeFile: + return UnmarshalFile(data) + + case TypeInputFileId: + return UnmarshalInputFileId(data) + + case TypeInputFileRemote: + return UnmarshalInputFileRemote(data) + + case TypeInputFileLocal: + return UnmarshalInputFileLocal(data) + + case TypeInputFileGenerated: + return UnmarshalInputFileGenerated(data) + + case TypePhotoSize: + return UnmarshalPhotoSize(data) + + case TypeMinithumbnail: + return UnmarshalMinithumbnail(data) + + case TypeThumbnailFormatJpeg: + return UnmarshalThumbnailFormatJpeg(data) + + case TypeThumbnailFormatPng: + return UnmarshalThumbnailFormatPng(data) + + case TypeThumbnailFormatWebp: + return UnmarshalThumbnailFormatWebp(data) + + case TypeThumbnailFormatGif: + return UnmarshalThumbnailFormatGif(data) + + case TypeThumbnailFormatTgs: + return UnmarshalThumbnailFormatTgs(data) + + case TypeThumbnailFormatMpeg4: + return UnmarshalThumbnailFormatMpeg4(data) + + case TypeThumbnail: + return UnmarshalThumbnail(data) + + case TypeMaskPointForehead: + return UnmarshalMaskPointForehead(data) + + case TypeMaskPointEyes: + return UnmarshalMaskPointEyes(data) + + case TypeMaskPointMouth: + return UnmarshalMaskPointMouth(data) + + case TypeMaskPointChin: + return UnmarshalMaskPointChin(data) + + case TypeMaskPosition: + return UnmarshalMaskPosition(data) + + case TypePollOption: + return UnmarshalPollOption(data) + + case TypePollTypeRegular: + return UnmarshalPollTypeRegular(data) + + case TypePollTypeQuiz: + return UnmarshalPollTypeQuiz(data) + + case TypeAnimation: + return UnmarshalAnimation(data) + + case TypeAudio: + return UnmarshalAudio(data) + + case TypeDocument: + return UnmarshalDocument(data) + + case TypePhoto: + return UnmarshalPhoto(data) + + case TypeSticker: + return UnmarshalSticker(data) + + case TypeVideo: + return UnmarshalVideo(data) + + case TypeVideoNote: + return UnmarshalVideoNote(data) + + case TypeVoiceNote: + return UnmarshalVoiceNote(data) + + case TypeContact: + return UnmarshalContact(data) + + case TypeLocation: + return UnmarshalLocation(data) + + case TypeVenue: + return UnmarshalVenue(data) + + case TypeGame: + return UnmarshalGame(data) + + case TypePoll: + return UnmarshalPoll(data) + + case TypeProfilePhoto: + return UnmarshalProfilePhoto(data) + + case TypeChatPhotoInfo: + return UnmarshalChatPhotoInfo(data) + + case TypeUserTypeRegular: + return UnmarshalUserTypeRegular(data) + + case TypeUserTypeDeleted: + return UnmarshalUserTypeDeleted(data) + + case TypeUserTypeBot: + return UnmarshalUserTypeBot(data) + + case TypeUserTypeUnknown: + return UnmarshalUserTypeUnknown(data) + + case TypeBotCommand: + return UnmarshalBotCommand(data) + + case TypeBotInfo: + return UnmarshalBotInfo(data) + + case TypeChatLocation: + return UnmarshalChatLocation(data) + + case TypeAnimatedChatPhoto: + return UnmarshalAnimatedChatPhoto(data) + + case TypeChatPhoto: + return UnmarshalChatPhoto(data) + + case TypeChatPhotos: + return UnmarshalChatPhotos(data) + + case TypeInputChatPhotoPrevious: + return UnmarshalInputChatPhotoPrevious(data) + + case TypeInputChatPhotoStatic: + return UnmarshalInputChatPhotoStatic(data) + + case TypeInputChatPhotoAnimation: + return UnmarshalInputChatPhotoAnimation(data) + + case TypeUser: + return UnmarshalUser(data) + + case TypeUserFullInfo: + return UnmarshalUserFullInfo(data) + + case TypeUsers: + return UnmarshalUsers(data) + + case TypeChatAdministrator: + return UnmarshalChatAdministrator(data) + + case TypeChatAdministrators: + return UnmarshalChatAdministrators(data) + + case TypeChatPermissions: + return UnmarshalChatPermissions(data) + + case TypeChatMemberStatusCreator: + return UnmarshalChatMemberStatusCreator(data) + + case TypeChatMemberStatusAdministrator: + return UnmarshalChatMemberStatusAdministrator(data) + + case TypeChatMemberStatusMember: + return UnmarshalChatMemberStatusMember(data) + + case TypeChatMemberStatusRestricted: + return UnmarshalChatMemberStatusRestricted(data) + + case TypeChatMemberStatusLeft: + return UnmarshalChatMemberStatusLeft(data) + + case TypeChatMemberStatusBanned: + return UnmarshalChatMemberStatusBanned(data) + + case TypeChatMember: + return UnmarshalChatMember(data) + + case TypeChatMembers: + return UnmarshalChatMembers(data) + + case TypeChatMembersFilterContacts: + return UnmarshalChatMembersFilterContacts(data) + + case TypeChatMembersFilterAdministrators: + return UnmarshalChatMembersFilterAdministrators(data) + + case TypeChatMembersFilterMembers: + return UnmarshalChatMembersFilterMembers(data) + + case TypeChatMembersFilterMention: + return UnmarshalChatMembersFilterMention(data) + + case TypeChatMembersFilterRestricted: + return UnmarshalChatMembersFilterRestricted(data) + + case TypeChatMembersFilterBanned: + return UnmarshalChatMembersFilterBanned(data) + + case TypeChatMembersFilterBots: + return UnmarshalChatMembersFilterBots(data) + + case TypeSupergroupMembersFilterRecent: + return UnmarshalSupergroupMembersFilterRecent(data) + + case TypeSupergroupMembersFilterContacts: + return UnmarshalSupergroupMembersFilterContacts(data) + + case TypeSupergroupMembersFilterAdministrators: + return UnmarshalSupergroupMembersFilterAdministrators(data) + + case TypeSupergroupMembersFilterSearch: + return UnmarshalSupergroupMembersFilterSearch(data) + + case TypeSupergroupMembersFilterRestricted: + return UnmarshalSupergroupMembersFilterRestricted(data) + + case TypeSupergroupMembersFilterBanned: + return UnmarshalSupergroupMembersFilterBanned(data) + + case TypeSupergroupMembersFilterMention: + return UnmarshalSupergroupMembersFilterMention(data) + + case TypeSupergroupMembersFilterBots: + return UnmarshalSupergroupMembersFilterBots(data) + + case TypeBasicGroup: + return UnmarshalBasicGroup(data) + + case TypeBasicGroupFullInfo: + return UnmarshalBasicGroupFullInfo(data) + + case TypeSupergroup: + return UnmarshalSupergroup(data) + + case TypeSupergroupFullInfo: + return UnmarshalSupergroupFullInfo(data) + + case TypeSecretChatStatePending: + return UnmarshalSecretChatStatePending(data) + + case TypeSecretChatStateReady: + return UnmarshalSecretChatStateReady(data) + + case TypeSecretChatStateClosed: + return UnmarshalSecretChatStateClosed(data) + + case TypeSecretChat: + return UnmarshalSecretChat(data) + + case TypeMessageSenderUser: + return UnmarshalMessageSenderUser(data) + + case TypeMessageSenderChat: + return UnmarshalMessageSenderChat(data) + + case TypeMessageSenders: + return UnmarshalMessageSenders(data) + + case TypeMessageForwardOriginUser: + return UnmarshalMessageForwardOriginUser(data) + + case TypeMessageForwardOriginChat: + return UnmarshalMessageForwardOriginChat(data) + + case TypeMessageForwardOriginHiddenUser: + return UnmarshalMessageForwardOriginHiddenUser(data) + + case TypeMessageForwardOriginChannel: + return UnmarshalMessageForwardOriginChannel(data) + + case TypeMessageForwardInfo: + return UnmarshalMessageForwardInfo(data) + + case TypeMessageReplyInfo: + return UnmarshalMessageReplyInfo(data) + + case TypeMessageInteractionInfo: + return UnmarshalMessageInteractionInfo(data) + + case TypeMessageSendingStatePending: + return UnmarshalMessageSendingStatePending(data) + + case TypeMessageSendingStateFailed: + return UnmarshalMessageSendingStateFailed(data) + + case TypeMessage: + return UnmarshalMessage(data) + + case TypeMessages: + return UnmarshalMessages(data) + + case TypeFoundMessages: + return UnmarshalFoundMessages(data) + + case TypeNotificationSettingsScopePrivateChats: + return UnmarshalNotificationSettingsScopePrivateChats(data) + + case TypeNotificationSettingsScopeGroupChats: + return UnmarshalNotificationSettingsScopeGroupChats(data) + + case TypeNotificationSettingsScopeChannelChats: + return UnmarshalNotificationSettingsScopeChannelChats(data) + + case TypeChatNotificationSettings: + return UnmarshalChatNotificationSettings(data) + + case TypeScopeNotificationSettings: + return UnmarshalScopeNotificationSettings(data) + + case TypeDraftMessage: + return UnmarshalDraftMessage(data) + + case TypeChatTypePrivate: + return UnmarshalChatTypePrivate(data) + + case TypeChatTypeBasicGroup: + return UnmarshalChatTypeBasicGroup(data) + + case TypeChatTypeSupergroup: + return UnmarshalChatTypeSupergroup(data) + + case TypeChatTypeSecret: + return UnmarshalChatTypeSecret(data) + + case TypeChatFilter: + return UnmarshalChatFilter(data) + + case TypeChatFilterInfo: + return UnmarshalChatFilterInfo(data) + + case TypeRecommendedChatFilter: + return UnmarshalRecommendedChatFilter(data) + + case TypeRecommendedChatFilters: + return UnmarshalRecommendedChatFilters(data) + + case TypeChatListMain: + return UnmarshalChatListMain(data) + + case TypeChatListArchive: + return UnmarshalChatListArchive(data) + + case TypeChatListFilter: + return UnmarshalChatListFilter(data) + + case TypeChatLists: + return UnmarshalChatLists(data) + + case TypeChatSourceMtprotoProxy: + return UnmarshalChatSourceMtprotoProxy(data) + + case TypeChatSourcePublicServiceAnnouncement: + return UnmarshalChatSourcePublicServiceAnnouncement(data) + + case TypeChatPosition: + return UnmarshalChatPosition(data) + + case TypeChat: + return UnmarshalChat(data) + + case TypeChats: + return UnmarshalChats(data) + + case TypeChatNearby: + return UnmarshalChatNearby(data) + + case TypeChatsNearby: + return UnmarshalChatsNearby(data) + + case TypeChatInviteLink: + return UnmarshalChatInviteLink(data) + + case TypeChatInviteLinkInfo: + return UnmarshalChatInviteLinkInfo(data) + + case TypePublicChatTypeHasUsername: + return UnmarshalPublicChatTypeHasUsername(data) + + case TypePublicChatTypeIsLocationBased: + return UnmarshalPublicChatTypeIsLocationBased(data) + + case TypeChatActionBarReportSpam: + return UnmarshalChatActionBarReportSpam(data) + + case TypeChatActionBarReportUnrelatedLocation: + return UnmarshalChatActionBarReportUnrelatedLocation(data) + + case TypeChatActionBarReportAddBlock: + return UnmarshalChatActionBarReportAddBlock(data) + + case TypeChatActionBarAddContact: + return UnmarshalChatActionBarAddContact(data) + + case TypeChatActionBarSharePhoneNumber: + return UnmarshalChatActionBarSharePhoneNumber(data) + + case TypeKeyboardButtonTypeText: + return UnmarshalKeyboardButtonTypeText(data) + + case TypeKeyboardButtonTypeRequestPhoneNumber: + return UnmarshalKeyboardButtonTypeRequestPhoneNumber(data) + + case TypeKeyboardButtonTypeRequestLocation: + return UnmarshalKeyboardButtonTypeRequestLocation(data) + + case TypeKeyboardButtonTypeRequestPoll: + return UnmarshalKeyboardButtonTypeRequestPoll(data) + + case TypeKeyboardButton: + return UnmarshalKeyboardButton(data) + + case TypeInlineKeyboardButtonTypeUrl: + return UnmarshalInlineKeyboardButtonTypeUrl(data) + + case TypeInlineKeyboardButtonTypeLoginUrl: + return UnmarshalInlineKeyboardButtonTypeLoginUrl(data) + + case TypeInlineKeyboardButtonTypeCallback: + return UnmarshalInlineKeyboardButtonTypeCallback(data) + + case TypeInlineKeyboardButtonTypeCallbackWithPassword: + return UnmarshalInlineKeyboardButtonTypeCallbackWithPassword(data) + + case TypeInlineKeyboardButtonTypeCallbackGame: + return UnmarshalInlineKeyboardButtonTypeCallbackGame(data) + + case TypeInlineKeyboardButtonTypeSwitchInline: + return UnmarshalInlineKeyboardButtonTypeSwitchInline(data) + + case TypeInlineKeyboardButtonTypeBuy: + return UnmarshalInlineKeyboardButtonTypeBuy(data) + + case TypeInlineKeyboardButton: + return UnmarshalInlineKeyboardButton(data) + + case TypeReplyMarkupRemoveKeyboard: + return UnmarshalReplyMarkupRemoveKeyboard(data) + + case TypeReplyMarkupForceReply: + return UnmarshalReplyMarkupForceReply(data) + + case TypeReplyMarkupShowKeyboard: + return UnmarshalReplyMarkupShowKeyboard(data) + + case TypeReplyMarkupInlineKeyboard: + return UnmarshalReplyMarkupInlineKeyboard(data) + + case TypeLoginUrlInfoOpen: + return UnmarshalLoginUrlInfoOpen(data) + + case TypeLoginUrlInfoRequestConfirmation: + return UnmarshalLoginUrlInfoRequestConfirmation(data) + + case TypeMessageThreadInfo: + return UnmarshalMessageThreadInfo(data) + + case TypeRichTextPlain: + return UnmarshalRichTextPlain(data) + + case TypeRichTextBold: + return UnmarshalRichTextBold(data) + + case TypeRichTextItalic: + return UnmarshalRichTextItalic(data) + + case TypeRichTextUnderline: + return UnmarshalRichTextUnderline(data) + + case TypeRichTextStrikethrough: + return UnmarshalRichTextStrikethrough(data) + + case TypeRichTextFixed: + return UnmarshalRichTextFixed(data) + + case TypeRichTextUrl: + return UnmarshalRichTextUrl(data) + + case TypeRichTextEmailAddress: + return UnmarshalRichTextEmailAddress(data) + + case TypeRichTextSubscript: + return UnmarshalRichTextSubscript(data) + + case TypeRichTextSuperscript: + return UnmarshalRichTextSuperscript(data) + + case TypeRichTextMarked: + return UnmarshalRichTextMarked(data) + + case TypeRichTextPhoneNumber: + return UnmarshalRichTextPhoneNumber(data) + + case TypeRichTextIcon: + return UnmarshalRichTextIcon(data) + + case TypeRichTextReference: + return UnmarshalRichTextReference(data) + + case TypeRichTextAnchor: + return UnmarshalRichTextAnchor(data) + + case TypeRichTextAnchorLink: + return UnmarshalRichTextAnchorLink(data) + + case TypeRichTexts: + return UnmarshalRichTexts(data) + + case TypePageBlockCaption: + return UnmarshalPageBlockCaption(data) + + case TypePageBlockListItem: + return UnmarshalPageBlockListItem(data) + + case TypePageBlockHorizontalAlignmentLeft: + return UnmarshalPageBlockHorizontalAlignmentLeft(data) + + case TypePageBlockHorizontalAlignmentCenter: + return UnmarshalPageBlockHorizontalAlignmentCenter(data) + + case TypePageBlockHorizontalAlignmentRight: + return UnmarshalPageBlockHorizontalAlignmentRight(data) + + case TypePageBlockVerticalAlignmentTop: + return UnmarshalPageBlockVerticalAlignmentTop(data) + + case TypePageBlockVerticalAlignmentMiddle: + return UnmarshalPageBlockVerticalAlignmentMiddle(data) + + case TypePageBlockVerticalAlignmentBottom: + return UnmarshalPageBlockVerticalAlignmentBottom(data) + + case TypePageBlockTableCell: + return UnmarshalPageBlockTableCell(data) + + case TypePageBlockRelatedArticle: + return UnmarshalPageBlockRelatedArticle(data) + + case TypePageBlockTitle: + return UnmarshalPageBlockTitle(data) + + case TypePageBlockSubtitle: + return UnmarshalPageBlockSubtitle(data) + + case TypePageBlockAuthorDate: + return UnmarshalPageBlockAuthorDate(data) + + case TypePageBlockHeader: + return UnmarshalPageBlockHeader(data) + + case TypePageBlockSubheader: + return UnmarshalPageBlockSubheader(data) + + case TypePageBlockKicker: + return UnmarshalPageBlockKicker(data) + + case TypePageBlockParagraph: + return UnmarshalPageBlockParagraph(data) + + case TypePageBlockPreformatted: + return UnmarshalPageBlockPreformatted(data) + + case TypePageBlockFooter: + return UnmarshalPageBlockFooter(data) + + case TypePageBlockDivider: + return UnmarshalPageBlockDivider(data) + + case TypePageBlockAnchor: + return UnmarshalPageBlockAnchor(data) + + case TypePageBlockList: + return UnmarshalPageBlockList(data) + + case TypePageBlockBlockQuote: + return UnmarshalPageBlockBlockQuote(data) + + case TypePageBlockPullQuote: + return UnmarshalPageBlockPullQuote(data) + + case TypePageBlockAnimation: + return UnmarshalPageBlockAnimation(data) + + case TypePageBlockAudio: + return UnmarshalPageBlockAudio(data) + + case TypePageBlockPhoto: + return UnmarshalPageBlockPhoto(data) + + case TypePageBlockVideo: + return UnmarshalPageBlockVideo(data) + + case TypePageBlockVoiceNote: + return UnmarshalPageBlockVoiceNote(data) + + case TypePageBlockCover: + return UnmarshalPageBlockCover(data) + + case TypePageBlockEmbedded: + return UnmarshalPageBlockEmbedded(data) + + case TypePageBlockEmbeddedPost: + return UnmarshalPageBlockEmbeddedPost(data) + + case TypePageBlockCollage: + return UnmarshalPageBlockCollage(data) + + case TypePageBlockSlideshow: + return UnmarshalPageBlockSlideshow(data) + + case TypePageBlockChatLink: + return UnmarshalPageBlockChatLink(data) + + case TypePageBlockTable: + return UnmarshalPageBlockTable(data) + + case TypePageBlockDetails: + return UnmarshalPageBlockDetails(data) + + case TypePageBlockRelatedArticles: + return UnmarshalPageBlockRelatedArticles(data) + + case TypePageBlockMap: + return UnmarshalPageBlockMap(data) + + case TypeWebPageInstantView: + return UnmarshalWebPageInstantView(data) + + case TypeWebPage: + return UnmarshalWebPage(data) + + case TypeCountryInfo: + return UnmarshalCountryInfo(data) + + case TypeCountries: + return UnmarshalCountries(data) + + case TypePhoneNumberInfo: + return UnmarshalPhoneNumberInfo(data) + + case TypeBankCardActionOpenUrl: + return UnmarshalBankCardActionOpenUrl(data) + + case TypeBankCardInfo: + return UnmarshalBankCardInfo(data) + + case TypeAddress: + return UnmarshalAddress(data) + + case TypeLabeledPricePart: + return UnmarshalLabeledPricePart(data) + + case TypeInvoice: + return UnmarshalInvoice(data) + + case TypeOrderInfo: + return UnmarshalOrderInfo(data) + + case TypeShippingOption: + return UnmarshalShippingOption(data) + + case TypeSavedCredentials: + return UnmarshalSavedCredentials(data) + + case TypeInputCredentialsSaved: + return UnmarshalInputCredentialsSaved(data) + + case TypeInputCredentialsNew: + return UnmarshalInputCredentialsNew(data) + + case TypeInputCredentialsAndroidPay: + return UnmarshalInputCredentialsAndroidPay(data) + + case TypeInputCredentialsApplePay: + return UnmarshalInputCredentialsApplePay(data) + + case TypePaymentsProviderStripe: + return UnmarshalPaymentsProviderStripe(data) + + case TypePaymentForm: + return UnmarshalPaymentForm(data) + + case TypeValidatedOrderInfo: + return UnmarshalValidatedOrderInfo(data) + + case TypePaymentResult: + return UnmarshalPaymentResult(data) + + case TypePaymentReceipt: + return UnmarshalPaymentReceipt(data) + + case TypeDatedFile: + return UnmarshalDatedFile(data) + + case TypePassportElementTypePersonalDetails: + return UnmarshalPassportElementTypePersonalDetails(data) + + case TypePassportElementTypePassport: + return UnmarshalPassportElementTypePassport(data) + + case TypePassportElementTypeDriverLicense: + return UnmarshalPassportElementTypeDriverLicense(data) + + case TypePassportElementTypeIdentityCard: + return UnmarshalPassportElementTypeIdentityCard(data) + + case TypePassportElementTypeInternalPassport: + return UnmarshalPassportElementTypeInternalPassport(data) + + case TypePassportElementTypeAddress: + return UnmarshalPassportElementTypeAddress(data) + + case TypePassportElementTypeUtilityBill: + return UnmarshalPassportElementTypeUtilityBill(data) + + case TypePassportElementTypeBankStatement: + return UnmarshalPassportElementTypeBankStatement(data) + + case TypePassportElementTypeRentalAgreement: + return UnmarshalPassportElementTypeRentalAgreement(data) + + case TypePassportElementTypePassportRegistration: + return UnmarshalPassportElementTypePassportRegistration(data) + + case TypePassportElementTypeTemporaryRegistration: + return UnmarshalPassportElementTypeTemporaryRegistration(data) + + case TypePassportElementTypePhoneNumber: + return UnmarshalPassportElementTypePhoneNumber(data) + + case TypePassportElementTypeEmailAddress: + return UnmarshalPassportElementTypeEmailAddress(data) + + case TypeDate: + return UnmarshalDate(data) + + case TypePersonalDetails: + return UnmarshalPersonalDetails(data) + + case TypeIdentityDocument: + return UnmarshalIdentityDocument(data) + + case TypeInputIdentityDocument: + return UnmarshalInputIdentityDocument(data) + + case TypePersonalDocument: + return UnmarshalPersonalDocument(data) + + case TypeInputPersonalDocument: + return UnmarshalInputPersonalDocument(data) + + case TypePassportElementPersonalDetails: + return UnmarshalPassportElementPersonalDetails(data) + + case TypePassportElementPassport: + return UnmarshalPassportElementPassport(data) + + case TypePassportElementDriverLicense: + return UnmarshalPassportElementDriverLicense(data) + + case TypePassportElementIdentityCard: + return UnmarshalPassportElementIdentityCard(data) + + case TypePassportElementInternalPassport: + return UnmarshalPassportElementInternalPassport(data) + + case TypePassportElementAddress: + return UnmarshalPassportElementAddress(data) + + case TypePassportElementUtilityBill: + return UnmarshalPassportElementUtilityBill(data) + + case TypePassportElementBankStatement: + return UnmarshalPassportElementBankStatement(data) + + case TypePassportElementRentalAgreement: + return UnmarshalPassportElementRentalAgreement(data) + + case TypePassportElementPassportRegistration: + return UnmarshalPassportElementPassportRegistration(data) + + case TypePassportElementTemporaryRegistration: + return UnmarshalPassportElementTemporaryRegistration(data) + + case TypePassportElementPhoneNumber: + return UnmarshalPassportElementPhoneNumber(data) + + case TypePassportElementEmailAddress: + return UnmarshalPassportElementEmailAddress(data) + + case TypeInputPassportElementPersonalDetails: + return UnmarshalInputPassportElementPersonalDetails(data) + + case TypeInputPassportElementPassport: + return UnmarshalInputPassportElementPassport(data) + + case TypeInputPassportElementDriverLicense: + return UnmarshalInputPassportElementDriverLicense(data) + + case TypeInputPassportElementIdentityCard: + return UnmarshalInputPassportElementIdentityCard(data) + + case TypeInputPassportElementInternalPassport: + return UnmarshalInputPassportElementInternalPassport(data) + + case TypeInputPassportElementAddress: + return UnmarshalInputPassportElementAddress(data) + + case TypeInputPassportElementUtilityBill: + return UnmarshalInputPassportElementUtilityBill(data) + + case TypeInputPassportElementBankStatement: + return UnmarshalInputPassportElementBankStatement(data) + + case TypeInputPassportElementRentalAgreement: + return UnmarshalInputPassportElementRentalAgreement(data) + + case TypeInputPassportElementPassportRegistration: + return UnmarshalInputPassportElementPassportRegistration(data) + + case TypeInputPassportElementTemporaryRegistration: + return UnmarshalInputPassportElementTemporaryRegistration(data) + + case TypeInputPassportElementPhoneNumber: + return UnmarshalInputPassportElementPhoneNumber(data) + + case TypeInputPassportElementEmailAddress: + return UnmarshalInputPassportElementEmailAddress(data) + + case TypePassportElements: + return UnmarshalPassportElements(data) + + case TypePassportElementErrorSourceUnspecified: + return UnmarshalPassportElementErrorSourceUnspecified(data) + + case TypePassportElementErrorSourceDataField: + return UnmarshalPassportElementErrorSourceDataField(data) + + case TypePassportElementErrorSourceFrontSide: + return UnmarshalPassportElementErrorSourceFrontSide(data) + + case TypePassportElementErrorSourceReverseSide: + return UnmarshalPassportElementErrorSourceReverseSide(data) + + case TypePassportElementErrorSourceSelfie: + return UnmarshalPassportElementErrorSourceSelfie(data) + + case TypePassportElementErrorSourceTranslationFile: + return UnmarshalPassportElementErrorSourceTranslationFile(data) + + case TypePassportElementErrorSourceTranslationFiles: + return UnmarshalPassportElementErrorSourceTranslationFiles(data) + + case TypePassportElementErrorSourceFile: + return UnmarshalPassportElementErrorSourceFile(data) + + case TypePassportElementErrorSourceFiles: + return UnmarshalPassportElementErrorSourceFiles(data) + + case TypePassportElementError: + return UnmarshalPassportElementError(data) + + case TypePassportSuitableElement: + return UnmarshalPassportSuitableElement(data) + + case TypePassportRequiredElement: + return UnmarshalPassportRequiredElement(data) + + case TypePassportAuthorizationForm: + return UnmarshalPassportAuthorizationForm(data) + + case TypePassportElementsWithErrors: + return UnmarshalPassportElementsWithErrors(data) + + case TypeEncryptedCredentials: + return UnmarshalEncryptedCredentials(data) + + case TypeEncryptedPassportElement: + return UnmarshalEncryptedPassportElement(data) + + case TypeInputPassportElementErrorSourceUnspecified: + return UnmarshalInputPassportElementErrorSourceUnspecified(data) + + case TypeInputPassportElementErrorSourceDataField: + return UnmarshalInputPassportElementErrorSourceDataField(data) + + case TypeInputPassportElementErrorSourceFrontSide: + return UnmarshalInputPassportElementErrorSourceFrontSide(data) + + case TypeInputPassportElementErrorSourceReverseSide: + return UnmarshalInputPassportElementErrorSourceReverseSide(data) + + case TypeInputPassportElementErrorSourceSelfie: + return UnmarshalInputPassportElementErrorSourceSelfie(data) + + case TypeInputPassportElementErrorSourceTranslationFile: + return UnmarshalInputPassportElementErrorSourceTranslationFile(data) + + case TypeInputPassportElementErrorSourceTranslationFiles: + return UnmarshalInputPassportElementErrorSourceTranslationFiles(data) + + case TypeInputPassportElementErrorSourceFile: + return UnmarshalInputPassportElementErrorSourceFile(data) + + case TypeInputPassportElementErrorSourceFiles: + return UnmarshalInputPassportElementErrorSourceFiles(data) + + case TypeInputPassportElementError: + return UnmarshalInputPassportElementError(data) + + case TypeMessageText: + return UnmarshalMessageText(data) + + case TypeMessageAnimation: + return UnmarshalMessageAnimation(data) + + case TypeMessageAudio: + return UnmarshalMessageAudio(data) + + case TypeMessageDocument: + return UnmarshalMessageDocument(data) + + case TypeMessagePhoto: + return UnmarshalMessagePhoto(data) + + case TypeMessageExpiredPhoto: + return UnmarshalMessageExpiredPhoto(data) + + case TypeMessageSticker: + return UnmarshalMessageSticker(data) + + case TypeMessageVideo: + return UnmarshalMessageVideo(data) + + case TypeMessageExpiredVideo: + return UnmarshalMessageExpiredVideo(data) + + case TypeMessageVideoNote: + return UnmarshalMessageVideoNote(data) + + case TypeMessageVoiceNote: + return UnmarshalMessageVoiceNote(data) + + case TypeMessageLocation: + return UnmarshalMessageLocation(data) + + case TypeMessageVenue: + return UnmarshalMessageVenue(data) + + case TypeMessageContact: + return UnmarshalMessageContact(data) + + case TypeMessageDice: + return UnmarshalMessageDice(data) + + case TypeMessageGame: + return UnmarshalMessageGame(data) + + case TypeMessagePoll: + return UnmarshalMessagePoll(data) + + case TypeMessageInvoice: + return UnmarshalMessageInvoice(data) + + case TypeMessageCall: + return UnmarshalMessageCall(data) + + case TypeMessageBasicGroupChatCreate: + return UnmarshalMessageBasicGroupChatCreate(data) + + case TypeMessageSupergroupChatCreate: + return UnmarshalMessageSupergroupChatCreate(data) + + case TypeMessageChatChangeTitle: + return UnmarshalMessageChatChangeTitle(data) + + case TypeMessageChatChangePhoto: + return UnmarshalMessageChatChangePhoto(data) + + case TypeMessageChatDeletePhoto: + return UnmarshalMessageChatDeletePhoto(data) + + case TypeMessageChatAddMembers: + return UnmarshalMessageChatAddMembers(data) + + case TypeMessageChatJoinByLink: + return UnmarshalMessageChatJoinByLink(data) + + case TypeMessageChatDeleteMember: + return UnmarshalMessageChatDeleteMember(data) + + case TypeMessageChatUpgradeTo: + return UnmarshalMessageChatUpgradeTo(data) + + case TypeMessageChatUpgradeFrom: + return UnmarshalMessageChatUpgradeFrom(data) + + case TypeMessagePinMessage: + return UnmarshalMessagePinMessage(data) + + case TypeMessageScreenshotTaken: + return UnmarshalMessageScreenshotTaken(data) + + case TypeMessageChatSetTtl: + return UnmarshalMessageChatSetTtl(data) + + case TypeMessageCustomServiceAction: + return UnmarshalMessageCustomServiceAction(data) + + case TypeMessageGameScore: + return UnmarshalMessageGameScore(data) + + case TypeMessagePaymentSuccessful: + return UnmarshalMessagePaymentSuccessful(data) + + case TypeMessagePaymentSuccessfulBot: + return UnmarshalMessagePaymentSuccessfulBot(data) + + case TypeMessageContactRegistered: + return UnmarshalMessageContactRegistered(data) + + case TypeMessageWebsiteConnected: + return UnmarshalMessageWebsiteConnected(data) + + case TypeMessagePassportDataSent: + return UnmarshalMessagePassportDataSent(data) + + case TypeMessagePassportDataReceived: + return UnmarshalMessagePassportDataReceived(data) + + case TypeMessageProximityAlertTriggered: + return UnmarshalMessageProximityAlertTriggered(data) + + case TypeMessageUnsupported: + return UnmarshalMessageUnsupported(data) + + case TypeTextEntityTypeMention: + return UnmarshalTextEntityTypeMention(data) + + case TypeTextEntityTypeHashtag: + return UnmarshalTextEntityTypeHashtag(data) + + case TypeTextEntityTypeCashtag: + return UnmarshalTextEntityTypeCashtag(data) + + case TypeTextEntityTypeBotCommand: + return UnmarshalTextEntityTypeBotCommand(data) + + case TypeTextEntityTypeUrl: + return UnmarshalTextEntityTypeUrl(data) + + case TypeTextEntityTypeEmailAddress: + return UnmarshalTextEntityTypeEmailAddress(data) + + case TypeTextEntityTypePhoneNumber: + return UnmarshalTextEntityTypePhoneNumber(data) + + case TypeTextEntityTypeBankCardNumber: + return UnmarshalTextEntityTypeBankCardNumber(data) + + case TypeTextEntityTypeBold: + return UnmarshalTextEntityTypeBold(data) + + case TypeTextEntityTypeItalic: + return UnmarshalTextEntityTypeItalic(data) + + case TypeTextEntityTypeUnderline: + return UnmarshalTextEntityTypeUnderline(data) + + case TypeTextEntityTypeStrikethrough: + return UnmarshalTextEntityTypeStrikethrough(data) + + case TypeTextEntityTypeCode: + return UnmarshalTextEntityTypeCode(data) + + case TypeTextEntityTypePre: + return UnmarshalTextEntityTypePre(data) + + case TypeTextEntityTypePreCode: + return UnmarshalTextEntityTypePreCode(data) + + case TypeTextEntityTypeTextUrl: + return UnmarshalTextEntityTypeTextUrl(data) + + case TypeTextEntityTypeMentionName: + return UnmarshalTextEntityTypeMentionName(data) + + case TypeInputThumbnail: + return UnmarshalInputThumbnail(data) + + case TypeMessageSchedulingStateSendAtDate: + return UnmarshalMessageSchedulingStateSendAtDate(data) + + case TypeMessageSchedulingStateSendWhenOnline: + return UnmarshalMessageSchedulingStateSendWhenOnline(data) + + case TypeMessageSendOptions: + return UnmarshalMessageSendOptions(data) + + case TypeMessageCopyOptions: + return UnmarshalMessageCopyOptions(data) + + case TypeInputMessageText: + return UnmarshalInputMessageText(data) + + case TypeInputMessageAnimation: + return UnmarshalInputMessageAnimation(data) + + case TypeInputMessageAudio: + return UnmarshalInputMessageAudio(data) + + case TypeInputMessageDocument: + return UnmarshalInputMessageDocument(data) + + case TypeInputMessagePhoto: + return UnmarshalInputMessagePhoto(data) + + case TypeInputMessageSticker: + return UnmarshalInputMessageSticker(data) + + case TypeInputMessageVideo: + return UnmarshalInputMessageVideo(data) + + case TypeInputMessageVideoNote: + return UnmarshalInputMessageVideoNote(data) + + case TypeInputMessageVoiceNote: + return UnmarshalInputMessageVoiceNote(data) + + case TypeInputMessageLocation: + return UnmarshalInputMessageLocation(data) + + case TypeInputMessageVenue: + return UnmarshalInputMessageVenue(data) + + case TypeInputMessageContact: + return UnmarshalInputMessageContact(data) + + case TypeInputMessageDice: + return UnmarshalInputMessageDice(data) + + case TypeInputMessageGame: + return UnmarshalInputMessageGame(data) + + case TypeInputMessageInvoice: + return UnmarshalInputMessageInvoice(data) + + case TypeInputMessagePoll: + return UnmarshalInputMessagePoll(data) + + case TypeInputMessageForwarded: + return UnmarshalInputMessageForwarded(data) + + case TypeSearchMessagesFilterEmpty: + return UnmarshalSearchMessagesFilterEmpty(data) + + case TypeSearchMessagesFilterAnimation: + return UnmarshalSearchMessagesFilterAnimation(data) + + case TypeSearchMessagesFilterAudio: + return UnmarshalSearchMessagesFilterAudio(data) + + case TypeSearchMessagesFilterDocument: + return UnmarshalSearchMessagesFilterDocument(data) + + case TypeSearchMessagesFilterPhoto: + return UnmarshalSearchMessagesFilterPhoto(data) + + case TypeSearchMessagesFilterVideo: + return UnmarshalSearchMessagesFilterVideo(data) + + case TypeSearchMessagesFilterVoiceNote: + return UnmarshalSearchMessagesFilterVoiceNote(data) + + case TypeSearchMessagesFilterPhotoAndVideo: + return UnmarshalSearchMessagesFilterPhotoAndVideo(data) + + case TypeSearchMessagesFilterUrl: + return UnmarshalSearchMessagesFilterUrl(data) + + case TypeSearchMessagesFilterChatPhoto: + return UnmarshalSearchMessagesFilterChatPhoto(data) + + case TypeSearchMessagesFilterCall: + return UnmarshalSearchMessagesFilterCall(data) + + case TypeSearchMessagesFilterMissedCall: + return UnmarshalSearchMessagesFilterMissedCall(data) + + case TypeSearchMessagesFilterVideoNote: + return UnmarshalSearchMessagesFilterVideoNote(data) + + case TypeSearchMessagesFilterVoiceAndVideoNote: + return UnmarshalSearchMessagesFilterVoiceAndVideoNote(data) + + case TypeSearchMessagesFilterMention: + return UnmarshalSearchMessagesFilterMention(data) + + case TypeSearchMessagesFilterUnreadMention: + return UnmarshalSearchMessagesFilterUnreadMention(data) + + case TypeSearchMessagesFilterFailedToSend: + return UnmarshalSearchMessagesFilterFailedToSend(data) + + case TypeSearchMessagesFilterPinned: + return UnmarshalSearchMessagesFilterPinned(data) + + case TypeChatActionTyping: + return UnmarshalChatActionTyping(data) + + case TypeChatActionRecordingVideo: + return UnmarshalChatActionRecordingVideo(data) + + case TypeChatActionUploadingVideo: + return UnmarshalChatActionUploadingVideo(data) + + case TypeChatActionRecordingVoiceNote: + return UnmarshalChatActionRecordingVoiceNote(data) + + case TypeChatActionUploadingVoiceNote: + return UnmarshalChatActionUploadingVoiceNote(data) + + case TypeChatActionUploadingPhoto: + return UnmarshalChatActionUploadingPhoto(data) + + case TypeChatActionUploadingDocument: + return UnmarshalChatActionUploadingDocument(data) + + case TypeChatActionChoosingLocation: + return UnmarshalChatActionChoosingLocation(data) + + case TypeChatActionChoosingContact: + return UnmarshalChatActionChoosingContact(data) + + case TypeChatActionStartPlayingGame: + return UnmarshalChatActionStartPlayingGame(data) + + case TypeChatActionRecordingVideoNote: + return UnmarshalChatActionRecordingVideoNote(data) + + case TypeChatActionUploadingVideoNote: + return UnmarshalChatActionUploadingVideoNote(data) + + case TypeChatActionCancel: + return UnmarshalChatActionCancel(data) + + case TypeUserStatusEmpty: + return UnmarshalUserStatusEmpty(data) + + case TypeUserStatusOnline: + return UnmarshalUserStatusOnline(data) + + case TypeUserStatusOffline: + return UnmarshalUserStatusOffline(data) + + case TypeUserStatusRecently: + return UnmarshalUserStatusRecently(data) + + case TypeUserStatusLastWeek: + return UnmarshalUserStatusLastWeek(data) + + case TypeUserStatusLastMonth: + return UnmarshalUserStatusLastMonth(data) + + case TypeStickers: + return UnmarshalStickers(data) + + case TypeEmojis: + return UnmarshalEmojis(data) + + case TypeStickerSet: + return UnmarshalStickerSet(data) + + case TypeStickerSetInfo: + return UnmarshalStickerSetInfo(data) + + case TypeStickerSets: + return UnmarshalStickerSets(data) + + case TypeCallDiscardReasonEmpty: + return UnmarshalCallDiscardReasonEmpty(data) + + case TypeCallDiscardReasonMissed: + return UnmarshalCallDiscardReasonMissed(data) + + case TypeCallDiscardReasonDeclined: + return UnmarshalCallDiscardReasonDeclined(data) + + case TypeCallDiscardReasonDisconnected: + return UnmarshalCallDiscardReasonDisconnected(data) + + case TypeCallDiscardReasonHungUp: + return UnmarshalCallDiscardReasonHungUp(data) + + case TypeCallProtocol: + return UnmarshalCallProtocol(data) + + case TypeCallServerTypeTelegramReflector: + return UnmarshalCallServerTypeTelegramReflector(data) + + case TypeCallServerTypeWebrtc: + return UnmarshalCallServerTypeWebrtc(data) + + case TypeCallServer: + return UnmarshalCallServer(data) + + case TypeCallId: + return UnmarshalCallId(data) + + case TypeCallStatePending: + return UnmarshalCallStatePending(data) + + case TypeCallStateExchangingKeys: + return UnmarshalCallStateExchangingKeys(data) + + case TypeCallStateReady: + return UnmarshalCallStateReady(data) + + case TypeCallStateHangingUp: + return UnmarshalCallStateHangingUp(data) + + case TypeCallStateDiscarded: + return UnmarshalCallStateDiscarded(data) + + case TypeCallStateError: + return UnmarshalCallStateError(data) + + case TypeCallProblemEcho: + return UnmarshalCallProblemEcho(data) + + case TypeCallProblemNoise: + return UnmarshalCallProblemNoise(data) + + case TypeCallProblemInterruptions: + return UnmarshalCallProblemInterruptions(data) + + case TypeCallProblemDistortedSpeech: + return UnmarshalCallProblemDistortedSpeech(data) + + case TypeCallProblemSilentLocal: + return UnmarshalCallProblemSilentLocal(data) + + case TypeCallProblemSilentRemote: + return UnmarshalCallProblemSilentRemote(data) + + case TypeCallProblemDropped: + return UnmarshalCallProblemDropped(data) + + case TypeCallProblemDistortedVideo: + return UnmarshalCallProblemDistortedVideo(data) + + case TypeCallProblemPixelatedVideo: + return UnmarshalCallProblemPixelatedVideo(data) + + case TypeCall: + return UnmarshalCall(data) + + case TypePhoneNumberAuthenticationSettings: + return UnmarshalPhoneNumberAuthenticationSettings(data) + + case TypeAnimations: + return UnmarshalAnimations(data) + + case TypeDiceStickersRegular: + return UnmarshalDiceStickersRegular(data) + + case TypeDiceStickersSlotMachine: + return UnmarshalDiceStickersSlotMachine(data) + + case TypeImportedContacts: + return UnmarshalImportedContacts(data) + + case TypeHttpUrl: + return UnmarshalHttpUrl(data) + + case TypeInputInlineQueryResultAnimation: + return UnmarshalInputInlineQueryResultAnimation(data) + + case TypeInputInlineQueryResultArticle: + return UnmarshalInputInlineQueryResultArticle(data) + + case TypeInputInlineQueryResultAudio: + return UnmarshalInputInlineQueryResultAudio(data) + + case TypeInputInlineQueryResultContact: + return UnmarshalInputInlineQueryResultContact(data) + + case TypeInputInlineQueryResultDocument: + return UnmarshalInputInlineQueryResultDocument(data) + + case TypeInputInlineQueryResultGame: + return UnmarshalInputInlineQueryResultGame(data) + + case TypeInputInlineQueryResultLocation: + return UnmarshalInputInlineQueryResultLocation(data) + + case TypeInputInlineQueryResultPhoto: + return UnmarshalInputInlineQueryResultPhoto(data) + + case TypeInputInlineQueryResultSticker: + return UnmarshalInputInlineQueryResultSticker(data) + + case TypeInputInlineQueryResultVenue: + return UnmarshalInputInlineQueryResultVenue(data) + + case TypeInputInlineQueryResultVideo: + return UnmarshalInputInlineQueryResultVideo(data) + + case TypeInputInlineQueryResultVoiceNote: + return UnmarshalInputInlineQueryResultVoiceNote(data) + + case TypeInlineQueryResultArticle: + return UnmarshalInlineQueryResultArticle(data) + + case TypeInlineQueryResultContact: + return UnmarshalInlineQueryResultContact(data) + + case TypeInlineQueryResultLocation: + return UnmarshalInlineQueryResultLocation(data) + + case TypeInlineQueryResultVenue: + return UnmarshalInlineQueryResultVenue(data) + + case TypeInlineQueryResultGame: + return UnmarshalInlineQueryResultGame(data) + + case TypeInlineQueryResultAnimation: + return UnmarshalInlineQueryResultAnimation(data) + + case TypeInlineQueryResultAudio: + return UnmarshalInlineQueryResultAudio(data) + + case TypeInlineQueryResultDocument: + return UnmarshalInlineQueryResultDocument(data) + + case TypeInlineQueryResultPhoto: + return UnmarshalInlineQueryResultPhoto(data) + + case TypeInlineQueryResultSticker: + return UnmarshalInlineQueryResultSticker(data) + + case TypeInlineQueryResultVideo: + return UnmarshalInlineQueryResultVideo(data) + + case TypeInlineQueryResultVoiceNote: + return UnmarshalInlineQueryResultVoiceNote(data) + + case TypeInlineQueryResults: + return UnmarshalInlineQueryResults(data) + + case TypeCallbackQueryPayloadData: + return UnmarshalCallbackQueryPayloadData(data) + + case TypeCallbackQueryPayloadDataWithPassword: + return UnmarshalCallbackQueryPayloadDataWithPassword(data) + + case TypeCallbackQueryPayloadGame: + return UnmarshalCallbackQueryPayloadGame(data) + + case TypeCallbackQueryAnswer: + return UnmarshalCallbackQueryAnswer(data) + + case TypeCustomRequestResult: + return UnmarshalCustomRequestResult(data) + + case TypeGameHighScore: + return UnmarshalGameHighScore(data) + + case TypeGameHighScores: + return UnmarshalGameHighScores(data) + + case TypeChatEventMessageEdited: + return UnmarshalChatEventMessageEdited(data) + + case TypeChatEventMessageDeleted: + return UnmarshalChatEventMessageDeleted(data) + + case TypeChatEventPollStopped: + return UnmarshalChatEventPollStopped(data) + + case TypeChatEventMessagePinned: + return UnmarshalChatEventMessagePinned(data) + + case TypeChatEventMessageUnpinned: + return UnmarshalChatEventMessageUnpinned(data) + + case TypeChatEventMemberJoined: + return UnmarshalChatEventMemberJoined(data) + + case TypeChatEventMemberLeft: + return UnmarshalChatEventMemberLeft(data) + + case TypeChatEventMemberInvited: + return UnmarshalChatEventMemberInvited(data) + + case TypeChatEventMemberPromoted: + return UnmarshalChatEventMemberPromoted(data) + + case TypeChatEventMemberRestricted: + return UnmarshalChatEventMemberRestricted(data) + + case TypeChatEventTitleChanged: + return UnmarshalChatEventTitleChanged(data) + + case TypeChatEventPermissionsChanged: + return UnmarshalChatEventPermissionsChanged(data) + + case TypeChatEventDescriptionChanged: + return UnmarshalChatEventDescriptionChanged(data) + + case TypeChatEventUsernameChanged: + return UnmarshalChatEventUsernameChanged(data) + + case TypeChatEventPhotoChanged: + return UnmarshalChatEventPhotoChanged(data) + + case TypeChatEventInvitesToggled: + return UnmarshalChatEventInvitesToggled(data) + + case TypeChatEventLinkedChatChanged: + return UnmarshalChatEventLinkedChatChanged(data) + + case TypeChatEventSlowModeDelayChanged: + return UnmarshalChatEventSlowModeDelayChanged(data) + + case TypeChatEventSignMessagesToggled: + return UnmarshalChatEventSignMessagesToggled(data) + + case TypeChatEventStickerSetChanged: + return UnmarshalChatEventStickerSetChanged(data) + + case TypeChatEventLocationChanged: + return UnmarshalChatEventLocationChanged(data) + + case TypeChatEventIsAllHistoryAvailableToggled: + return UnmarshalChatEventIsAllHistoryAvailableToggled(data) + + case TypeChatEvent: + return UnmarshalChatEvent(data) + + case TypeChatEvents: + return UnmarshalChatEvents(data) + + case TypeChatEventLogFilters: + return UnmarshalChatEventLogFilters(data) + + case TypeLanguagePackStringValueOrdinary: + return UnmarshalLanguagePackStringValueOrdinary(data) + + case TypeLanguagePackStringValuePluralized: + return UnmarshalLanguagePackStringValuePluralized(data) + + case TypeLanguagePackStringValueDeleted: + return UnmarshalLanguagePackStringValueDeleted(data) + + case TypeLanguagePackString: + return UnmarshalLanguagePackString(data) + + case TypeLanguagePackStrings: + return UnmarshalLanguagePackStrings(data) + + case TypeLanguagePackInfo: + return UnmarshalLanguagePackInfo(data) + + case TypeLocalizationTargetInfo: + return UnmarshalLocalizationTargetInfo(data) + + case TypeDeviceTokenFirebaseCloudMessaging: + return UnmarshalDeviceTokenFirebaseCloudMessaging(data) + + case TypeDeviceTokenApplePush: + return UnmarshalDeviceTokenApplePush(data) + + case TypeDeviceTokenApplePushVoIP: + return UnmarshalDeviceTokenApplePushVoIP(data) + + case TypeDeviceTokenWindowsPush: + return UnmarshalDeviceTokenWindowsPush(data) + + case TypeDeviceTokenMicrosoftPush: + return UnmarshalDeviceTokenMicrosoftPush(data) + + case TypeDeviceTokenMicrosoftPushVoIP: + return UnmarshalDeviceTokenMicrosoftPushVoIP(data) + + case TypeDeviceTokenWebPush: + return UnmarshalDeviceTokenWebPush(data) + + case TypeDeviceTokenSimplePush: + return UnmarshalDeviceTokenSimplePush(data) + + case TypeDeviceTokenUbuntuPush: + return UnmarshalDeviceTokenUbuntuPush(data) + + case TypeDeviceTokenBlackBerryPush: + return UnmarshalDeviceTokenBlackBerryPush(data) + + case TypeDeviceTokenTizenPush: + return UnmarshalDeviceTokenTizenPush(data) + + case TypePushReceiverId: + return UnmarshalPushReceiverId(data) + + case TypeBackgroundFillSolid: + return UnmarshalBackgroundFillSolid(data) + + case TypeBackgroundFillGradient: + return UnmarshalBackgroundFillGradient(data) + + case TypeBackgroundTypeWallpaper: + return UnmarshalBackgroundTypeWallpaper(data) + + case TypeBackgroundTypePattern: + return UnmarshalBackgroundTypePattern(data) + + case TypeBackgroundTypeFill: + return UnmarshalBackgroundTypeFill(data) + + case TypeBackground: + return UnmarshalBackground(data) + + case TypeBackgrounds: + return UnmarshalBackgrounds(data) + + case TypeInputBackgroundLocal: + return UnmarshalInputBackgroundLocal(data) + + case TypeInputBackgroundRemote: + return UnmarshalInputBackgroundRemote(data) + + case TypeHashtags: + return UnmarshalHashtags(data) + + case TypeCanTransferOwnershipResultOk: + return UnmarshalCanTransferOwnershipResultOk(data) + + case TypeCanTransferOwnershipResultPasswordNeeded: + return UnmarshalCanTransferOwnershipResultPasswordNeeded(data) + + case TypeCanTransferOwnershipResultPasswordTooFresh: + return UnmarshalCanTransferOwnershipResultPasswordTooFresh(data) + + case TypeCanTransferOwnershipResultSessionTooFresh: + return UnmarshalCanTransferOwnershipResultSessionTooFresh(data) + + case TypeCheckChatUsernameResultOk: + return UnmarshalCheckChatUsernameResultOk(data) + + case TypeCheckChatUsernameResultUsernameInvalid: + return UnmarshalCheckChatUsernameResultUsernameInvalid(data) + + case TypeCheckChatUsernameResultUsernameOccupied: + return UnmarshalCheckChatUsernameResultUsernameOccupied(data) + + case TypeCheckChatUsernameResultPublicChatsTooMuch: + return UnmarshalCheckChatUsernameResultPublicChatsTooMuch(data) + + case TypeCheckChatUsernameResultPublicGroupsUnavailable: + return UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(data) + + case TypePushMessageContentHidden: + return UnmarshalPushMessageContentHidden(data) + + case TypePushMessageContentAnimation: + return UnmarshalPushMessageContentAnimation(data) + + case TypePushMessageContentAudio: + return UnmarshalPushMessageContentAudio(data) + + case TypePushMessageContentContact: + return UnmarshalPushMessageContentContact(data) + + case TypePushMessageContentContactRegistered: + return UnmarshalPushMessageContentContactRegistered(data) + + case TypePushMessageContentDocument: + return UnmarshalPushMessageContentDocument(data) + + case TypePushMessageContentGame: + return UnmarshalPushMessageContentGame(data) + + case TypePushMessageContentGameScore: + return UnmarshalPushMessageContentGameScore(data) + + case TypePushMessageContentInvoice: + return UnmarshalPushMessageContentInvoice(data) + + case TypePushMessageContentLocation: + return UnmarshalPushMessageContentLocation(data) + + case TypePushMessageContentPhoto: + return UnmarshalPushMessageContentPhoto(data) + + case TypePushMessageContentPoll: + return UnmarshalPushMessageContentPoll(data) + + case TypePushMessageContentScreenshotTaken: + return UnmarshalPushMessageContentScreenshotTaken(data) + + case TypePushMessageContentSticker: + return UnmarshalPushMessageContentSticker(data) + + case TypePushMessageContentText: + return UnmarshalPushMessageContentText(data) + + case TypePushMessageContentVideo: + return UnmarshalPushMessageContentVideo(data) + + case TypePushMessageContentVideoNote: + return UnmarshalPushMessageContentVideoNote(data) + + case TypePushMessageContentVoiceNote: + return UnmarshalPushMessageContentVoiceNote(data) + + case TypePushMessageContentBasicGroupChatCreate: + return UnmarshalPushMessageContentBasicGroupChatCreate(data) + + case TypePushMessageContentChatAddMembers: + return UnmarshalPushMessageContentChatAddMembers(data) + + case TypePushMessageContentChatChangePhoto: + return UnmarshalPushMessageContentChatChangePhoto(data) + + case TypePushMessageContentChatChangeTitle: + return UnmarshalPushMessageContentChatChangeTitle(data) + + case TypePushMessageContentChatDeleteMember: + return UnmarshalPushMessageContentChatDeleteMember(data) + + case TypePushMessageContentChatJoinByLink: + return UnmarshalPushMessageContentChatJoinByLink(data) + + case TypePushMessageContentMessageForwards: + return UnmarshalPushMessageContentMessageForwards(data) + + case TypePushMessageContentMediaAlbum: + return UnmarshalPushMessageContentMediaAlbum(data) + + case TypeNotificationTypeNewMessage: + return UnmarshalNotificationTypeNewMessage(data) + + case TypeNotificationTypeNewSecretChat: + return UnmarshalNotificationTypeNewSecretChat(data) + + case TypeNotificationTypeNewCall: + return UnmarshalNotificationTypeNewCall(data) + + case TypeNotificationTypeNewPushMessage: + return UnmarshalNotificationTypeNewPushMessage(data) + + case TypeNotificationGroupTypeMessages: + return UnmarshalNotificationGroupTypeMessages(data) + + case TypeNotificationGroupTypeMentions: + return UnmarshalNotificationGroupTypeMentions(data) + + case TypeNotificationGroupTypeSecretChat: + return UnmarshalNotificationGroupTypeSecretChat(data) + + case TypeNotificationGroupTypeCalls: + return UnmarshalNotificationGroupTypeCalls(data) + + case TypeNotification: + return UnmarshalNotification(data) + + case TypeNotificationGroup: + return UnmarshalNotificationGroup(data) + + case TypeOptionValueBoolean: + return UnmarshalOptionValueBoolean(data) + + case TypeOptionValueEmpty: + return UnmarshalOptionValueEmpty(data) + + case TypeOptionValueInteger: + return UnmarshalOptionValueInteger(data) + + case TypeOptionValueString: + return UnmarshalOptionValueString(data) + + case TypeJsonObjectMember: + return UnmarshalJsonObjectMember(data) + + case TypeJsonValueNull: + return UnmarshalJsonValueNull(data) + + case TypeJsonValueBoolean: + return UnmarshalJsonValueBoolean(data) + + case TypeJsonValueNumber: + return UnmarshalJsonValueNumber(data) + + case TypeJsonValueString: + return UnmarshalJsonValueString(data) + + case TypeJsonValueArray: + return UnmarshalJsonValueArray(data) + + case TypeJsonValueObject: + return UnmarshalJsonValueObject(data) + + case TypeUserPrivacySettingRuleAllowAll: + return UnmarshalUserPrivacySettingRuleAllowAll(data) + + case TypeUserPrivacySettingRuleAllowContacts: + return UnmarshalUserPrivacySettingRuleAllowContacts(data) + + case TypeUserPrivacySettingRuleAllowUsers: + return UnmarshalUserPrivacySettingRuleAllowUsers(data) + + case TypeUserPrivacySettingRuleAllowChatMembers: + return UnmarshalUserPrivacySettingRuleAllowChatMembers(data) + + case TypeUserPrivacySettingRuleRestrictAll: + return UnmarshalUserPrivacySettingRuleRestrictAll(data) + + case TypeUserPrivacySettingRuleRestrictContacts: + return UnmarshalUserPrivacySettingRuleRestrictContacts(data) + + case TypeUserPrivacySettingRuleRestrictUsers: + return UnmarshalUserPrivacySettingRuleRestrictUsers(data) + + case TypeUserPrivacySettingRuleRestrictChatMembers: + return UnmarshalUserPrivacySettingRuleRestrictChatMembers(data) + + case TypeUserPrivacySettingRules: + return UnmarshalUserPrivacySettingRules(data) + + case TypeUserPrivacySettingShowStatus: + return UnmarshalUserPrivacySettingShowStatus(data) + + case TypeUserPrivacySettingShowProfilePhoto: + return UnmarshalUserPrivacySettingShowProfilePhoto(data) + + case TypeUserPrivacySettingShowLinkInForwardedMessages: + return UnmarshalUserPrivacySettingShowLinkInForwardedMessages(data) + + case TypeUserPrivacySettingShowPhoneNumber: + return UnmarshalUserPrivacySettingShowPhoneNumber(data) + + case TypeUserPrivacySettingAllowChatInvites: + return UnmarshalUserPrivacySettingAllowChatInvites(data) + + case TypeUserPrivacySettingAllowCalls: + return UnmarshalUserPrivacySettingAllowCalls(data) + + case TypeUserPrivacySettingAllowPeerToPeerCalls: + return UnmarshalUserPrivacySettingAllowPeerToPeerCalls(data) + + case TypeUserPrivacySettingAllowFindingByPhoneNumber: + return UnmarshalUserPrivacySettingAllowFindingByPhoneNumber(data) + + case TypeAccountTtl: + return UnmarshalAccountTtl(data) + + case TypeSession: + return UnmarshalSession(data) + + case TypeSessions: + return UnmarshalSessions(data) + + case TypeConnectedWebsite: + return UnmarshalConnectedWebsite(data) + + case TypeConnectedWebsites: + return UnmarshalConnectedWebsites(data) + + case TypeChatReportReasonSpam: + return UnmarshalChatReportReasonSpam(data) + + case TypeChatReportReasonViolence: + return UnmarshalChatReportReasonViolence(data) + + case TypeChatReportReasonPornography: + return UnmarshalChatReportReasonPornography(data) + + case TypeChatReportReasonChildAbuse: + return UnmarshalChatReportReasonChildAbuse(data) + + case TypeChatReportReasonCopyright: + return UnmarshalChatReportReasonCopyright(data) + + case TypeChatReportReasonUnrelatedLocation: + return UnmarshalChatReportReasonUnrelatedLocation(data) + + case TypeChatReportReasonCustom: + return UnmarshalChatReportReasonCustom(data) + + case TypeMessageLink: + return UnmarshalMessageLink(data) + + case TypeMessageLinkInfo: + return UnmarshalMessageLinkInfo(data) + + case TypeFilePart: + return UnmarshalFilePart(data) + + case TypeFileTypeNone: + return UnmarshalFileTypeNone(data) + + case TypeFileTypeAnimation: + return UnmarshalFileTypeAnimation(data) + + case TypeFileTypeAudio: + return UnmarshalFileTypeAudio(data) + + case TypeFileTypeDocument: + return UnmarshalFileTypeDocument(data) + + case TypeFileTypePhoto: + return UnmarshalFileTypePhoto(data) + + case TypeFileTypeProfilePhoto: + return UnmarshalFileTypeProfilePhoto(data) + + case TypeFileTypeSecret: + return UnmarshalFileTypeSecret(data) + + case TypeFileTypeSecretThumbnail: + return UnmarshalFileTypeSecretThumbnail(data) + + case TypeFileTypeSecure: + return UnmarshalFileTypeSecure(data) + + case TypeFileTypeSticker: + return UnmarshalFileTypeSticker(data) + + case TypeFileTypeThumbnail: + return UnmarshalFileTypeThumbnail(data) + + case TypeFileTypeUnknown: + return UnmarshalFileTypeUnknown(data) + + case TypeFileTypeVideo: + return UnmarshalFileTypeVideo(data) + + case TypeFileTypeVideoNote: + return UnmarshalFileTypeVideoNote(data) + + case TypeFileTypeVoiceNote: + return UnmarshalFileTypeVoiceNote(data) + + case TypeFileTypeWallpaper: + return UnmarshalFileTypeWallpaper(data) + + case TypeStorageStatisticsByFileType: + return UnmarshalStorageStatisticsByFileType(data) + + case TypeStorageStatisticsByChat: + return UnmarshalStorageStatisticsByChat(data) + + case TypeStorageStatistics: + return UnmarshalStorageStatistics(data) + + case TypeStorageStatisticsFast: + return UnmarshalStorageStatisticsFast(data) + + case TypeDatabaseStatistics: + return UnmarshalDatabaseStatistics(data) + + case TypeNetworkTypeNone: + return UnmarshalNetworkTypeNone(data) + + case TypeNetworkTypeMobile: + return UnmarshalNetworkTypeMobile(data) + + case TypeNetworkTypeMobileRoaming: + return UnmarshalNetworkTypeMobileRoaming(data) + + case TypeNetworkTypeWiFi: + return UnmarshalNetworkTypeWiFi(data) + + case TypeNetworkTypeOther: + return UnmarshalNetworkTypeOther(data) + + case TypeNetworkStatisticsEntryFile: + return UnmarshalNetworkStatisticsEntryFile(data) + + case TypeNetworkStatisticsEntryCall: + return UnmarshalNetworkStatisticsEntryCall(data) + + case TypeNetworkStatistics: + return UnmarshalNetworkStatistics(data) + + case TypeAutoDownloadSettings: + return UnmarshalAutoDownloadSettings(data) + + case TypeAutoDownloadSettingsPresets: + return UnmarshalAutoDownloadSettingsPresets(data) + + case TypeConnectionStateWaitingForNetwork: + return UnmarshalConnectionStateWaitingForNetwork(data) + + case TypeConnectionStateConnectingToProxy: + return UnmarshalConnectionStateConnectingToProxy(data) + + case TypeConnectionStateConnecting: + return UnmarshalConnectionStateConnecting(data) + + case TypeConnectionStateUpdating: + return UnmarshalConnectionStateUpdating(data) + + case TypeConnectionStateReady: + return UnmarshalConnectionStateReady(data) + + case TypeTopChatCategoryUsers: + return UnmarshalTopChatCategoryUsers(data) + + case TypeTopChatCategoryBots: + return UnmarshalTopChatCategoryBots(data) + + case TypeTopChatCategoryGroups: + return UnmarshalTopChatCategoryGroups(data) + + case TypeTopChatCategoryChannels: + return UnmarshalTopChatCategoryChannels(data) + + case TypeTopChatCategoryInlineBots: + return UnmarshalTopChatCategoryInlineBots(data) + + case TypeTopChatCategoryCalls: + return UnmarshalTopChatCategoryCalls(data) + + case TypeTopChatCategoryForwardChats: + return UnmarshalTopChatCategoryForwardChats(data) + + case TypeTMeUrlTypeUser: + return UnmarshalTMeUrlTypeUser(data) + + case TypeTMeUrlTypeSupergroup: + return UnmarshalTMeUrlTypeSupergroup(data) + + case TypeTMeUrlTypeChatInvite: + return UnmarshalTMeUrlTypeChatInvite(data) + + case TypeTMeUrlTypeStickerSet: + return UnmarshalTMeUrlTypeStickerSet(data) + + case TypeTMeUrl: + return UnmarshalTMeUrl(data) + + case TypeTMeUrls: + return UnmarshalTMeUrls(data) + + case TypeSuggestedActionEnableArchiveAndMuteNewChats: + return UnmarshalSuggestedActionEnableArchiveAndMuteNewChats(data) + + case TypeSuggestedActionCheckPhoneNumber: + return UnmarshalSuggestedActionCheckPhoneNumber(data) + + case TypeCount: + return UnmarshalCount(data) + + case TypeText: + return UnmarshalText(data) + + case TypeSeconds: + return UnmarshalSeconds(data) + + case TypeDeepLinkInfo: + return UnmarshalDeepLinkInfo(data) + + case TypeTextParseModeMarkdown: + return UnmarshalTextParseModeMarkdown(data) + + case TypeTextParseModeHTML: + return UnmarshalTextParseModeHTML(data) + + case TypeProxyTypeSocks5: + return UnmarshalProxyTypeSocks5(data) + + case TypeProxyTypeHttp: + return UnmarshalProxyTypeHttp(data) + + case TypeProxyTypeMtproto: + return UnmarshalProxyTypeMtproto(data) + + case TypeProxy: + return UnmarshalProxy(data) + + case TypeProxies: + return UnmarshalProxies(data) + + case TypeInputStickerStatic: + return UnmarshalInputStickerStatic(data) + + case TypeInputStickerAnimated: + return UnmarshalInputStickerAnimated(data) + + case TypeDateRange: + return UnmarshalDateRange(data) + + case TypeStatisticalValue: + return UnmarshalStatisticalValue(data) + + case TypeStatisticalGraphData: + return UnmarshalStatisticalGraphData(data) + + case TypeStatisticalGraphAsync: + return UnmarshalStatisticalGraphAsync(data) + + case TypeStatisticalGraphError: + return UnmarshalStatisticalGraphError(data) + + case TypeChatStatisticsMessageInteractionInfo: + return UnmarshalChatStatisticsMessageInteractionInfo(data) + + case TypeChatStatisticsMessageSenderInfo: + return UnmarshalChatStatisticsMessageSenderInfo(data) + + case TypeChatStatisticsAdministratorActionsInfo: + return UnmarshalChatStatisticsAdministratorActionsInfo(data) + + case TypeChatStatisticsInviterInfo: + return UnmarshalChatStatisticsInviterInfo(data) + + case TypeChatStatisticsSupergroup: + return UnmarshalChatStatisticsSupergroup(data) + + case TypeChatStatisticsChannel: + return UnmarshalChatStatisticsChannel(data) + + case TypeMessageStatistics: + return UnmarshalMessageStatistics(data) + + case TypeUpdateAuthorizationState: + return UnmarshalUpdateAuthorizationState(data) + + case TypeUpdateNewMessage: + return UnmarshalUpdateNewMessage(data) + + case TypeUpdateMessageSendAcknowledged: + return UnmarshalUpdateMessageSendAcknowledged(data) + + case TypeUpdateMessageSendSucceeded: + return UnmarshalUpdateMessageSendSucceeded(data) + + case TypeUpdateMessageSendFailed: + return UnmarshalUpdateMessageSendFailed(data) + + case TypeUpdateMessageContent: + return UnmarshalUpdateMessageContent(data) + + case TypeUpdateMessageEdited: + return UnmarshalUpdateMessageEdited(data) + + case TypeUpdateMessageIsPinned: + return UnmarshalUpdateMessageIsPinned(data) + + case TypeUpdateMessageInteractionInfo: + return UnmarshalUpdateMessageInteractionInfo(data) + + case TypeUpdateMessageContentOpened: + return UnmarshalUpdateMessageContentOpened(data) + + case TypeUpdateMessageMentionRead: + return UnmarshalUpdateMessageMentionRead(data) + + case TypeUpdateMessageLiveLocationViewed: + return UnmarshalUpdateMessageLiveLocationViewed(data) + + case TypeUpdateNewChat: + return UnmarshalUpdateNewChat(data) + + case TypeUpdateChatTitle: + return UnmarshalUpdateChatTitle(data) + + case TypeUpdateChatPhoto: + return UnmarshalUpdateChatPhoto(data) + + case TypeUpdateChatPermissions: + return UnmarshalUpdateChatPermissions(data) + + case TypeUpdateChatLastMessage: + return UnmarshalUpdateChatLastMessage(data) + + case TypeUpdateChatPosition: + return UnmarshalUpdateChatPosition(data) + + case TypeUpdateChatIsMarkedAsUnread: + return UnmarshalUpdateChatIsMarkedAsUnread(data) + + case TypeUpdateChatIsBlocked: + return UnmarshalUpdateChatIsBlocked(data) + + case TypeUpdateChatHasScheduledMessages: + return UnmarshalUpdateChatHasScheduledMessages(data) + + case TypeUpdateChatDefaultDisableNotification: + return UnmarshalUpdateChatDefaultDisableNotification(data) + + case TypeUpdateChatReadInbox: + return UnmarshalUpdateChatReadInbox(data) + + case TypeUpdateChatReadOutbox: + return UnmarshalUpdateChatReadOutbox(data) + + case TypeUpdateChatUnreadMentionCount: + return UnmarshalUpdateChatUnreadMentionCount(data) + + case TypeUpdateChatNotificationSettings: + return UnmarshalUpdateChatNotificationSettings(data) + + case TypeUpdateScopeNotificationSettings: + return UnmarshalUpdateScopeNotificationSettings(data) + + case TypeUpdateChatActionBar: + return UnmarshalUpdateChatActionBar(data) + + case TypeUpdateChatReplyMarkup: + return UnmarshalUpdateChatReplyMarkup(data) + + case TypeUpdateChatDraftMessage: + return UnmarshalUpdateChatDraftMessage(data) + + case TypeUpdateChatFilters: + return UnmarshalUpdateChatFilters(data) + + case TypeUpdateChatOnlineMemberCount: + return UnmarshalUpdateChatOnlineMemberCount(data) + + case TypeUpdateNotification: + return UnmarshalUpdateNotification(data) + + case TypeUpdateNotificationGroup: + return UnmarshalUpdateNotificationGroup(data) + + case TypeUpdateActiveNotifications: + return UnmarshalUpdateActiveNotifications(data) + + case TypeUpdateHavePendingNotifications: + return UnmarshalUpdateHavePendingNotifications(data) + + case TypeUpdateDeleteMessages: + return UnmarshalUpdateDeleteMessages(data) + + case TypeUpdateUserChatAction: + return UnmarshalUpdateUserChatAction(data) + + case TypeUpdateUserStatus: + return UnmarshalUpdateUserStatus(data) + + case TypeUpdateUser: + return UnmarshalUpdateUser(data) + + case TypeUpdateBasicGroup: + return UnmarshalUpdateBasicGroup(data) + + case TypeUpdateSupergroup: + return UnmarshalUpdateSupergroup(data) + + case TypeUpdateSecretChat: + return UnmarshalUpdateSecretChat(data) + + case TypeUpdateUserFullInfo: + return UnmarshalUpdateUserFullInfo(data) + + case TypeUpdateBasicGroupFullInfo: + return UnmarshalUpdateBasicGroupFullInfo(data) + + case TypeUpdateSupergroupFullInfo: + return UnmarshalUpdateSupergroupFullInfo(data) + + case TypeUpdateServiceNotification: + return UnmarshalUpdateServiceNotification(data) + + case TypeUpdateFile: + return UnmarshalUpdateFile(data) + + case TypeUpdateFileGenerationStart: + return UnmarshalUpdateFileGenerationStart(data) + + case TypeUpdateFileGenerationStop: + return UnmarshalUpdateFileGenerationStop(data) + + case TypeUpdateCall: + return UnmarshalUpdateCall(data) + + case TypeUpdateNewCallSignalingData: + return UnmarshalUpdateNewCallSignalingData(data) + + case TypeUpdateUserPrivacySettingRules: + return UnmarshalUpdateUserPrivacySettingRules(data) + + case TypeUpdateUnreadMessageCount: + return UnmarshalUpdateUnreadMessageCount(data) + + case TypeUpdateUnreadChatCount: + return UnmarshalUpdateUnreadChatCount(data) + + case TypeUpdateOption: + return UnmarshalUpdateOption(data) + + case TypeUpdateStickerSet: + return UnmarshalUpdateStickerSet(data) + + case TypeUpdateInstalledStickerSets: + return UnmarshalUpdateInstalledStickerSets(data) + + case TypeUpdateTrendingStickerSets: + return UnmarshalUpdateTrendingStickerSets(data) + + case TypeUpdateRecentStickers: + return UnmarshalUpdateRecentStickers(data) + + case TypeUpdateFavoriteStickers: + return UnmarshalUpdateFavoriteStickers(data) + + case TypeUpdateSavedAnimations: + return UnmarshalUpdateSavedAnimations(data) + + case TypeUpdateSelectedBackground: + return UnmarshalUpdateSelectedBackground(data) + + case TypeUpdateLanguagePackStrings: + return UnmarshalUpdateLanguagePackStrings(data) + + case TypeUpdateConnectionState: + return UnmarshalUpdateConnectionState(data) + + case TypeUpdateTermsOfService: + return UnmarshalUpdateTermsOfService(data) + + case TypeUpdateUsersNearby: + return UnmarshalUpdateUsersNearby(data) + + case TypeUpdateDiceEmojis: + return UnmarshalUpdateDiceEmojis(data) + + case TypeUpdateAnimationSearchParameters: + return UnmarshalUpdateAnimationSearchParameters(data) + + case TypeUpdateSuggestedActions: + return UnmarshalUpdateSuggestedActions(data) + + case TypeUpdateNewInlineQuery: + return UnmarshalUpdateNewInlineQuery(data) + + case TypeUpdateNewChosenInlineResult: + return UnmarshalUpdateNewChosenInlineResult(data) + + case TypeUpdateNewCallbackQuery: + return UnmarshalUpdateNewCallbackQuery(data) + + case TypeUpdateNewInlineCallbackQuery: + return UnmarshalUpdateNewInlineCallbackQuery(data) + + case TypeUpdateNewShippingQuery: + return UnmarshalUpdateNewShippingQuery(data) + + case TypeUpdateNewPreCheckoutQuery: + return UnmarshalUpdateNewPreCheckoutQuery(data) + + case TypeUpdateNewCustomEvent: + return UnmarshalUpdateNewCustomEvent(data) + + case TypeUpdateNewCustomQuery: + return UnmarshalUpdateNewCustomQuery(data) + + case TypeUpdatePoll: + return UnmarshalUpdatePoll(data) + + case TypeUpdatePollAnswer: + return UnmarshalUpdatePollAnswer(data) + + case TypeUpdates: + return UnmarshalUpdates(data) + + case TypeLogStreamDefault: + return UnmarshalLogStreamDefault(data) + + case TypeLogStreamFile: + return UnmarshalLogStreamFile(data) + + case TypeLogStreamEmpty: + return UnmarshalLogStreamEmpty(data) + + case TypeLogVerbosityLevel: + return UnmarshalLogVerbosityLevel(data) + + case TypeLogTags: + return UnmarshalLogTags(data) + + case TypeTestInt: + return UnmarshalTestInt(data) + + case TypeTestString: + return UnmarshalTestString(data) + + case TypeTestBytes: + return UnmarshalTestBytes(data) + + case TypeTestVectorInt: + return UnmarshalTestVectorInt(data) + + case TypeTestVectorIntObject: + return UnmarshalTestVectorIntObject(data) + + case TypeTestVectorString: + return UnmarshalTestVectorString(data) + + case TypeTestVectorStringObject: + return UnmarshalTestVectorStringObject(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} diff --git a/cmd/generate-code.go b/cmd/generate-code.go new file mode 100644 index 0000000..13abfba --- /dev/null +++ b/cmd/generate-code.go @@ -0,0 +1,86 @@ +package main + +import ( + "bufio" + "flag" + "log" + "net/http" + "os" + "path/filepath" + + "github.com/astravexton/go-tdlib/codegen" + "github.com/astravexton/go-tdlib/tlparser" +) + +type config struct { + version string + outputDirPath string + packageName string + functionFileName string + typeFileName string + unmarshalerFileName string +} + +func main() { + var config config + + flag.StringVar(&config.version, "version", "", "TDLib version") + flag.StringVar(&config.outputDirPath, "outputDir", "./tdlib", "output directory") + flag.StringVar(&config.packageName, "package", "tdlib", "package name") + flag.StringVar(&config.functionFileName, "functionFile", "function.go", "functions filename") + flag.StringVar(&config.typeFileName, "typeFile", "type.go", "types filename") + flag.StringVar(&config.unmarshalerFileName, "unmarshalerFile", "unmarshaler.go", "unmarshalers filename") + + flag.Parse() + + resp, err := http.Get("https://raw.githubusercontent.com/tdlib/td/" + config.version + "/td/generate/scheme/td_api.tl") + if err != nil { + log.Fatalf("http.Get error: %s", err) + return + } + defer resp.Body.Close() + + schema, err := tlparser.Parse(resp.Body) + if err != nil { + log.Fatalf("schema parse error: %s", err) + return + } + + err = os.MkdirAll(config.outputDirPath, 0755) + if err != nil { + log.Fatalf("error creating %s: %s", config.outputDirPath, err) + } + + functionFilePath := filepath.Join(config.outputDirPath, config.functionFileName) + + os.Remove(functionFilePath) + functionFile, err := os.OpenFile(functionFilePath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.ModePerm) + if err != nil { + log.Fatalf("functionFile open error: %s", err) + } + defer functionFile.Close() + + bufio.NewWriter(functionFile).Write(codegen.GenerateFunctions(schema, config.packageName)) + + typeFilePath := filepath.Join(config.outputDirPath, config.typeFileName) + + os.Remove(typeFilePath) + typeFile, err := os.OpenFile(typeFilePath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.ModePerm) + if err != nil { + log.Fatalf("typeFile open error: %s", err) + } + defer typeFile.Close() + + bufio.NewWriter(typeFile).Write(codegen.GenerateTypes(schema, config.packageName)) + + unmarshalerFilePath := filepath.Join(config.outputDirPath, config.unmarshalerFileName) + + os.Remove(unmarshalerFilePath) + unmarshalerFile, err := os.OpenFile(unmarshalerFilePath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.ModePerm) + if err != nil { + log.Fatalf("unmarshalerFile open error: %s", err) + } + defer unmarshalerFile.Close() + + bufio.NewWriter(unmarshalerFile).Write(codegen.GenerateUnmarshalers(schema, config.packageName)) +} diff --git a/cmd/generate-json.go b/cmd/generate-json.go new file mode 100644 index 0000000..a2e7a55 --- /dev/null +++ b/cmd/generate-json.go @@ -0,0 +1,68 @@ +package main + +import ( + "bufio" + "encoding/json" + "flag" + "log" + "net/http" + "os" + "path/filepath" + "strings" + + "github.com/astravexton/go-tdlib/tlparser" +) + +func main() { + var version string + var outputFilePath string + + flag.StringVar(&version, "version", "", "TDLib version") + flag.StringVar(&outputFilePath, "output", "./td_api.json", "json schema file") + + flag.Parse() + + resp, err := http.Get("https://raw.githubusercontent.com/tdlib/td/" + version + "/td/generate/scheme/td_api.tl") + if err != nil { + log.Fatalf("http.Get error: %s", err) + return + } + defer resp.Body.Close() + + schema, err := tlparser.Parse(resp.Body) + if err != nil { + log.Fatalf("schema parse error: %s", err) + return + } + + resp, err = http.Get("https://raw.githubusercontent.com/tdlib/td/" + version + "/td/telegram/Td.cpp") + if err != nil { + log.Fatalf("http.Get error: %s", err) + return + } + defer resp.Body.Close() + + err = tlparser.ParseCode(resp.Body, schema) + if err != nil { + log.Fatalf("parse code error: %s", err) + return + } + + err = os.MkdirAll(filepath.Dir(outputFilePath), os.ModePerm) + if err != nil { + log.Fatalf("make dir error: %s", filepath.Dir(outputFilePath)) + } + + file, err := os.OpenFile(outputFilePath, os.O_CREATE|os.O_RDWR|os.O_TRUNC, os.ModePerm) + if err != nil { + log.Fatalf("open file error: %s", err) + return + } + + data, err := json.MarshalIndent(schema, "", strings.Repeat(" ", 4)) + if err != nil { + log.Fatalf("json marshal error: %s", err) + return + } + bufio.NewWriter(file).Write(data) +} diff --git a/codegen/function.go b/codegen/function.go new file mode 100644 index 0000000..2ce5d73 --- /dev/null +++ b/codegen/function.go @@ -0,0 +1,115 @@ +package codegen + +import ( + "bytes" + "fmt" + + "github.com/astravexton/go-tdlib/tlparser" +) + +func GenerateFunctions(schema *tlparser.Schema, packageName string) []byte { + buf := bytes.NewBufferString("") + + buf.WriteString(fmt.Sprintf("%s\n\npackage %s\n\n", header, packageName)) + + buf.WriteString(`import ( + "errors" +)`) + + buf.WriteString("\n") + + for _, function := range schema.Functions { + tdlibFunction := TdlibFunction(function.Name, schema) + tdlibFunctionReturn := TdlibFunctionReturn(function.Class, schema) + + if len(function.Properties) > 0 { + buf.WriteString("\n") + buf.WriteString(fmt.Sprintf("type %sRequest struct { \n", tdlibFunction.ToGoName())) + for _, property := range function.Properties { + tdlibTypeProperty := TdlibTypeProperty(property.Name, property.Type, schema) + + buf.WriteString(fmt.Sprintf(" // %s\n", property.Description)) + buf.WriteString(fmt.Sprintf(" %s %s `json:\"%s\"`\n", tdlibTypeProperty.ToGoName(), tdlibTypeProperty.ToGoType(), property.Name)) + } + buf.WriteString("}\n") + } + + buf.WriteString("\n") + buf.WriteString("// " + function.Description) + buf.WriteString("\n") + + requestArgument := "" + if len(function.Properties) > 0 { + requestArgument = fmt.Sprintf("req *%sRequest", tdlibFunction.ToGoName()) + } + + buf.WriteString(fmt.Sprintf("func (client *Client) %s(%s) (%s, error) {\n", tdlibFunction.ToGoName(), requestArgument, tdlibFunctionReturn.ToGoReturn())) + + sendMethod := "Send" + if function.IsSynchronous { + sendMethod = "jsonClient.Execute" + } + + if len(function.Properties) > 0 { + buf.WriteString(fmt.Sprintf(` result, err := client.%s(Request{ + meta: meta{ + Type: "%s", + }, + Data: map[string]interface{}{ +`, sendMethod, function.Name)) + + for _, property := range function.Properties { + tdlibTypeProperty := TdlibTypeProperty(property.Name, property.Type, schema) + + buf.WriteString(fmt.Sprintf(" \"%s\": req.%s,\n", property.Name, tdlibTypeProperty.ToGoName())) + } + + buf.WriteString(` }, + }) +`) + } else { + buf.WriteString(fmt.Sprintf(` result, err := client.%s(Request{ + meta: meta{ + Type: "%s", + }, + Data: map[string]interface{}{}, + }) +`, sendMethod, function.Name)) + } + + buf.WriteString(` if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + +`) + + if tdlibFunctionReturn.IsClass() { + buf.WriteString(" switch result.Type {\n") + + for _, subType := range tdlibFunctionReturn.GetClass().GetSubTypes() { + buf.WriteString(fmt.Sprintf(` case %s: + return Unmarshal%s(result.Data) + +`, subType.ToTypeConst(), subType.ToGoType())) + + } + + buf.WriteString(` default: + return nil, errors.New("invalid type") +`) + + buf.WriteString(" }\n") + } else { + buf.WriteString(fmt.Sprintf(` return Unmarshal%s(result.Data) +`, tdlibFunctionReturn.ToGoType())) + } + + buf.WriteString("}\n") + } + + return buf.Bytes() +} diff --git a/codegen/header.go b/codegen/header.go new file mode 100644 index 0000000..ae694ae --- /dev/null +++ b/codegen/header.go @@ -0,0 +1,3 @@ +package codegen + +const header = "// AUTOGENERATED" diff --git a/codegen/string.go b/codegen/string.go new file mode 100644 index 0000000..0878a17 --- /dev/null +++ b/codegen/string.go @@ -0,0 +1,26 @@ +package codegen + +import ( + "strings" + "unicode" +) + +func firstUpper(str string) string { + for i, r := range str { + return string(unicode.ToUpper(r)) + str[i+1:] + } + + return str +} + +func firstLower(str string) string { + for i, r := range str { + return string(unicode.ToLower(r)) + str[i+1:] + } + + return str +} + +func underscoreToCamelCase(s string) string { + return strings.Replace(strings.Title(strings.Replace(strings.ToLower(s), "_", " ", -1)), " ", "", -1) +} diff --git a/codegen/tdlib.go b/codegen/tdlib.go new file mode 100644 index 0000000..57ac6d2 --- /dev/null +++ b/codegen/tdlib.go @@ -0,0 +1,487 @@ +package codegen + +import ( + "log" + "strings" + + "github.com/astravexton/go-tdlib/tlparser" +) + +type tdlibFunction struct { + name string + schema *tlparser.Schema +} + +func TdlibFunction(name string, schema *tlparser.Schema) *tdlibFunction { + return &tdlibFunction{ + name: name, + schema: schema, + } +} + +func (entity *tdlibFunction) ToGoName() string { + return firstUpper(entity.name) +} + +type tdlibFunctionReturn struct { + name string + schema *tlparser.Schema +} + +func TdlibFunctionReturn(name string, schema *tlparser.Schema) *tdlibFunctionReturn { + return &tdlibFunctionReturn{ + name: name, + schema: schema, + } +} + +func (entity *tdlibFunctionReturn) IsType() bool { + return isType(entity.name, func(entity *tlparser.Type) string { + return entity.Class + }, entity.schema) +} + +func (entity *tdlibFunctionReturn) GetType() *tdlibType { + return getType(entity.name, func(entity *tlparser.Type) string { + return entity.Class + }, entity.schema) +} + +func (entity *tdlibFunctionReturn) IsClass() bool { + return isClass(entity.name, func(entity *tlparser.Class) string { + return entity.Name + }, entity.schema) +} + +func (entity *tdlibFunctionReturn) GetClass() *tdlibClass { + return getClass(entity.name, func(entity *tlparser.Class) string { + return entity.Name + }, entity.schema) +} + +func (entity *tdlibFunctionReturn) ToGoReturn() string { + if strings.HasPrefix(entity.name, "vector<") { + log.Fatal("vectors are not supported") + } + + if entity.IsClass() { + return entity.GetClass().ToGoType() + } + + if entity.GetType().IsInternal() { + return entity.GetType().ToGoType() + } + + return "*" + entity.GetType().ToGoType() +} + +func (entity *tdlibFunctionReturn) ToGoType() string { + if strings.HasPrefix(entity.name, "vector<") { + log.Fatal("vectors are not supported") + } + + if entity.IsClass() { + return entity.GetClass().ToGoType() + } + + return entity.GetType().ToGoType() +} + +type tdlibFunctionProperty struct { + name string + propertyType string + schema *tlparser.Schema +} + +func TdlibFunctionProperty(name string, propertyType string, schema *tlparser.Schema) *tdlibFunctionProperty { + return &tdlibFunctionProperty{ + name: name, + propertyType: propertyType, + schema: schema, + } +} + +func (entity *tdlibFunctionProperty) GetPrimitive() string { + primitive := entity.propertyType + + for strings.HasPrefix(primitive, "vector<") { + primitive = strings.TrimSuffix(strings.TrimPrefix(primitive, "vector<"), ">") + } + + return primitive +} + +func (entity *tdlibFunctionProperty) IsType() bool { + primitive := entity.GetPrimitive() + return isType(primitive, func(entity *tlparser.Type) string { + return entity.Name + }, entity.schema) +} + +func (entity *tdlibFunctionProperty) GetType() *tdlibType { + primitive := entity.GetPrimitive() + return getType(primitive, func(entity *tlparser.Type) string { + return entity.Name + }, entity.schema) +} + +func (entity *tdlibFunctionProperty) IsClass() bool { + primitive := entity.GetPrimitive() + return isClass(primitive, func(entity *tlparser.Class) string { + return entity.Name + }, entity.schema) +} + +func (entity *tdlibFunctionProperty) GetClass() *tdlibClass { + primitive := entity.GetPrimitive() + return getClass(primitive, func(entity *tlparser.Class) string { + return entity.Name + }, entity.schema) +} + +func (entity *tdlibFunctionProperty) ToGoName() string { + name := firstLower(underscoreToCamelCase(entity.name)) + if name == "type" { + name += "Param" + } + + return name +} + +func (entity *tdlibFunctionProperty) ToGoType() string { + tdlibType := entity.propertyType + goType := "" + + for strings.HasPrefix(tdlibType, "vector<") { + goType = goType + "[]" + tdlibType = strings.TrimSuffix(strings.TrimPrefix(tdlibType, "vector<"), ">") + } + + if entity.IsClass() { + return goType + entity.GetClass().ToGoType() + } + + if entity.GetType().IsInternal() { + return goType + entity.GetType().ToGoType() + } + + return goType + "*" + entity.GetType().ToGoType() +} + +type tdlibType struct { + name string + schema *tlparser.Schema +} + +func TdlibType(name string, schema *tlparser.Schema) *tdlibType { + return &tdlibType{ + name: name, + schema: schema, + } +} + +func (entity *tdlibType) IsInternal() bool { + switch entity.name { + case "double": + return true + + case "string": + return true + + case "int32": + return true + + case "int53": + return true + + case "int64": + return true + + case "bytes": + return true + + case "boolFalse": + return true + + case "boolTrue": + return true + + case "vector": + return true + } + + return false +} + +func (entity *tdlibType) GetType() *tlparser.Type { + name := normalizeEntityName(entity.name) + for _, typ := range entity.schema.Types { + if typ.Name == name { + return typ + } + } + return nil +} + +func (entity *tdlibType) ToGoType() string { + if strings.HasPrefix(entity.name, "vector<") { + log.Fatal("vectors are not supported") + } + + switch entity.name { + case "double": + return "float64" + + case "string": + return "string" + + case "int32": + return "int32" + + case "int53": + return "int64" + + case "int64": + return "JsonInt64" + + case "bytes": + return "[]byte" + + case "boolFalse": + return "bool" + + case "boolTrue": + return "bool" + } + + return firstUpper(entity.name) +} + +func (entity *tdlibType) ToType() string { + return entity.ToGoType() + "Type" +} + +func (entity *tdlibType) HasClass() bool { + className := entity.GetType().Class + for _, class := range entity.schema.Classes { + if class.Name == className { + return true + } + } + + return false +} + +func (entity *tdlibType) GetClass() *tlparser.Class { + className := entity.GetType().Class + for _, class := range entity.schema.Classes { + if class.Name == className { + return class + } + } + + return nil +} + +func (entity *tdlibType) HasClassProperties() bool { + for _, prop := range entity.GetType().Properties { + tdlibTypeProperty := TdlibTypeProperty(prop.Name, prop.Type, entity.schema) + if tdlibTypeProperty.IsClass() { + return true + } + } + + return false +} + +func (entity *tdlibType) IsList() bool { + return strings.HasPrefix(entity.name, "vector<") +} + +func (entity *tdlibType) ToClassConst() string { + if entity.HasClass() { + return "Class" + TdlibClass(entity.GetType().Class, entity.schema).ToGoType() + } + return "Class" + entity.ToGoType() +} + +func (entity *tdlibType) ToTypeConst() string { + return "Type" + entity.ToGoType() +} + +type tdlibClass struct { + name string + schema *tlparser.Schema +} + +func TdlibClass(name string, schema *tlparser.Schema) *tdlibClass { + return &tdlibClass{ + name: name, + schema: schema, + } +} + +func (entity *tdlibClass) ToGoType() string { + return firstUpper(entity.name) +} + +func (entity *tdlibClass) ToType() string { + return entity.ToGoType() + "Type" +} + +func (entity *tdlibClass) GetSubTypes() []*tdlibType { + types := []*tdlibType{} + + for _, t := range entity.schema.Types { + if t.Class == entity.name { + types = append(types, TdlibType(t.Name, entity.schema)) + } + } + + return types +} + +func (entity *tdlibClass) ToClassConst() string { + return "Class" + entity.ToGoType() +} + +type tdlibTypeProperty struct { + name string + propertyType string + schema *tlparser.Schema +} + +func TdlibTypeProperty(name string, propertyType string, schema *tlparser.Schema) *tdlibTypeProperty { + return &tdlibTypeProperty{ + name: name, + propertyType: propertyType, + schema: schema, + } +} + +func (entity *tdlibTypeProperty) IsList() bool { + return strings.HasPrefix(entity.propertyType, "vector<") +} + +func (entity *tdlibTypeProperty) GetPrimitive() string { + primitive := entity.propertyType + + for strings.HasPrefix(primitive, "vector<") { + primitive = strings.TrimSuffix(strings.TrimPrefix(primitive, "vector<"), ">") + } + + return primitive +} + +func (entity *tdlibTypeProperty) IsType() bool { + primitive := entity.GetPrimitive() + return isType(primitive, func(entity *tlparser.Type) string { + return entity.Name + }, entity.schema) +} + +func (entity *tdlibTypeProperty) GetType() *tdlibType { + primitive := entity.GetPrimitive() + return getType(primitive, func(entity *tlparser.Type) string { + return entity.Name + }, entity.schema) +} + +func (entity *tdlibTypeProperty) IsClass() bool { + primitive := entity.GetPrimitive() + return isClass(primitive, func(entity *tlparser.Class) string { + return entity.Name + }, entity.schema) +} + +func (entity *tdlibTypeProperty) GetClass() *tdlibClass { + primitive := entity.GetPrimitive() + return getClass(primitive, func(entity *tlparser.Class) string { + return entity.Name + }, entity.schema) +} + +func (entity *tdlibTypeProperty) ToGoName() string { + return firstUpper(underscoreToCamelCase(entity.name)) +} + +func (entity *tdlibTypeProperty) ToGoFunctionPropertyName() string { + name := firstLower(underscoreToCamelCase(entity.name)) + if name == "type" { + name += "Param" + } + + return name +} + +func (entity *tdlibTypeProperty) ToGoType() string { + tdlibType := entity.propertyType + goType := "" + + for strings.HasPrefix(tdlibType, "vector<") { + goType = goType + "[]" + tdlibType = strings.TrimSuffix(strings.TrimPrefix(tdlibType, "vector<"), ">") + } + + if entity.IsClass() { + return goType + entity.GetClass().ToGoType() + } + + if entity.GetType().IsInternal() { + return goType + entity.GetType().ToGoType() + } + + return goType + "*" + entity.GetType().ToGoType() +} + +func isType(name string, field func(entity *tlparser.Type) string, schema *tlparser.Schema) bool { + name = normalizeEntityName(name) + for _, entity := range schema.Types { + if name == field(entity) { + return true + } + } + + return false +} + +func getType(name string, field func(entity *tlparser.Type) string, schema *tlparser.Schema) *tdlibType { + name = normalizeEntityName(name) + for _, entity := range schema.Types { + if name == field(entity) { + return TdlibType(entity.Name, schema) + } + } + + return nil +} + +func isClass(name string, field func(entity *tlparser.Class) string, schema *tlparser.Schema) bool { + name = normalizeEntityName(name) + for _, entity := range schema.Classes { + if name == field(entity) { + return true + } + } + + return false +} + +func getClass(name string, field func(entity *tlparser.Class) string, schema *tlparser.Schema) *tdlibClass { + name = normalizeEntityName(name) + for _, entity := range schema.Classes { + if name == field(entity) { + return TdlibClass(entity.Name, schema) + } + } + + return nil +} + +func normalizeEntityName(name string) string { + if name == "Bool" { + name = "boolFalse" + } + + return name +} diff --git a/codegen/type.go b/codegen/type.go new file mode 100644 index 0000000..418a06b --- /dev/null +++ b/codegen/type.go @@ -0,0 +1,186 @@ +package codegen + +import ( + "bytes" + "fmt" + + "github.com/astravexton/go-tdlib/tlparser" +) + +func GenerateTypes(schema *tlparser.Schema, packageName string) []byte { + buf := bytes.NewBufferString("") + + buf.WriteString(fmt.Sprintf("%s\n\npackage %s\n\n", header, packageName)) + + buf.WriteString(`import ( + "encoding/json" +) + +`) + + buf.WriteString("const (\n") + for _, entity := range schema.Classes { + tdlibClass := TdlibClass(entity.Name, schema) + buf.WriteString(fmt.Sprintf(" %s = %q\n", tdlibClass.ToClassConst(), entity.Name)) + } + for _, entity := range schema.Types { + tdlibType := TdlibType(entity.Name, schema) + if tdlibType.IsInternal() || tdlibType.HasClass() { + continue + } + buf.WriteString(fmt.Sprintf(" %s = %q\n", tdlibType.ToClassConst(), entity.Class)) + } + buf.WriteString(")") + + buf.WriteString("\n\n") + + buf.WriteString("const (\n") + for _, entity := range schema.Types { + tdlibType := TdlibType(entity.Name, schema) + if tdlibType.IsInternal() { + continue + } + buf.WriteString(fmt.Sprintf(" %s = %q\n", tdlibType.ToTypeConst(), entity.Name)) + } + buf.WriteString(")") + + buf.WriteString("\n\n") + + for _, class := range schema.Classes { + tdlibClass := TdlibClass(class.Name, schema) + + buf.WriteString(fmt.Sprintf(`// %s +type %s interface { + %sType() string +} + +`, class.Description, tdlibClass.ToGoType(), tdlibClass.ToGoType())) + } + + for _, typ := range schema.Types { + tdlibType := TdlibType(typ.Name, schema) + if tdlibType.IsInternal() { + continue + } + + buf.WriteString("// " + typ.Description + "\n") + + if len(typ.Properties) > 0 { + buf.WriteString(`type ` + tdlibType.ToGoType() + ` struct { + meta +`) + for _, property := range typ.Properties { + tdlibTypeProperty := TdlibTypeProperty(property.Name, property.Type, schema) + + buf.WriteString(fmt.Sprintf(" // %s\n", property.Description)) + buf.WriteString(fmt.Sprintf(" %s %s `json:\"%s\"`\n", tdlibTypeProperty.ToGoName(), tdlibTypeProperty.ToGoType(), property.Name)) + } + + buf.WriteString("}\n\n") + } else { + buf.WriteString(`type ` + tdlibType.ToGoType() + ` struct{ + meta +} + +`) + } + + buf.WriteString(fmt.Sprintf(`func (entity *%s) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub %s + + return json.Marshal((*stub)(entity)) +} + +`, tdlibType.ToGoType(), tdlibType.ToGoType())) + + buf.WriteString(fmt.Sprintf(`func (*%s) GetClass() string { + return %s +} + +func (*%s) GetType() string { + return %s +} + +`, tdlibType.ToGoType(), tdlibType.ToClassConst(), tdlibType.ToGoType(), tdlibType.ToTypeConst())) + + if tdlibType.HasClass() { + tdlibClass := TdlibClass(tdlibType.GetClass().Name, schema) + + buf.WriteString(fmt.Sprintf(`func (*%s) %sType() string { + return %s +} + +`, tdlibType.ToGoType(), tdlibClass.ToGoType(), tdlibType.ToTypeConst())) + } + + if tdlibType.HasClassProperties() { + buf.WriteString(fmt.Sprintf(`func (%s *%s) UnmarshalJSON(data []byte) error { + var tmp struct { +`, typ.Name, tdlibType.ToGoType())) + + var countSimpleProperties int + + for _, property := range typ.Properties { + tdlibTypeProperty := TdlibTypeProperty(property.Name, property.Type, schema) + + if !tdlibTypeProperty.IsClass() { + buf.WriteString(fmt.Sprintf(" %s %s `json:\"%s\"`\n", tdlibTypeProperty.ToGoName(), tdlibTypeProperty.ToGoType(), property.Name)) + countSimpleProperties++ + } else { + if tdlibTypeProperty.IsList() { + buf.WriteString(fmt.Sprintf(" %s %s `json:\"%s\"`\n", tdlibTypeProperty.ToGoName(), "[]json.RawMessage", property.Name)) + } else { + buf.WriteString(fmt.Sprintf(" %s %s `json:\"%s\"`\n", tdlibTypeProperty.ToGoName(), "json.RawMessage", property.Name)) + } + } + } + + buf.WriteString(` } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + +`) + + for _, property := range typ.Properties { + tdlibTypeProperty := TdlibTypeProperty(property.Name, property.Type, schema) + + if !tdlibTypeProperty.IsClass() { + buf.WriteString(fmt.Sprintf(" %s.%s = tmp.%s\n", typ.Name, tdlibTypeProperty.ToGoName(), tdlibTypeProperty.ToGoName())) + } + } + + if countSimpleProperties > 0 { + buf.WriteString("\n") + } + + for _, property := range typ.Properties { + tdlibTypeProperty := TdlibTypeProperty(property.Name, property.Type, schema) + + if tdlibTypeProperty.IsClass() && !tdlibTypeProperty.IsList() { + buf.WriteString(fmt.Sprintf(` field%s, _ := Unmarshal%s(tmp.%s) + %s.%s = field%s + +`, tdlibTypeProperty.ToGoName(), tdlibTypeProperty.ToGoType(), tdlibTypeProperty.ToGoName(), typ.Name, tdlibTypeProperty.ToGoName(), tdlibTypeProperty.ToGoName())) + } + if tdlibTypeProperty.IsClass() && tdlibTypeProperty.IsList() { + buf.WriteString(fmt.Sprintf(` field%s, _ := UnmarshalListOf%s(tmp.%s) + %s.%s = field%s + +`, tdlibTypeProperty.ToGoName(), tdlibTypeProperty.GetClass().ToGoType(), tdlibTypeProperty.ToGoName(), typ.Name, tdlibTypeProperty.ToGoName(), tdlibTypeProperty.ToGoName())) + } + } + + buf.WriteString(` return nil +} + +`) + } + } + + return buf.Bytes() +} diff --git a/codegen/unmarshaler.go b/codegen/unmarshaler.go new file mode 100644 index 0000000..ad439d8 --- /dev/null +++ b/codegen/unmarshaler.go @@ -0,0 +1,120 @@ +package codegen + +import ( + "bytes" + "fmt" + + "github.com/astravexton/go-tdlib/tlparser" +) + +func GenerateUnmarshalers(schema *tlparser.Schema, packageName string) []byte { + buf := bytes.NewBufferString("") + + buf.WriteString(fmt.Sprintf("%s\n\npackage %s\n\n", header, packageName)) + + buf.WriteString(`import ( + "encoding/json" + "fmt" +) + +`) + + for _, class := range schema.Classes { + tdlibClass := TdlibClass(class.Name, schema) + + buf.WriteString(fmt.Sprintf(`func Unmarshal%s(data json.RawMessage) (%s, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { +`, tdlibClass.ToGoType(), tdlibClass.ToGoType())) + + for _, subType := range tdlibClass.GetSubTypes() { + buf.WriteString(fmt.Sprintf(` case %s: + return Unmarshal%s(data) + +`, subType.ToTypeConst(), subType.ToGoType())) + + } + + buf.WriteString(` default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +`) + + buf.WriteString(fmt.Sprintf(`func UnmarshalListOf%s(dataList []json.RawMessage) ([]%s, error) { + list := []%s{} + + for _, data := range dataList { + entity, err := Unmarshal%s(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +`, tdlibClass.ToGoType(), tdlibClass.ToGoType(), tdlibClass.ToGoType(), tdlibClass.ToGoType())) + + } + + for _, typ := range schema.Types { + tdlibType := TdlibType(typ.Name, schema) + + if tdlibType.IsList() || tdlibType.IsInternal() { + continue + } + + buf.WriteString(fmt.Sprintf(`func Unmarshal%s(data json.RawMessage) (*%s, error) { + var resp %s + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +`, tdlibType.ToGoType(), tdlibType.ToGoType(), tdlibType.ToGoType())) + + } + + buf.WriteString(`func UnmarshalType(data json.RawMessage) (Type, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { +`) + + for _, typ := range schema.Types { + tdlibType := TdlibType(typ.Name, schema) + + if tdlibType.IsList() || tdlibType.IsInternal() { + continue + } + + buf.WriteString(fmt.Sprintf(` case %s: + return Unmarshal%s(data) + +`, tdlibType.ToTypeConst(), tdlibType.ToGoType())) + + } + + buf.WriteString(` default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} +`) + + return buf.Bytes() +} diff --git a/data/td_api.json b/data/td_api.json new file mode 100755 index 0000000..b12d47e --- /dev/null +++ b/data/td_api.json @@ -0,0 +1,21961 @@ +{ + "types": [ + { + "name": "double", + "description": "", + "class": "Double", + "properties": [] + }, + { + "name": "string", + "description": "", + "class": "String", + "properties": [] + }, + { + "name": "int32", + "description": "", + "class": "Int32", + "properties": [] + }, + { + "name": "int53", + "description": "", + "class": "Int53", + "properties": [] + }, + { + "name": "int64", + "description": "", + "class": "Int64", + "properties": [] + }, + { + "name": "bytes", + "description": "", + "class": "Bytes", + "properties": [] + }, + { + "name": "boolFalse", + "description": "", + "class": "Bool", + "properties": [] + }, + { + "name": "boolTrue", + "description": "", + "class": "Bool", + "properties": [] + }, + { + "name": "vector\u003ct\u003e", + "description": "", + "class": "Vector\u003cT\u003e", + "properties": [] + }, + { + "name": "error", + "description": "An object of this type can be returned on every function call, in case of an error", + "class": "Error", + "properties": [ + { + "name": "code", + "type": "int32", + "description": "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" + }, + { + "name": "message", + "type": "string", + "description": "Error message; subject to future changes" + } + ] + }, + { + "name": "ok", + "description": "An object of this type is returned on a successful function call for certain functions", + "class": "Ok", + "properties": [] + }, + { + "name": "tdlibParameters", + "description": "Contains parameters for TDLib initialization", + "class": "TdlibParameters", + "properties": [ + { + "name": "use_test_dc", + "type": "Bool", + "description": "If set to true, the Telegram test environment will be used instead of the production environment" + }, + { + "name": "database_directory", + "type": "string", + "description": "The path to the directory for the persistent database; if empty, the current working directory will be used" + }, + { + "name": "files_directory", + "type": "string", + "description": "The path to the directory for storing files; if empty, database_directory will be used" + }, + { + "name": "use_file_database", + "type": "Bool", + "description": "If set to true, information about downloaded and uploaded files will be saved between application restarts" + }, + { + "name": "use_chat_info_database", + "type": "Bool", + "description": "If set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. Implies use_file_database" + }, + { + "name": "use_message_database", + "type": "Bool", + "description": "If set to true, the library will maintain a cache of chats and messages. Implies use_chat_info_database" + }, + { + "name": "use_secret_chats", + "type": "Bool", + "description": "If set to true, support for secret chats will be enabled" + }, + { + "name": "api_id", + "type": "int32", + "description": "Application identifier for Telegram API access, which can be obtained at https://my.telegram.org" + }, + { + "name": "api_hash", + "type": "string", + "description": "Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org" + }, + { + "name": "system_language_code", + "type": "string", + "description": "IETF language tag of the user's operating system language; must be non-empty" + }, + { + "name": "device_model", + "type": "string", + "description": "Model of the device the application is being run on; must be non-empty" + }, + { + "name": "system_version", + "type": "string", + "description": "Version of the operating system the application is being run on. If empty, the version is automatically detected by TDLib" + }, + { + "name": "application_version", + "type": "string", + "description": "Application version; must be non-empty" + }, + { + "name": "enable_storage_optimizer", + "type": "Bool", + "description": "If set to true, old files will automatically be deleted" + }, + { + "name": "ignore_file_names", + "type": "Bool", + "description": "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" + } + ] + }, + { + "name": "authenticationCodeTypeTelegramMessage", + "description": "An authentication code is delivered via a private Telegram message, which can be viewed from another active session", + "class": "AuthenticationCodeType", + "properties": [ + { + "name": "length", + "type": "int32", + "description": "Length of the code" + } + ] + }, + { + "name": "authenticationCodeTypeSms", + "description": "An authentication code is delivered via an SMS message to the specified phone number", + "class": "AuthenticationCodeType", + "properties": [ + { + "name": "length", + "type": "int32", + "description": "Length of the code" + } + ] + }, + { + "name": "authenticationCodeTypeCall", + "description": "An authentication code is delivered via a phone call to the specified phone number", + "class": "AuthenticationCodeType", + "properties": [ + { + "name": "length", + "type": "int32", + "description": "Length of the code" + } + ] + }, + { + "name": "authenticationCodeTypeFlashCall", + "description": "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", + "class": "AuthenticationCodeType", + "properties": [ + { + "name": "pattern", + "type": "string", + "description": "Pattern of the phone number from which the call will be made" + } + ] + }, + { + "name": "authenticationCodeInfo", + "description": "Information about the authentication code that was sent", + "class": "AuthenticationCodeInfo", + "properties": [ + { + "name": "phone_number", + "type": "string", + "description": "A phone number that is being authenticated" + }, + { + "name": "type", + "type": "AuthenticationCodeType", + "description": "Describes the way the code was sent to the user" + }, + { + "name": "next_type", + "type": "AuthenticationCodeType", + "description": "Describes the way the next code will be sent to the user; may be null" + }, + { + "name": "timeout", + "type": "int32", + "description": "Timeout before the code should be re-sent, in seconds" + } + ] + }, + { + "name": "emailAddressAuthenticationCodeInfo", + "description": "Information about the email address authentication code that was sent", + "class": "EmailAddressAuthenticationCodeInfo", + "properties": [ + { + "name": "email_address_pattern", + "type": "string", + "description": "Pattern of the email address to which an authentication code was sent" + }, + { + "name": "length", + "type": "int32", + "description": "Length of the code; 0 if unknown" + } + ] + }, + { + "name": "textEntity", + "description": "Represents a part of the text that needs to be formatted in some unusual way", + "class": "TextEntity", + "properties": [ + { + "name": "offset", + "type": "int32", + "description": "Offset of the entity, in UTF-16 code units" + }, + { + "name": "length", + "type": "int32", + "description": "Length of the entity, in UTF-16 code units" + }, + { + "name": "type", + "type": "TextEntityType", + "description": "Type of the entity" + } + ] + }, + { + "name": "textEntities", + "description": "Contains a list of text entities", + "class": "TextEntities", + "properties": [ + { + "name": "entities", + "type": "vector\u003ctextEntity\u003e", + "description": "List of text entities" + } + ] + }, + { + "name": "formattedText", + "description": "A text with some entities", + "class": "FormattedText", + "properties": [ + { + "name": "text", + "type": "string", + "description": "The text" + }, + { + "name": "entities", + "type": "vector\u003ctextEntity\u003e", + "description": "Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. Pre, Code and PreCode entities can't contain other entities. Bold, Italic, Underline and Strikethrough entities can contain and to be contained in all other entities. All other entities can't contain each other" + } + ] + }, + { + "name": "termsOfService", + "description": "Contains Telegram terms of service", + "class": "TermsOfService", + "properties": [ + { + "name": "text", + "type": "formattedText", + "description": "Text of the terms of service" + }, + { + "name": "min_user_age", + "type": "int32", + "description": "The minimum age of a user to be able to accept the terms; 0 if any" + }, + { + "name": "show_popup", + "type": "Bool", + "description": "True, if a blocking popup with terms of service must be shown to the user" + } + ] + }, + { + "name": "authorizationStateWaitTdlibParameters", + "description": "TDLib needs TdlibParameters for initialization", + "class": "AuthorizationState", + "properties": [] + }, + { + "name": "authorizationStateWaitEncryptionKey", + "description": "TDLib needs an encryption key to decrypt the local database", + "class": "AuthorizationState", + "properties": [ + { + "name": "is_encrypted", + "type": "Bool", + "description": "True, if the database is currently encrypted" + } + ] + }, + { + "name": "authorizationStateWaitPhoneNumber", + "description": "TDLib needs the user's phone number to authorize. Call `setAuthenticationPhoneNumber` to provide the phone number, or use `requestQrCodeAuthentication`, or `checkAuthenticationBotToken` for other authentication options", + "class": "AuthorizationState", + "properties": [] + }, + { + "name": "authorizationStateWaitCode", + "description": "TDLib needs the user's authentication code to authorize", + "class": "AuthorizationState", + "properties": [ + { + "name": "code_info", + "type": "authenticationCodeInfo", + "description": "Information about the authorization code that was sent" + } + ] + }, + { + "name": "authorizationStateWaitOtherDeviceConfirmation", + "description": "The user needs to confirm authorization on another logged in device by scanning a QR code with the provided link", + "class": "AuthorizationState", + "properties": [ + { + "name": "link", + "type": "string", + "description": "A tg:// URL for the QR code. The link will be updated frequently" + } + ] + }, + { + "name": "authorizationStateWaitRegistration", + "description": "The user is unregistered and need to accept terms of service and enter their first name and last name to finish registration", + "class": "AuthorizationState", + "properties": [ + { + "name": "terms_of_service", + "type": "termsOfService", + "description": "Telegram terms of service" + } + ] + }, + { + "name": "authorizationStateWaitPassword", + "description": "The user has been authorized, but needs to enter a password to start using the application", + "class": "AuthorizationState", + "properties": [ + { + "name": "password_hint", + "type": "string", + "description": "Hint for the password; may be empty" + }, + { + "name": "has_recovery_email_address", + "type": "Bool", + "description": "True, if a recovery email address has been set up" + }, + { + "name": "recovery_email_address_pattern", + "type": "string", + "description": "Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent" + } + ] + }, + { + "name": "authorizationStateReady", + "description": "The user has been successfully authorized. TDLib is now ready to answer queries", + "class": "AuthorizationState", + "properties": [] + }, + { + "name": "authorizationStateLoggingOut", + "description": "The user is currently logging out", + "class": "AuthorizationState", + "properties": [] + }, + { + "name": "authorizationStateClosing", + "description": "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", + "class": "AuthorizationState", + "properties": [] + }, + { + "name": "authorizationStateClosed", + "description": "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", + "class": "AuthorizationState", + "properties": [] + }, + { + "name": "passwordState", + "description": "Represents the current state of 2-step verification", + "class": "PasswordState", + "properties": [ + { + "name": "has_password", + "type": "Bool", + "description": "True, if a 2-step verification password is set" + }, + { + "name": "password_hint", + "type": "string", + "description": "Hint for the password; may be empty" + }, + { + "name": "has_recovery_email_address", + "type": "Bool", + "description": "True, if a recovery email is set" + }, + { + "name": "has_passport_data", + "type": "Bool", + "description": "True, if some Telegram Passport elements were saved" + }, + { + "name": "recovery_email_address_code_info", + "type": "emailAddressAuthenticationCodeInfo", + "description": "Information about the recovery email address to which the confirmation email was sent; may be null" + } + ] + }, + { + "name": "recoveryEmailAddress", + "description": "Contains information about the current recovery email address", + "class": "RecoveryEmailAddress", + "properties": [ + { + "name": "recovery_email_address", + "type": "string", + "description": "Recovery email address" + } + ] + }, + { + "name": "temporaryPasswordState", + "description": "Returns information about the availability of a temporary password, which can be used for payments", + "class": "TemporaryPasswordState", + "properties": [ + { + "name": "has_password", + "type": "Bool", + "description": "True, if a temporary password is available" + }, + { + "name": "valid_for", + "type": "int32", + "description": "Time left before the temporary password expires, in seconds" + } + ] + }, + { + "name": "localFile", + "description": "Represents a local file", + "class": "LocalFile", + "properties": [ + { + "name": "path", + "type": "string", + "description": "Local path to the locally available file part; may be empty" + }, + { + "name": "can_be_downloaded", + "type": "Bool", + "description": "True, if it is possible to try to download or generate the file" + }, + { + "name": "can_be_deleted", + "type": "Bool", + "description": "True, if the file can be deleted" + }, + { + "name": "is_downloading_active", + "type": "Bool", + "description": "True, if the file is currently being downloaded (or a local copy is being generated by some other means)" + }, + { + "name": "is_downloading_completed", + "type": "Bool", + "description": "True, if the local copy is fully available" + }, + { + "name": "download_offset", + "type": "int32", + "description": "Download will be started from this offset. downloaded_prefix_size is calculated from this offset" + }, + { + "name": "downloaded_prefix_size", + "type": "int32", + "description": "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" + }, + { + "name": "downloaded_size", + "type": "int32", + "description": "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" + } + ] + }, + { + "name": "remoteFile", + "description": "Represents a remote file", + "class": "RemoteFile", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Remote file identifier; may be empty. Can be used by the current user across application restarts or even from other devices. Uniquely identifies a file, but a file can have a lot of different valid identifiers. 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 application with the HTTP URL in the original_path and \"#url#\" as the conversion string. Application should generate the file by downloading it to the specified location" + }, + { + "name": "unique_id", + "type": "string", + "description": "Unique file identifier; may be empty if unknown. The unique file identifier which is the same for the same file even for different users and is persistent over time" + }, + { + "name": "is_uploading_active", + "type": "Bool", + "description": "True, if the file is currently being uploaded (or a remote copy is being generated by some other means)" + }, + { + "name": "is_uploading_completed", + "type": "Bool", + "description": "True, if a remote copy is fully available" + }, + { + "name": "uploaded_size", + "type": "int32", + "description": "Size of the remote available part of the file; 0 if unknown" + } + ] + }, + { + "name": "file", + "description": "Represents a file", + "class": "File", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Unique file identifier" + }, + { + "name": "size", + "type": "int32", + "description": "File size; 0 if unknown" + }, + { + "name": "expected_size", + "type": "int32", + "description": "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" + }, + { + "name": "local", + "type": "localFile", + "description": "Information about the local copy of the file" + }, + { + "name": "remote", + "type": "remoteFile", + "description": "Information about the remote copy of the file" + } + ] + }, + { + "name": "inputFileId", + "description": "A file defined by its unique ID", + "class": "InputFile", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Unique file identifier" + } + ] + }, + { + "name": "inputFileRemote", + "description": "A file defined by its remote ID. The remote ID is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application", + "class": "InputFile", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Remote file identifier" + } + ] + }, + { + "name": "inputFileLocal", + "description": "A file defined by a local path", + "class": "InputFile", + "properties": [ + { + "name": "path", + "type": "string", + "description": "Local path to the file" + } + ] + }, + { + "name": "inputFileGenerated", + "description": "A file generated by the application", + "class": "InputFile", + "properties": [ + { + "name": "original_path", + "type": "string", + "description": "Local path to a file from which the file is generated; may be empty if there is no such file" + }, + { + "name": "conversion", + "type": "string", + "description": "String specifying the conversion applied to the original file; should be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage" + }, + { + "name": "expected_size", + "type": "int32", + "description": "Expected size of the generated file; 0 if unknown" + } + ] + }, + { + "name": "photoSize", + "description": "Describes an image in JPEG format", + "class": "PhotoSize", + "properties": [ + { + "name": "type", + "type": "string", + "description": "Image type (see https://core.telegram.org/constructor/photoSize)" + }, + { + "name": "photo", + "type": "file", + "description": "Information about the image file" + }, + { + "name": "width", + "type": "int32", + "description": "Image width" + }, + { + "name": "height", + "type": "int32", + "description": "Image height" + }, + { + "name": "progressive_sizes", + "type": "vector\u003cint32\u003e", + "description": "Sizes of progressive JPEG file prefixes, which can be used to preliminarily show the image" + } + ] + }, + { + "name": "minithumbnail", + "description": "Thumbnail image of a very poor quality and low resolution", + "class": "Minithumbnail", + "properties": [ + { + "name": "width", + "type": "int32", + "description": "Thumbnail width, usually doesn't exceed 40" + }, + { + "name": "height", + "type": "int32", + "description": "Thumbnail height, usually doesn't exceed 40" + }, + { + "name": "data", + "type": "bytes", + "description": "The thumbnail in JPEG format" + } + ] + }, + { + "name": "thumbnailFormatJpeg", + "description": "The thumbnail is in JPEG format", + "class": "ThumbnailFormat", + "properties": [] + }, + { + "name": "thumbnailFormatPng", + "description": "The thumbnail is in PNG format. It will be used only for background patterns", + "class": "ThumbnailFormat", + "properties": [] + }, + { + "name": "thumbnailFormatWebp", + "description": "The thumbnail is in WEBP format. It will be used only for some stickers", + "class": "ThumbnailFormat", + "properties": [] + }, + { + "name": "thumbnailFormatGif", + "description": "The thumbnail is in static GIF format. It will be used only for some bot inline results", + "class": "ThumbnailFormat", + "properties": [] + }, + { + "name": "thumbnailFormatTgs", + "description": "The thumbnail is in TGS format. It will be used only for animated sticker sets", + "class": "ThumbnailFormat", + "properties": [] + }, + { + "name": "thumbnailFormatMpeg4", + "description": "The thumbnail is in MPEG4 format. It will be used only for some animations and videos", + "class": "ThumbnailFormat", + "properties": [] + }, + { + "name": "thumbnail", + "description": "Represents a thumbnail", + "class": "Thumbnail", + "properties": [ + { + "name": "format", + "type": "ThumbnailFormat", + "description": "Thumbnail format" + }, + { + "name": "width", + "type": "int32", + "description": "Thumbnail width" + }, + { + "name": "height", + "type": "int32", + "description": "Thumbnail height" + }, + { + "name": "file", + "type": "file", + "description": "The thumbnail" + } + ] + }, + { + "name": "maskPointForehead", + "description": "A mask should be placed relatively to the forehead", + "class": "MaskPoint", + "properties": [] + }, + { + "name": "maskPointEyes", + "description": "A mask should be placed relatively to the eyes", + "class": "MaskPoint", + "properties": [] + }, + { + "name": "maskPointMouth", + "description": "A mask should be placed relatively to the mouth", + "class": "MaskPoint", + "properties": [] + }, + { + "name": "maskPointChin", + "description": "A mask should be placed relatively to the chin", + "class": "MaskPoint", + "properties": [] + }, + { + "name": "maskPosition", + "description": "Position on a photo where a mask should be placed", + "class": "MaskPosition", + "properties": [ + { + "name": "point", + "type": "MaskPoint", + "description": "Part of the face, relative to which the mask should be placed" + }, + { + "name": "x_shift", + "type": "double", + "description": "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)" + }, + { + "name": "y_shift", + "type": "double", + "description": "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)" + }, + { + "name": "scale", + "type": "double", + "description": "Mask scaling coefficient. (For example, 2.0 means a doubled size)" + } + ] + }, + { + "name": "pollOption", + "description": "Describes one answer option of a poll", + "class": "PollOption", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Option text, 1-100 characters" + }, + { + "name": "voter_count", + "type": "int32", + "description": "Number of voters for this option, available only for closed or voted polls" + }, + { + "name": "vote_percentage", + "type": "int32", + "description": "The percentage of votes for this option, 0-100" + }, + { + "name": "is_chosen", + "type": "Bool", + "description": "True, if the option was chosen by the user" + }, + { + "name": "is_being_chosen", + "type": "Bool", + "description": "True, if the option is being chosen by a pending setPollAnswer request" + } + ] + }, + { + "name": "pollTypeRegular", + "description": "A regular poll", + "class": "PollType", + "properties": [ + { + "name": "allow_multiple_answers", + "type": "Bool", + "description": "True, if multiple answer options can be chosen simultaneously" + } + ] + }, + { + "name": "pollTypeQuiz", + "description": "A poll in quiz mode, which has exactly one correct answer option and can be answered only once", + "class": "PollType", + "properties": [ + { + "name": "correct_option_id", + "type": "int32", + "description": "0-based identifier of the correct answer option; -1 for a yet unanswered poll" + }, + { + "name": "explanation", + "type": "formattedText", + "description": "Text that is shown when the user chooses an incorrect answer or taps on the lamp icon, 0-200 characters with at most 2 line feeds; empty for a yet unanswered poll" + } + ] + }, + { + "name": "animation", + "description": "Describes an animation file. The animation must be encoded in GIF or MPEG4 format", + "class": "Animation", + "properties": [ + { + "name": "duration", + "type": "int32", + "description": "Duration of the animation, in seconds; as defined by the sender" + }, + { + "name": "width", + "type": "int32", + "description": "Width of the animation" + }, + { + "name": "height", + "type": "int32", + "description": "Height of the animation" + }, + { + "name": "file_name", + "type": "string", + "description": "Original name of the file; as defined by the sender" + }, + { + "name": "mime_type", + "type": "string", + "description": "MIME type of the file, usually \"image/gif\" or \"video/mp4\"" + }, + { + "name": "has_stickers", + "type": "Bool", + "description": "True, if stickers were added to the animation. The list of corresponding sticker set can be received using getAttachedStickerSets" + }, + { + "name": "minithumbnail", + "type": "minithumbnail", + "description": "Animation minithumbnail; may be null" + }, + { + "name": "thumbnail", + "type": "thumbnail", + "description": "Animation thumbnail in JPEG or MPEG4 format; may be null" + }, + { + "name": "animation", + "type": "file", + "description": "File containing the animation" + } + ] + }, + { + "name": "audio", + "description": "Describes an audio file. Audio is usually in MP3 or M4A format", + "class": "Audio", + "properties": [ + { + "name": "duration", + "type": "int32", + "description": "Duration of the audio, in seconds; as defined by the sender" + }, + { + "name": "title", + "type": "string", + "description": "Title of the audio; as defined by the sender" + }, + { + "name": "performer", + "type": "string", + "description": "Performer of the audio; as defined by the sender" + }, + { + "name": "file_name", + "type": "string", + "description": "Original name of the file; as defined by the sender" + }, + { + "name": "mime_type", + "type": "string", + "description": "The MIME type of the file; as defined by the sender" + }, + { + "name": "album_cover_minithumbnail", + "type": "minithumbnail", + "description": "The minithumbnail of the album cover; may be null" + }, + { + "name": "album_cover_thumbnail", + "type": "thumbnail", + "description": "The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail should be extracted from the downloaded file; may be null" + }, + { + "name": "audio", + "type": "file", + "description": "File containing the audio" + } + ] + }, + { + "name": "document", + "description": "Describes a document of any type", + "class": "Document", + "properties": [ + { + "name": "file_name", + "type": "string", + "description": "Original name of the file; as defined by the sender" + }, + { + "name": "mime_type", + "type": "string", + "description": "MIME type of the file; as defined by the sender" + }, + { + "name": "minithumbnail", + "type": "minithumbnail", + "description": "Document minithumbnail; may be null" + }, + { + "name": "thumbnail", + "type": "thumbnail", + "description": "Document thumbnail in JPEG or PNG format (PNG will be used only for background patterns); as defined by the sender; may be null" + }, + { + "name": "document", + "type": "file", + "description": "File containing the document" + } + ] + }, + { + "name": "photo", + "description": "Describes a photo", + "class": "Photo", + "properties": [ + { + "name": "has_stickers", + "type": "Bool", + "description": "True, if stickers were added to the photo. The list of corresponding sticker sets can be received using getAttachedStickerSets" + }, + { + "name": "minithumbnail", + "type": "minithumbnail", + "description": "Photo minithumbnail; may be null" + }, + { + "name": "sizes", + "type": "vector\u003cphotoSize\u003e", + "description": "Available variants of the photo, in different sizes" + } + ] + }, + { + "name": "sticker", + "description": "Describes a sticker", + "class": "Sticker", + "properties": [ + { + "name": "set_id", + "type": "int64", + "description": "The identifier of the sticker set to which the sticker belongs; 0 if none" + }, + { + "name": "width", + "type": "int32", + "description": "Sticker width; as defined by the sender" + }, + { + "name": "height", + "type": "int32", + "description": "Sticker height; as defined by the sender" + }, + { + "name": "emoji", + "type": "string", + "description": "Emoji corresponding to the sticker" + }, + { + "name": "is_animated", + "type": "Bool", + "description": "True, if the sticker is an animated sticker in TGS format" + }, + { + "name": "is_mask", + "type": "Bool", + "description": "True, if the sticker is a mask" + }, + { + "name": "mask_position", + "type": "maskPosition", + "description": "Position where the mask should be placed; may be null" + }, + { + "name": "thumbnail", + "type": "thumbnail", + "description": "Sticker thumbnail in WEBP or JPEG format; may be null" + }, + { + "name": "sticker", + "type": "file", + "description": "File containing the sticker" + } + ] + }, + { + "name": "video", + "description": "Describes a video file", + "class": "Video", + "properties": [ + { + "name": "duration", + "type": "int32", + "description": "Duration of the video, in seconds; as defined by the sender" + }, + { + "name": "width", + "type": "int32", + "description": "Video width; as defined by the sender" + }, + { + "name": "height", + "type": "int32", + "description": "Video height; as defined by the sender" + }, + { + "name": "file_name", + "type": "string", + "description": "Original name of the file; as defined by the sender" + }, + { + "name": "mime_type", + "type": "string", + "description": "MIME type of the file; as defined by the sender" + }, + { + "name": "has_stickers", + "type": "Bool", + "description": "True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets" + }, + { + "name": "supports_streaming", + "type": "Bool", + "description": "True, if the video should be tried to be streamed" + }, + { + "name": "minithumbnail", + "type": "minithumbnail", + "description": "Video minithumbnail; may be null" + }, + { + "name": "thumbnail", + "type": "thumbnail", + "description": "Video thumbnail in JPEG or MPEG4 format; as defined by the sender; may be null" + }, + { + "name": "video", + "type": "file", + "description": "File containing the video" + } + ] + }, + { + "name": "videoNote", + "description": "Describes a video note. The video must be equal in width and height, cropped to a circle, and stored in MPEG4 format", + "class": "VideoNote", + "properties": [ + { + "name": "duration", + "type": "int32", + "description": "Duration of the video, in seconds; as defined by the sender" + }, + { + "name": "length", + "type": "int32", + "description": "Video width and height; as defined by the sender" + }, + { + "name": "minithumbnail", + "type": "minithumbnail", + "description": "Video minithumbnail; may be null" + }, + { + "name": "thumbnail", + "type": "thumbnail", + "description": "Video thumbnail in JPEG format; as defined by the sender; may be null" + }, + { + "name": "video", + "type": "file", + "description": "File containing the video" + } + ] + }, + { + "name": "voiceNote", + "description": "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", + "class": "VoiceNote", + "properties": [ + { + "name": "duration", + "type": "int32", + "description": "Duration of the voice note, in seconds; as defined by the sender" + }, + { + "name": "waveform", + "type": "bytes", + "description": "A waveform representation of the voice note in 5-bit format" + }, + { + "name": "mime_type", + "type": "string", + "description": "MIME type of the file; as defined by the sender" + }, + { + "name": "voice", + "type": "file", + "description": "File containing the voice note" + } + ] + }, + { + "name": "contact", + "description": "Describes a user contact", + "class": "Contact", + "properties": [ + { + "name": "phone_number", + "type": "string", + "description": "Phone number of the user" + }, + { + "name": "first_name", + "type": "string", + "description": "First name of the user; 1-255 characters in length" + }, + { + "name": "last_name", + "type": "string", + "description": "Last name of the user" + }, + { + "name": "vcard", + "type": "string", + "description": "Additional data about the user in a form of vCard; 0-2048 bytes in length" + }, + { + "name": "user_id", + "type": "int32", + "description": "Identifier of the user, if known; otherwise 0" + } + ] + }, + { + "name": "location", + "description": "Describes a location on planet Earth", + "class": "Location", + "properties": [ + { + "name": "latitude", + "type": "double", + "description": "Latitude of the location in degrees; as defined by the sender" + }, + { + "name": "longitude", + "type": "double", + "description": "Longitude of the location, in degrees; as defined by the sender" + }, + { + "name": "horizontal_accuracy", + "type": "double", + "description": "The estimated horizontal accuracy of the location, in meters; as defined by the sender. 0 if unknown" + } + ] + }, + { + "name": "venue", + "description": "Describes a venue", + "class": "Venue", + "properties": [ + { + "name": "location", + "type": "location", + "description": "Venue location; as defined by the sender" + }, + { + "name": "title", + "type": "string", + "description": "Venue name; as defined by the sender" + }, + { + "name": "address", + "type": "string", + "description": "Venue address; as defined by the sender" + }, + { + "name": "provider", + "type": "string", + "description": "Provider of the venue database; as defined by the sender. Currently only \"foursquare\" and \"gplaces\" (Google Places) need to be supported" + }, + { + "name": "id", + "type": "string", + "description": "Identifier of the venue in the provider database; as defined by the sender" + }, + { + "name": "type", + "type": "string", + "description": "Type of the venue in the provider database; as defined by the sender" + } + ] + }, + { + "name": "game", + "description": "Describes a game", + "class": "Game", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Game ID" + }, + { + "name": "short_name", + "type": "string", + "description": "Game short name. To share a game use the URL https://t.me/{bot_username}?game={game_short_name}" + }, + { + "name": "title", + "type": "string", + "description": "Game title" + }, + { + "name": "text", + "type": "formattedText", + "description": "Game text, usually containing scoreboards for a game" + }, + { + "name": "description", + "type": "string", + "description": "Game description" + }, + { + "name": "photo", + "type": "photo", + "description": "Game photo" + }, + { + "name": "animation", + "type": "animation", + "description": "Game animation; may be null" + } + ] + }, + { + "name": "poll", + "description": "Describes a poll", + "class": "Poll", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Unique poll identifier" + }, + { + "name": "question", + "type": "string", + "description": "Poll question, 1-300 characters" + }, + { + "name": "options", + "type": "vector\u003cpollOption\u003e", + "description": "List of poll answer options" + }, + { + "name": "total_voter_count", + "type": "int32", + "description": "Total number of voters, participating in the poll" + }, + { + "name": "recent_voter_user_ids", + "type": "vector\u003cint32\u003e", + "description": "User identifiers of recent voters, if the poll is non-anonymous" + }, + { + "name": "is_anonymous", + "type": "Bool", + "description": "True, if the poll is anonymous" + }, + { + "name": "type", + "type": "PollType", + "description": "Type of the poll" + }, + { + "name": "open_period", + "type": "int32", + "description": "Amount of time the poll will be active after creation, in seconds" + }, + { + "name": "close_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the poll will be automatically closed" + }, + { + "name": "is_closed", + "type": "Bool", + "description": "True, if the poll is closed" + } + ] + }, + { + "name": "profilePhoto", + "description": "Describes a user profile photo", + "class": "ProfilePhoto", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of user profile photos" + }, + { + "name": "small", + "type": "file", + "description": "A small (160x160) user profile photo. The file can be downloaded only before the photo is changed" + }, + { + "name": "big", + "type": "file", + "description": "A big (640x640) user profile photo. The file can be downloaded only before the photo is changed" + }, + { + "name": "has_animation", + "type": "Bool", + "description": "True, if the photo has animated variant" + } + ] + }, + { + "name": "chatPhotoInfo", + "description": "Contains basic information about the photo of a chat", + "class": "ChatPhotoInfo", + "properties": [ + { + "name": "small", + "type": "file", + "description": "A small (160x160) chat photo variant in JPEG format. The file can be downloaded only before the photo is changed" + }, + { + "name": "big", + "type": "file", + "description": "A big (640x640) chat photo variant in JPEG format. The file can be downloaded only before the photo is changed" + }, + { + "name": "has_animation", + "type": "Bool", + "description": "True, if the photo has animated variant" + } + ] + }, + { + "name": "userTypeRegular", + "description": "A regular user", + "class": "UserType", + "properties": [] + }, + { + "name": "userTypeDeleted", + "description": "A deleted user or deleted bot. No information on the user besides the user identifier is available. It is not possible to perform any active actions on this type of user", + "class": "UserType", + "properties": [] + }, + { + "name": "userTypeBot", + "description": "A bot (see https://core.telegram.org/bots)", + "class": "UserType", + "properties": [ + { + "name": "can_join_groups", + "type": "Bool", + "description": "True, if the bot can be invited to basic group and supergroup chats" + }, + { + "name": "can_read_all_group_messages", + "type": "Bool", + "description": "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" + }, + { + "name": "is_inline", + "type": "Bool", + "description": "True, if the bot supports inline queries" + }, + { + "name": "inline_query_placeholder", + "type": "string", + "description": "Placeholder for inline queries (displayed on the application input field)" + }, + { + "name": "need_location", + "type": "Bool", + "description": "True, if the location of the user should be sent with every inline query to this bot" + } + ] + }, + { + "name": "userTypeUnknown", + "description": "No information on the user besides the user identifier 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", + "class": "UserType", + "properties": [] + }, + { + "name": "botCommand", + "description": "Represents a command supported by a bot", + "class": "BotCommand", + "properties": [ + { + "name": "command", + "type": "string", + "description": "Text of the bot command" + }, + { + "name": "description", + "type": "string", + "description": "Description of the bot command" + } + ] + }, + { + "name": "botInfo", + "description": "Provides information about a bot and its supported commands", + "class": "BotInfo", + "properties": [ + { + "name": "description", + "type": "string", + "description": "Long description shown on the user info page" + }, + { + "name": "commands", + "type": "vector\u003cbotCommand\u003e", + "description": "A list of commands supported by the bot" + } + ] + }, + { + "name": "chatLocation", + "description": "Represents a location to which a chat is connected", + "class": "ChatLocation", + "properties": [ + { + "name": "location", + "type": "location", + "description": "The location" + }, + { + "name": "address", + "type": "string", + "description": "Location address; 1-64 characters, as defined by the chat owner" + } + ] + }, + { + "name": "animatedChatPhoto", + "description": "Animated variant of a chat photo in MPEG4 format", + "class": "AnimatedChatPhoto", + "properties": [ + { + "name": "length", + "type": "int32", + "description": "Animation width and height" + }, + { + "name": "file", + "type": "file", + "description": "Information about the animation file" + }, + { + "name": "main_frame_timestamp", + "type": "double", + "description": "Timestamp of the frame, used as a static chat photo" + } + ] + }, + { + "name": "chatPhoto", + "description": "Describes a chat or user profile photo", + "class": "ChatPhoto", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Unique photo identifier" + }, + { + "name": "added_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the photo has been added" + }, + { + "name": "minithumbnail", + "type": "minithumbnail", + "description": "Photo minithumbnail; may be null" + }, + { + "name": "sizes", + "type": "vector\u003cphotoSize\u003e", + "description": "Available variants of the photo in JPEG format, in different size" + }, + { + "name": "animation", + "type": "animatedChatPhoto", + "description": "Animated variant of the photo in MPEG4 format; may be null" + } + ] + }, + { + "name": "chatPhotos", + "description": "Contains a list of chat or user profile photos", + "class": "ChatPhotos", + "properties": [ + { + "name": "total_count", + "type": "int32", + "description": "Total number of photos" + }, + { + "name": "photos", + "type": "vector\u003cchatPhoto\u003e", + "description": "List of photos" + } + ] + }, + { + "name": "inputChatPhotoPrevious", + "description": "A previously used profile photo of the current user", + "class": "InputChatPhoto", + "properties": [ + { + "name": "chat_photo_id", + "type": "int64", + "description": "Identifier of the profile photo to reuse" + } + ] + }, + { + "name": "inputChatPhotoStatic", + "description": "A static photo in JPEG format", + "class": "InputChatPhoto", + "properties": [ + { + "name": "photo", + "type": "InputFile", + "description": "Photo to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed" + } + ] + }, + { + "name": "inputChatPhotoAnimation", + "description": "An animation in MPEG4 format; must be square, at most 10 seconds long, have width between 160 and 800 and be at most 2MB in size", + "class": "InputChatPhoto", + "properties": [ + { + "name": "animation", + "type": "InputFile", + "description": "Animation to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed" + }, + { + "name": "main_frame_timestamp", + "type": "double", + "description": "Timestamp of the frame, which will be used as static chat photo" + } + ] + }, + { + "name": "user", + "description": "Represents a user", + "class": "User", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "first_name", + "type": "string", + "description": "First name of the user" + }, + { + "name": "last_name", + "type": "string", + "description": "Last name of the user" + }, + { + "name": "username", + "type": "string", + "description": "Username of the user" + }, + { + "name": "phone_number", + "type": "string", + "description": "Phone number of the user" + }, + { + "name": "status", + "type": "UserStatus", + "description": "Current online status of the user" + }, + { + "name": "profile_photo", + "type": "profilePhoto", + "description": "Profile photo of the user; may be null" + }, + { + "name": "is_contact", + "type": "Bool", + "description": "The user is a contact of the current user" + }, + { + "name": "is_mutual_contact", + "type": "Bool", + "description": "The user is a contact of the current user and the current user is a contact of the user" + }, + { + "name": "is_verified", + "type": "Bool", + "description": "True, if the user is verified" + }, + { + "name": "is_support", + "type": "Bool", + "description": "True, if the user is Telegram support account" + }, + { + "name": "restriction_reason", + "type": "string", + "description": "If non-empty, it contains a human-readable description of the reason why access to this user must be restricted" + }, + { + "name": "is_scam", + "type": "Bool", + "description": "True, if many users reported this user as a scam" + }, + { + "name": "have_access", + "type": "Bool", + "description": "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" + }, + { + "name": "type", + "type": "UserType", + "description": "Type of the user" + }, + { + "name": "language_code", + "type": "string", + "description": "IETF language tag of the user's language; only available to bots" + } + ] + }, + { + "name": "userFullInfo", + "description": "Contains full information about a user", + "class": "UserFullInfo", + "properties": [ + { + "name": "photo", + "type": "chatPhoto", + "description": "User profile photo; may be null" + }, + { + "name": "is_blocked", + "type": "Bool", + "description": "True, if the user is blocked by the current user" + }, + { + "name": "can_be_called", + "type": "Bool", + "description": "True, if the user can be called" + }, + { + "name": "supports_video_calls", + "type": "Bool", + "description": "True, if a video call can be created with the user" + }, + { + "name": "has_private_calls", + "type": "Bool", + "description": "True, if the user can't be called due to their privacy settings" + }, + { + "name": "need_phone_number_privacy_exception", + "type": "Bool", + "description": "True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used" + }, + { + "name": "bio", + "type": "string", + "description": "A short user bio" + }, + { + "name": "share_text", + "type": "string", + "description": "For bots, the text that is included with the link when users share the bot" + }, + { + "name": "group_in_common_count", + "type": "int32", + "description": "Number of group chats where both the other user and the current user are a member; 0 for the current user" + }, + { + "name": "bot_info", + "type": "botInfo", + "description": "If the user is a bot, information about the bot; may be null" + } + ] + }, + { + "name": "users", + "description": "Represents a list of users", + "class": "Users", + "properties": [ + { + "name": "total_count", + "type": "int32", + "description": "Approximate total count of users found" + }, + { + "name": "user_ids", + "type": "vector\u003cint32\u003e", + "description": "A list of user identifiers" + } + ] + }, + { + "name": "chatAdministrator", + "description": "Contains information about a chat administrator", + "class": "ChatAdministrator", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier of the administrator" + }, + { + "name": "custom_title", + "type": "string", + "description": "Custom title of the administrator" + }, + { + "name": "is_owner", + "type": "Bool", + "description": "True, if the user is the owner of the chat" + } + ] + }, + { + "name": "chatAdministrators", + "description": "Represents a list of chat administrators", + "class": "ChatAdministrators", + "properties": [ + { + "name": "administrators", + "type": "vector\u003cchatAdministrator\u003e", + "description": "A list of chat administrators" + } + ] + }, + { + "name": "chatPermissions", + "description": "Describes actions that a user is allowed to take in a chat", + "class": "ChatPermissions", + "properties": [ + { + "name": "can_send_messages", + "type": "Bool", + "description": "True, if the user can send text messages, contacts, locations, and venues" + }, + { + "name": "can_send_media_messages", + "type": "Bool", + "description": "True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions" + }, + { + "name": "can_send_polls", + "type": "Bool", + "description": "True, if the user can send polls. Implies can_send_messages permissions" + }, + { + "name": "can_send_other_messages", + "type": "Bool", + "description": "True, if the user can send animations, games, stickers, and dice and use inline bots. Implies can_send_messages permissions" + }, + { + "name": "can_add_web_page_previews", + "type": "Bool", + "description": "True, if the user may add a web page preview to their messages. Implies can_send_messages permissions" + }, + { + "name": "can_change_info", + "type": "Bool", + "description": "True, if the user can change the chat title, photo, and other settings" + }, + { + "name": "can_invite_users", + "type": "Bool", + "description": "True, if the user can invite new users to the chat" + }, + { + "name": "can_pin_messages", + "type": "Bool", + "description": "True, if the user can pin messages" + } + ] + }, + { + "name": "chatMemberStatusCreator", + "description": "The user is the owner of a chat and has all the administrator privileges", + "class": "ChatMemberStatus", + "properties": [ + { + "name": "custom_title", + "type": "string", + "description": "A custom title of the owner; 0-16 characters without emojis; applicable to supergroups only" + }, + { + "name": "is_anonymous", + "type": "Bool", + "description": "True, if the creator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only" + }, + { + "name": "is_member", + "type": "Bool", + "description": "True, if the user is a member of the chat" + } + ] + }, + { + "name": "chatMemberStatusAdministrator", + "description": "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", + "class": "ChatMemberStatus", + "properties": [ + { + "name": "custom_title", + "type": "string", + "description": "A custom title of the administrator; 0-16 characters without emojis; applicable to supergroups only" + }, + { + "name": "can_be_edited", + "type": "Bool", + "description": "True, if the current user can edit the administrator privileges for the called user" + }, + { + "name": "can_change_info", + "type": "Bool", + "description": "True, if the administrator can change the chat title, photo, and other settings" + }, + { + "name": "can_post_messages", + "type": "Bool", + "description": "True, if the administrator can create channel posts; applicable to channels only" + }, + { + "name": "can_edit_messages", + "type": "Bool", + "description": "True, if the administrator can edit messages of other users and pin messages; applicable to channels only" + }, + { + "name": "can_delete_messages", + "type": "Bool", + "description": "True, if the administrator can delete messages of other users" + }, + { + "name": "can_invite_users", + "type": "Bool", + "description": "True, if the administrator can invite new users to the chat" + }, + { + "name": "can_restrict_members", + "type": "Bool", + "description": "True, if the administrator can restrict, ban, or unban chat members" + }, + { + "name": "can_pin_messages", + "type": "Bool", + "description": "True, if the administrator can pin messages; applicable to groups only" + }, + { + "name": "can_promote_members", + "type": "Bool", + "description": "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 them" + }, + { + "name": "is_anonymous", + "type": "Bool", + "description": "True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only" + } + ] + }, + { + "name": "chatMemberStatusMember", + "description": "The user is a member of a chat, without any additional privileges or restrictions", + "class": "ChatMemberStatus", + "properties": [] + }, + { + "name": "chatMemberStatusRestricted", + "description": "The user is under certain restrictions in the chat. Not supported in basic groups and channels", + "class": "ChatMemberStatus", + "properties": [ + { + "name": "is_member", + "type": "Bool", + "description": "True, if the user is a member of the chat" + }, + { + "name": "restricted_until_date", + "type": "int32", + "description": "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" + }, + { + "name": "permissions", + "type": "chatPermissions", + "description": "User permissions in the chat" + } + ] + }, + { + "name": "chatMemberStatusLeft", + "description": "The user is not a chat member", + "class": "ChatMemberStatus", + "properties": [] + }, + { + "name": "chatMemberStatusBanned", + "description": "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", + "class": "ChatMemberStatus", + "properties": [ + { + "name": "banned_until_date", + "type": "int32", + "description": "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" + } + ] + }, + { + "name": "chatMember", + "description": "A user with information about joining/leaving a chat", + "class": "ChatMember", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier of the chat member" + }, + { + "name": "inviter_user_id", + "type": "int32", + "description": "Identifier of a user that invited/promoted/banned this member in the chat; 0 if unknown" + }, + { + "name": "joined_chat_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the user joined the chat" + }, + { + "name": "status", + "type": "ChatMemberStatus", + "description": "Status of the member in the chat" + }, + { + "name": "bot_info", + "type": "botInfo", + "description": "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 the chat member" + } + ] + }, + { + "name": "chatMembers", + "description": "Contains a list of chat members", + "class": "ChatMembers", + "properties": [ + { + "name": "total_count", + "type": "int32", + "description": "Approximate total count of chat members found" + }, + { + "name": "members", + "type": "vector\u003cchatMember\u003e", + "description": "A list of chat members" + } + ] + }, + { + "name": "chatMembersFilterContacts", + "description": "Returns contacts of the user", + "class": "ChatMembersFilter", + "properties": [] + }, + { + "name": "chatMembersFilterAdministrators", + "description": "Returns the owner and administrators", + "class": "ChatMembersFilter", + "properties": [] + }, + { + "name": "chatMembersFilterMembers", + "description": "Returns all chat members, including restricted chat members", + "class": "ChatMembersFilter", + "properties": [] + }, + { + "name": "chatMembersFilterMention", + "description": "Returns users which can be mentioned in the chat", + "class": "ChatMembersFilter", + "properties": [ + { + "name": "message_thread_id", + "type": "int53", + "description": "If non-zero, the identifier of the current message thread" + } + ] + }, + { + "name": "chatMembersFilterRestricted", + "description": "Returns users under certain restrictions in the chat; can be used only by administrators in a supergroup", + "class": "ChatMembersFilter", + "properties": [] + }, + { + "name": "chatMembersFilterBanned", + "description": "Returns users banned from the chat; can be used only by administrators in a supergroup or in a channel", + "class": "ChatMembersFilter", + "properties": [] + }, + { + "name": "chatMembersFilterBots", + "description": "Returns bot members of the chat", + "class": "ChatMembersFilter", + "properties": [] + }, + { + "name": "supergroupMembersFilterRecent", + "description": "Returns recently active users in reverse chronological order", + "class": "SupergroupMembersFilter", + "properties": [] + }, + { + "name": "supergroupMembersFilterContacts", + "description": "Returns contacts of the user, which are members of the supergroup or channel", + "class": "SupergroupMembersFilter", + "properties": [ + { + "name": "query", + "type": "string", + "description": "Query to search for" + } + ] + }, + { + "name": "supergroupMembersFilterAdministrators", + "description": "Returns the owner and administrators", + "class": "SupergroupMembersFilter", + "properties": [] + }, + { + "name": "supergroupMembersFilterSearch", + "description": "Used to search for supergroup or channel members via a (string) query", + "class": "SupergroupMembersFilter", + "properties": [ + { + "name": "query", + "type": "string", + "description": "Query to search for" + } + ] + }, + { + "name": "supergroupMembersFilterRestricted", + "description": "Returns restricted supergroup members; can be used only by administrators", + "class": "SupergroupMembersFilter", + "properties": [ + { + "name": "query", + "type": "string", + "description": "Query to search for" + } + ] + }, + { + "name": "supergroupMembersFilterBanned", + "description": "Returns users banned from the supergroup or channel; can be used only by administrators", + "class": "SupergroupMembersFilter", + "properties": [ + { + "name": "query", + "type": "string", + "description": "Query to search for" + } + ] + }, + { + "name": "supergroupMembersFilterMention", + "description": "Returns users which can be mentioned in the supergroup", + "class": "SupergroupMembersFilter", + "properties": [ + { + "name": "query", + "type": "string", + "description": "Query to search for" + }, + { + "name": "message_thread_id", + "type": "int53", + "description": "If non-zero, the identifier of the current message thread" + } + ] + }, + { + "name": "supergroupMembersFilterBots", + "description": "Returns bot members of the supergroup or channel", + "class": "SupergroupMembersFilter", + "properties": [] + }, + { + "name": "basicGroup", + "description": "Represents a basic group of 0-200 users (must be upgraded to a supergroup to accommodate more than 200 users)", + "class": "BasicGroup", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Group identifier" + }, + { + "name": "member_count", + "type": "int32", + "description": "Number of members in the group" + }, + { + "name": "status", + "type": "ChatMemberStatus", + "description": "Status of the current user in the group" + }, + { + "name": "is_active", + "type": "Bool", + "description": "True, if the group is active" + }, + { + "name": "upgraded_to_supergroup_id", + "type": "int32", + "description": "Identifier of the supergroup to which this group was upgraded; 0 if none" + } + ] + }, + { + "name": "basicGroupFullInfo", + "description": "Contains full information about a basic group", + "class": "BasicGroupFullInfo", + "properties": [ + { + "name": "photo", + "type": "chatPhoto", + "description": "Chat photo; may be null" + }, + { + "name": "description", + "type": "string", + "description": "Group description" + }, + { + "name": "creator_user_id", + "type": "int32", + "description": "User identifier of the creator of the group; 0 if unknown" + }, + { + "name": "members", + "type": "vector\u003cchatMember\u003e", + "description": "Group members" + }, + { + "name": "invite_link", + "type": "string", + "description": "Invite link for this group; available only after it has been generated at least once and only for the group creator" + } + ] + }, + { + "name": "supergroup", + "description": "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", + "class": "Supergroup", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Supergroup or channel identifier" + }, + { + "name": "username", + "type": "string", + "description": "Username of the supergroup or channel; empty for private supergroups or channels" + }, + { + "name": "date", + "type": "int32", + "description": "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" + }, + { + "name": "status", + "type": "ChatMemberStatus", + "description": "Status of the current user in the supergroup or channel; custom title will be always empty" + }, + { + "name": "member_count", + "type": "int32", + "description": "Number of members in the supergroup or channel; 0 if unknown. Currently it is guaranteed to be known only if the supergroup or channel was received through searchPublicChats, searchChatsNearby, getInactiveSupergroupChats, getSuitableDiscussionChats, getGroupsInCommon, or getUserPrivacySettingRules" + }, + { + "name": "has_linked_chat", + "type": "Bool", + "description": "True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel" + }, + { + "name": "has_location", + "type": "Bool", + "description": "True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup" + }, + { + "name": "sign_messages", + "type": "Bool", + "description": "True, if messages sent to the channel should contain information about the sender. This field is only applicable to channels" + }, + { + "name": "is_slow_mode_enabled", + "type": "Bool", + "description": "True, if the slow mode is enabled in the supergroup" + }, + { + "name": "is_channel", + "type": "Bool", + "description": "True, if the supergroup is a channel" + }, + { + "name": "is_verified", + "type": "Bool", + "description": "True, if the supergroup or channel is verified" + }, + { + "name": "restriction_reason", + "type": "string", + "description": "If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted" + }, + { + "name": "is_scam", + "type": "Bool", + "description": "True, if many users reported this supergroup as a scam" + } + ] + }, + { + "name": "supergroupFullInfo", + "description": "Contains full information about a supergroup or channel", + "class": "SupergroupFullInfo", + "properties": [ + { + "name": "photo", + "type": "chatPhoto", + "description": "Chat photo; may be null" + }, + { + "name": "description", + "type": "string", + "description": "Supergroup or channel description" + }, + { + "name": "member_count", + "type": "int32", + "description": "Number of members in the supergroup or channel; 0 if unknown" + }, + { + "name": "administrator_count", + "type": "int32", + "description": "Number of privileged users in the supergroup or channel; 0 if unknown" + }, + { + "name": "restricted_count", + "type": "int32", + "description": "Number of restricted users in the supergroup; 0 if unknown" + }, + { + "name": "banned_count", + "type": "int32", + "description": "Number of users banned from chat; 0 if unknown" + }, + { + "name": "linked_chat_id", + "type": "int53", + "description": "Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown" + }, + { + "name": "slow_mode_delay", + "type": "int32", + "description": "Delay between consecutive sent messages for non-administrator supergroup members, in seconds" + }, + { + "name": "slow_mode_delay_expires_in", + "type": "double", + "description": "Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero" + }, + { + "name": "can_get_members", + "type": "Bool", + "description": "True, if members of the chat can be retrieved" + }, + { + "name": "can_set_username", + "type": "Bool", + "description": "True, if the chat username can be changed" + }, + { + "name": "can_set_sticker_set", + "type": "Bool", + "description": "True, if the supergroup sticker set can be changed" + }, + { + "name": "can_set_location", + "type": "Bool", + "description": "True, if the supergroup location can be changed" + }, + { + "name": "can_get_statistics", + "type": "Bool", + "description": "True, if the supergroup or channel statistics are available" + }, + { + "name": "is_all_history_available", + "type": "Bool", + "description": "True, if new chat members will have access to old messages. In public or discussion groups and both public and private channels, old messages are always available, so this option affects only private supergroups without a linked chat. The value of this field is only available for chat administrators" + }, + { + "name": "sticker_set_id", + "type": "int64", + "description": "Identifier of the supergroup sticker set; 0 if none" + }, + { + "name": "location", + "type": "chatLocation", + "description": "Location to which the supergroup is connected; may be null" + }, + { + "name": "invite_link", + "type": "string", + "description": "Invite link for this chat" + }, + { + "name": "upgraded_from_basic_group_id", + "type": "int32", + "description": "Identifier of the basic group from which supergroup was upgraded; 0 if none" + }, + { + "name": "upgraded_from_max_message_id", + "type": "int53", + "description": "Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none" + } + ] + }, + { + "name": "secretChatStatePending", + "description": "The secret chat is not yet created; waiting for the other user to get online", + "class": "SecretChatState", + "properties": [] + }, + { + "name": "secretChatStateReady", + "description": "The secret chat is ready to use", + "class": "SecretChatState", + "properties": [] + }, + { + "name": "secretChatStateClosed", + "description": "The secret chat is closed", + "class": "SecretChatState", + "properties": [] + }, + { + "name": "secretChat", + "description": "Represents a secret chat", + "class": "SecretChat", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Secret chat identifier" + }, + { + "name": "user_id", + "type": "int32", + "description": "Identifier of the chat partner" + }, + { + "name": "state", + "type": "SecretChatState", + "description": "State of the secret chat" + }, + { + "name": "is_outbound", + "type": "Bool", + "description": "True, if the chat was created by the current user; otherwise false" + }, + { + "name": "ttl", + "type": "int32", + "description": "Current message Time To Live setting (self-destruct timer) for the chat, in seconds" + }, + { + "name": "key_hash", + "type": "bytes", + "description": "Hash of the currently used key for comparison with the hash of the chat partner's key. This is a string of 36 little-endian bytes, which must be split into groups of 2 bits, each denoting a pixel of one of 4 colors FFFFFF, D5E6F3, 2D5775, and 2F99C9. The pixels must be used to make a 12x12 square image filled from left to right, top to bottom. Alternatively, the first 32 bytes of the hash can be converted to the hexadecimal format and printed as 32 2-digit hex numbers" + }, + { + "name": "layer", + "type": "int32", + "description": "Secret chat layer; determines features supported by the chat partner's application. Video notes are supported if the layer \u003e= 66; nested text entities and underline and strikethrough entities are supported if the layer \u003e= 101" + } + ] + }, + { + "name": "messageSenderUser", + "description": "The message was sent by a known user", + "class": "MessageSender", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Identifier of the user that sent the message" + } + ] + }, + { + "name": "messageSenderChat", + "description": "The message was sent on behalf of a chat", + "class": "MessageSender", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat that sent the message" + } + ] + }, + { + "name": "messageSenders", + "description": "Represents a list of message senders", + "class": "MessageSenders", + "properties": [ + { + "name": "total_count", + "type": "int32", + "description": "Approximate total count of messages senders found" + }, + { + "name": "senders", + "type": "vector\u003cMessageSender\u003e", + "description": "List of message senders" + } + ] + }, + { + "name": "messageForwardOriginUser", + "description": "The message was originally sent by a known user", + "class": "MessageForwardOrigin", + "properties": [ + { + "name": "sender_user_id", + "type": "int32", + "description": "Identifier of the user that originally sent the message" + } + ] + }, + { + "name": "messageForwardOriginChat", + "description": "The message was originally sent by an anonymous chat administrator on behalf of the chat", + "class": "MessageForwardOrigin", + "properties": [ + { + "name": "sender_chat_id", + "type": "int53", + "description": "Identifier of the chat that originally sent the message" + }, + { + "name": "author_signature", + "type": "string", + "description": "Original message author signature" + } + ] + }, + { + "name": "messageForwardOriginHiddenUser", + "description": "The message was originally sent by a user, which is hidden by their privacy settings", + "class": "MessageForwardOrigin", + "properties": [ + { + "name": "sender_name", + "type": "string", + "description": "Name of the sender" + } + ] + }, + { + "name": "messageForwardOriginChannel", + "description": "The message was originally a post in a channel", + "class": "MessageForwardOrigin", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat from which the message was originally forwarded" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier of the original message" + }, + { + "name": "author_signature", + "type": "string", + "description": "Original post author signature" + } + ] + }, + { + "name": "messageForwardInfo", + "description": "Contains information about a forwarded message", + "class": "MessageForwardInfo", + "properties": [ + { + "name": "origin", + "type": "MessageForwardOrigin", + "description": "Origin of a forwarded message" + }, + { + "name": "date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the message was originally sent" + }, + { + "name": "public_service_announcement_type", + "type": "string", + "description": "The type of a public service announcement for the forwarded message" + }, + { + "name": "from_chat_id", + "type": "int53", + "description": "For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the chat from which the message was forwarded last time; 0 if unknown" + }, + { + "name": "from_message_id", + "type": "int53", + "description": "For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the original message from which the new message was forwarded last time; 0 if unknown" + } + ] + }, + { + "name": "messageReplyInfo", + "description": "Contains information about replies to a message", + "class": "MessageReplyInfo", + "properties": [ + { + "name": "reply_count", + "type": "int32", + "description": "Number of times the message was directly or indirectly replied" + }, + { + "name": "recent_repliers", + "type": "vector\u003cMessageSender\u003e", + "description": "Recent repliers to the message; available in channels with a discussion supergroup" + }, + { + "name": "last_read_inbox_message_id", + "type": "int53", + "description": "Identifier of the last read incoming reply to the message" + }, + { + "name": "last_read_outbox_message_id", + "type": "int53", + "description": "Identifier of the last read outgoing reply to the message" + }, + { + "name": "last_message_id", + "type": "int53", + "description": "Identifier of the last reply to the message" + } + ] + }, + { + "name": "messageInteractionInfo", + "description": "Contains information about interactions with a message", + "class": "MessageInteractionInfo", + "properties": [ + { + "name": "view_count", + "type": "int32", + "description": "Number of times the message was viewed" + }, + { + "name": "forward_count", + "type": "int32", + "description": "Number of times the message was forwarded" + }, + { + "name": "reply_info", + "type": "messageReplyInfo", + "description": "Contains information about direct or indirect replies to the message; may be null. Currently, available only in channels with a discussion supergroup and discussion supergroups for messages, which are not replies itself" + } + ] + }, + { + "name": "messageSendingStatePending", + "description": "The message is being sent now, but has not yet been delivered to the server", + "class": "MessageSendingState", + "properties": [] + }, + { + "name": "messageSendingStateFailed", + "description": "The message failed to be sent", + "class": "MessageSendingState", + "properties": [ + { + "name": "error_code", + "type": "int32", + "description": "An error code; 0 if unknown" + }, + { + "name": "error_message", + "type": "string", + "description": "Error message" + }, + { + "name": "can_retry", + "type": "Bool", + "description": "True, if the message can be re-sent" + }, + { + "name": "retry_after", + "type": "double", + "description": "Time left before the message can be re-sent, in seconds. No update is sent when this field changes" + } + ] + }, + { + "name": "message", + "description": "Describes a message", + "class": "Message", + "properties": [ + { + "name": "id", + "type": "int53", + "description": "Message identifier; unique for the chat to which the message belongs" + }, + { + "name": "sender", + "type": "MessageSender", + "description": "The sender of the message" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "sending_state", + "type": "MessageSendingState", + "description": "Information about the sending state of the message; may be null" + }, + { + "name": "scheduling_state", + "type": "MessageSchedulingState", + "description": "Information about the scheduling state of the message; may be null" + }, + { + "name": "is_outgoing", + "type": "Bool", + "description": "True, if the message is outgoing" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is pinned" + }, + { + "name": "can_be_edited", + "type": "Bool", + "description": "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 application" + }, + { + "name": "can_be_forwarded", + "type": "Bool", + "description": "True, if the message can be forwarded" + }, + { + "name": "can_be_deleted_only_for_self", + "type": "Bool", + "description": "True, if the message can be deleted only for the current user while other users will continue to see it" + }, + { + "name": "can_be_deleted_for_all_users", + "type": "Bool", + "description": "True, if the message can be deleted for all users" + }, + { + "name": "can_get_statistics", + "type": "Bool", + "description": "True, if the message statistics are available" + }, + { + "name": "can_get_message_thread", + "type": "Bool", + "description": "True, if the message thread info is available" + }, + { + "name": "is_channel_post", + "type": "Bool", + "description": "True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts" + }, + { + "name": "contains_unread_mention", + "type": "Bool", + "description": "True, if the message contains an unread mention for the current user" + }, + { + "name": "date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the message was sent" + }, + { + "name": "edit_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the message was last edited" + }, + { + "name": "forward_info", + "type": "messageForwardInfo", + "description": "Information about the initial message sender; may be null" + }, + { + "name": "interaction_info", + "type": "messageInteractionInfo", + "description": "Information about interactions with the message; may be null" + }, + { + "name": "reply_in_chat_id", + "type": "int53", + "description": "If non-zero, the identifier of the chat to which the replied message belongs; Currently, only messages in the Replies chat can have different reply_in_chat_id and chat_id" + }, + { + "name": "reply_to_message_id", + "type": "int53", + "description": "If non-zero, the identifier of the message this message is replying to; can be the identifier of a deleted message" + }, + { + "name": "message_thread_id", + "type": "int53", + "description": "If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs" + }, + { + "name": "ttl", + "type": "int32", + "description": "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" + }, + { + "name": "ttl_expires_in", + "type": "double", + "description": "Time left before the message expires, in seconds" + }, + { + "name": "via_bot_user_id", + "type": "int32", + "description": "If non-zero, the user identifier of the bot through which this message was sent" + }, + { + "name": "author_signature", + "type": "string", + "description": "For channel posts and anonymous group messages, optional author signature" + }, + { + "name": "media_album_id", + "type": "int64", + "description": "Unique identifier of an album this message belongs to. Only photos and videos can be grouped together in albums" + }, + { + "name": "restriction_reason", + "type": "string", + "description": "If non-empty, contains a human-readable description of the reason why access to this message must be restricted" + }, + { + "name": "content", + "type": "MessageContent", + "description": "Content of the message" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "Reply markup for the message; may be null" + } + ] + }, + { + "name": "messages", + "description": "Contains a list of messages", + "class": "Messages", + "properties": [ + { + "name": "total_count", + "type": "int32", + "description": "Approximate total count of messages found" + }, + { + "name": "messages", + "type": "vector\u003cmessage\u003e", + "description": "List of messages; messages may be null" + } + ] + }, + { + "name": "foundMessages", + "description": "Contains a list of messages found by a search", + "class": "FoundMessages", + "properties": [ + { + "name": "total_count", + "type": "int32", + "description": "Approximate total count of messages found; -1 if unknown" + }, + { + "name": "messages", + "type": "vector\u003cmessage\u003e", + "description": "List of messages" + }, + { + "name": "next_offset", + "type": "string", + "description": "The offset for the next request. If empty, there are no more results" + } + ] + }, + { + "name": "notificationSettingsScopePrivateChats", + "description": "Notification settings applied to all private and secret chats when the corresponding chat setting has a default value", + "class": "NotificationSettingsScope", + "properties": [] + }, + { + "name": "notificationSettingsScopeGroupChats", + "description": "Notification settings applied to all basic groups and supergroups when the corresponding chat setting has a default value", + "class": "NotificationSettingsScope", + "properties": [] + }, + { + "name": "notificationSettingsScopeChannelChats", + "description": "Notification settings applied to all channels when the corresponding chat setting has a default value", + "class": "NotificationSettingsScope", + "properties": [] + }, + { + "name": "chatNotificationSettings", + "description": "Contains information about notification settings for a chat", + "class": "ChatNotificationSettings", + "properties": [ + { + "name": "use_default_mute_for", + "type": "Bool", + "description": "If true, mute_for is ignored and the value for the relevant type of chat is used instead" + }, + { + "name": "mute_for", + "type": "int32", + "description": "Time left before notifications will be unmuted, in seconds" + }, + { + "name": "use_default_sound", + "type": "Bool", + "description": "If true, sound is ignored and the value for the relevant type of chat is used instead" + }, + { + "name": "sound", + "type": "string", + "description": "The name of an audio file to be used for notification sounds; only applies to iOS applications" + }, + { + "name": "use_default_show_preview", + "type": "Bool", + "description": "If true, show_preview is ignored and the value for the relevant type of chat is used instead" + }, + { + "name": "show_preview", + "type": "Bool", + "description": "True, if message content should be displayed in notifications" + }, + { + "name": "use_default_disable_pinned_message_notifications", + "type": "Bool", + "description": "If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat is used instead" + }, + { + "name": "disable_pinned_message_notifications", + "type": "Bool", + "description": "If true, notifications for incoming pinned messages will be created as for an ordinary unread message" + }, + { + "name": "use_default_disable_mention_notifications", + "type": "Bool", + "description": "If true, disable_mention_notifications is ignored and the value for the relevant type of chat is used instead" + }, + { + "name": "disable_mention_notifications", + "type": "Bool", + "description": "If true, notifications for messages with mentions will be created as for an ordinary unread message" + } + ] + }, + { + "name": "scopeNotificationSettings", + "description": "Contains information about notification settings for several chats", + "class": "ScopeNotificationSettings", + "properties": [ + { + "name": "mute_for", + "type": "int32", + "description": "Time left before notifications will be unmuted, in seconds" + }, + { + "name": "sound", + "type": "string", + "description": "The name of an audio file to be used for notification sounds; only applies to iOS applications" + }, + { + "name": "show_preview", + "type": "Bool", + "description": "True, if message content should be displayed in notifications" + }, + { + "name": "disable_pinned_message_notifications", + "type": "Bool", + "description": "True, if notifications for incoming pinned messages will be created as for an ordinary unread message" + }, + { + "name": "disable_mention_notifications", + "type": "Bool", + "description": "True, if notifications for messages with mentions will be created as for an ordinary unread message" + } + ] + }, + { + "name": "draftMessage", + "description": "Contains information about a message draft", + "class": "DraftMessage", + "properties": [ + { + "name": "reply_to_message_id", + "type": "int53", + "description": "Identifier of the message to reply to; 0 if none" + }, + { + "name": "date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the draft was created" + }, + { + "name": "input_message_text", + "type": "InputMessageContent", + "description": "Content of the message draft; this should always be of type inputMessageText" + } + ] + }, + { + "name": "chatTypePrivate", + "description": "An ordinary chat with a user", + "class": "ChatType", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + } + ] + }, + { + "name": "chatTypeBasicGroup", + "description": "A basic group (i.e., a chat with 0-200 other users)", + "class": "ChatType", + "properties": [ + { + "name": "basic_group_id", + "type": "int32", + "description": "Basic group identifier" + } + ] + }, + { + "name": "chatTypeSupergroup", + "description": "A supergroup (i.e. a chat with up to GetOption(\"supergroup_max_size\") other users), or channel (with unlimited members)", + "class": "ChatType", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "Supergroup or channel identifier" + }, + { + "name": "is_channel", + "type": "Bool", + "description": "True, if the supergroup is a channel" + } + ] + }, + { + "name": "chatTypeSecret", + "description": "A secret chat with a user", + "class": "ChatType", + "properties": [ + { + "name": "secret_chat_id", + "type": "int32", + "description": "Secret chat identifier" + }, + { + "name": "user_id", + "type": "int32", + "description": "User identifier of the secret chat peer" + } + ] + }, + { + "name": "chatFilter", + "description": "Represents a filter of user chats", + "class": "ChatFilter", + "properties": [ + { + "name": "title", + "type": "string", + "description": "The title of the filter; 1-12 characters without line feeds" + }, + { + "name": "icon_name", + "type": "string", + "description": "The icon name for short filter representation. If non-empty, must be one of \"All\", \"Unread\", \"Unmuted\", \"Bots\", \"Channels\", \"Groups\", \"Private\", \"Custom\", \"Setup\", \"Cat\", \"Crown\", \"Favorite\", \"Flower\", \"Game\", \"Home\", \"Love\", \"Mask\", \"Party\", \"Sport\", \"Study\", \"Trade\", \"Travel\", \"Work\". If empty, use getChatFilterDefaultIconName to get default icon name for the filter" + }, + { + "name": "pinned_chat_ids", + "type": "vector\u003cint53\u003e", + "description": "The chat identifiers of pinned chats in the filtered chat list" + }, + { + "name": "included_chat_ids", + "type": "vector\u003cint53\u003e", + "description": "The chat identifiers of always included chats in the filtered chat list" + }, + { + "name": "excluded_chat_ids", + "type": "vector\u003cint53\u003e", + "description": "The chat identifiers of always excluded chats in the filtered chat list" + }, + { + "name": "exclude_muted", + "type": "Bool", + "description": "True, if muted chats need to be excluded" + }, + { + "name": "exclude_read", + "type": "Bool", + "description": "True, if read chats need to be excluded" + }, + { + "name": "exclude_archived", + "type": "Bool", + "description": "True, if archived chats need to be excluded" + }, + { + "name": "include_contacts", + "type": "Bool", + "description": "True, if contacts need to be included" + }, + { + "name": "include_non_contacts", + "type": "Bool", + "description": "True, if non-contact users need to be included" + }, + { + "name": "include_bots", + "type": "Bool", + "description": "True, if bots need to be included" + }, + { + "name": "include_groups", + "type": "Bool", + "description": "True, if basic groups and supergroups need to be included" + }, + { + "name": "include_channels", + "type": "Bool", + "description": "True, if channels need to be included" + } + ] + }, + { + "name": "chatFilterInfo", + "description": "Contains basic information about a chat filter", + "class": "ChatFilterInfo", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Unique chat filter identifier" + }, + { + "name": "title", + "type": "string", + "description": "The title of the filter; 1-12 characters without line feeds" + }, + { + "name": "icon_name", + "type": "string", + "description": "The icon name for short filter representation. One of \"All\", \"Unread\", \"Unmuted\", \"Bots\", \"Channels\", \"Groups\", \"Private\", \"Custom\", \"Setup\", \"Cat\", \"Crown\", \"Favorite\", \"Flower\", \"Game\", \"Home\", \"Love\", \"Mask\", \"Party\", \"Sport\", \"Study\", \"Trade\", \"Travel\", \"Work\"" + } + ] + }, + { + "name": "recommendedChatFilter", + "description": "Describes a recommended chat filter", + "class": "RecommendedChatFilter", + "properties": [ + { + "name": "filter", + "type": "chatFilter", + "description": "The chat filter" + }, + { + "name": "description", + "type": "string", + "description": "Chat filter description" + } + ] + }, + { + "name": "recommendedChatFilters", + "description": "Contains a list of recommended chat filters", + "class": "RecommendedChatFilters", + "properties": [ + { + "name": "chat_filters", + "type": "vector\u003crecommendedChatFilter\u003e", + "description": "List of recommended chat filters" + } + ] + }, + { + "name": "chatListMain", + "description": "A main list of chats", + "class": "ChatList", + "properties": [] + }, + { + "name": "chatListArchive", + "description": "A list of chats usually located at the top of the main chat list. Unmuted chats are automatically moved from the Archive to the Main chat list when a new message arrives", + "class": "ChatList", + "properties": [] + }, + { + "name": "chatListFilter", + "description": "A list of chats belonging to a chat filter", + "class": "ChatList", + "properties": [ + { + "name": "chat_filter_id", + "type": "int32", + "description": "Chat filter identifier" + } + ] + }, + { + "name": "chatLists", + "description": "Contains a list of chat lists", + "class": "ChatLists", + "properties": [ + { + "name": "chat_lists", + "type": "vector\u003cChatList\u003e", + "description": "List of chat lists" + } + ] + }, + { + "name": "chatSourceMtprotoProxy", + "description": "The chat is sponsored by the user's MTProxy server", + "class": "ChatSource", + "properties": [] + }, + { + "name": "chatSourcePublicServiceAnnouncement", + "description": "The chat contains a public service announcement", + "class": "ChatSource", + "properties": [ + { + "name": "type", + "type": "string", + "description": "The type of the announcement" + }, + { + "name": "text", + "type": "string", + "description": "The text of the announcement" + } + ] + }, + { + "name": "chatPosition", + "description": "Describes a position of a chat in a chat list", + "class": "ChatPosition", + "properties": [ + { + "name": "list", + "type": "ChatList", + "description": "The chat list" + }, + { + "name": "order", + "type": "int64", + "description": "A parameter used to determine order of the chat in the chat list. Chats must be sorted by the pair (order, chat.id) in descending order" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the chat is pinned in the chat list" + }, + { + "name": "source", + "type": "ChatSource", + "description": "Source of the chat in the chat list; may be null" + } + ] + }, + { + "name": "chat", + "description": "A chat. (Can be a private chat, basic group, supergroup, or secret chat)", + "class": "Chat", + "properties": [ + { + "name": "id", + "type": "int53", + "description": "Chat unique identifier" + }, + { + "name": "type", + "type": "ChatType", + "description": "Type of the chat" + }, + { + "name": "title", + "type": "string", + "description": "Chat title" + }, + { + "name": "photo", + "type": "chatPhotoInfo", + "description": "Chat photo; may be null" + }, + { + "name": "permissions", + "type": "chatPermissions", + "description": "Actions that non-administrator chat members are allowed to take in the chat" + }, + { + "name": "last_message", + "type": "message", + "description": "Last message in the chat; may be null" + }, + { + "name": "positions", + "type": "vector\u003cchatPosition\u003e", + "description": "Positions of the chat in chat lists" + }, + { + "name": "is_marked_as_unread", + "type": "Bool", + "description": "True, if the chat is marked as unread" + }, + { + "name": "is_blocked", + "type": "Bool", + "description": "True, if the chat is blocked by the current user and private messages from the chat can't be received" + }, + { + "name": "has_scheduled_messages", + "type": "Bool", + "description": "True, if the chat has scheduled messages" + }, + { + "name": "can_be_deleted_only_for_self", + "type": "Bool", + "description": "True, if the chat messages can be deleted only for the current user while other users will continue to see the messages" + }, + { + "name": "can_be_deleted_for_all_users", + "type": "Bool", + "description": "True, if the chat messages can be deleted for all users" + }, + { + "name": "can_be_reported", + "type": "Bool", + "description": "True, if the chat can be reported to Telegram moderators through reportChat" + }, + { + "name": "default_disable_notification", + "type": "Bool", + "description": "Default value of the disable_notification parameter, used when a message is sent to the chat" + }, + { + "name": "unread_count", + "type": "int32", + "description": "Number of unread messages in the chat" + }, + { + "name": "last_read_inbox_message_id", + "type": "int53", + "description": "Identifier of the last read incoming message" + }, + { + "name": "last_read_outbox_message_id", + "type": "int53", + "description": "Identifier of the last read outgoing message" + }, + { + "name": "unread_mention_count", + "type": "int32", + "description": "Number of unread messages with a mention/reply in the chat" + }, + { + "name": "notification_settings", + "type": "chatNotificationSettings", + "description": "Notification settings for this chat" + }, + { + "name": "action_bar", + "type": "ChatActionBar", + "description": "Describes actions which should be possible to do through a chat action bar; may be null" + }, + { + "name": "reply_markup_message_id", + "type": "int53", + "description": "Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat" + }, + { + "name": "draft_message", + "type": "draftMessage", + "description": "A draft of a message in the chat; may be null" + }, + { + "name": "client_data", + "type": "string", + "description": "Contains application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used" + } + ] + }, + { + "name": "chats", + "description": "Represents a list of chats", + "class": "Chats", + "properties": [ + { + "name": "total_count", + "type": "int32", + "description": "Approximate total count of chats found" + }, + { + "name": "chat_ids", + "type": "vector\u003cint53\u003e", + "description": "List of chat identifiers" + } + ] + }, + { + "name": "chatNearby", + "description": "Describes a chat located nearby", + "class": "ChatNearby", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "distance", + "type": "int32", + "description": "Distance to the chat location, in meters" + } + ] + }, + { + "name": "chatsNearby", + "description": "Represents a list of chats located nearby", + "class": "ChatsNearby", + "properties": [ + { + "name": "users_nearby", + "type": "vector\u003cchatNearby\u003e", + "description": "List of users nearby" + }, + { + "name": "supergroups_nearby", + "type": "vector\u003cchatNearby\u003e", + "description": "List of location-based supergroups nearby" + } + ] + }, + { + "name": "chatInviteLink", + "description": "Contains a chat invite link", + "class": "ChatInviteLink", + "properties": [ + { + "name": "invite_link", + "type": "string", + "description": "Chat invite link" + } + ] + }, + { + "name": "chatInviteLinkInfo", + "description": "Contains information about a chat invite link", + "class": "ChatInviteLinkInfo", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier of the invite link; 0 if the user has no access to the chat before joining" + }, + { + "name": "accessible_for", + "type": "int32", + "description": "If non-zero, the amount of time for which read access to the chat will remain available, in seconds" + }, + { + "name": "type", + "type": "ChatType", + "description": "Contains information about the type of the chat" + }, + { + "name": "title", + "type": "string", + "description": "Title of the chat" + }, + { + "name": "photo", + "type": "chatPhotoInfo", + "description": "Chat photo; may be null" + }, + { + "name": "member_count", + "type": "int32", + "description": "Number of members in the chat" + }, + { + "name": "member_user_ids", + "type": "vector\u003cint32\u003e", + "description": "User identifiers of some chat members that may be known to the current user" + }, + { + "name": "is_public", + "type": "Bool", + "description": "True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup" + } + ] + }, + { + "name": "publicChatTypeHasUsername", + "description": "The chat is public, because it has username", + "class": "PublicChatType", + "properties": [] + }, + { + "name": "publicChatTypeIsLocationBased", + "description": "The chat is public, because it is a location-based supergroup", + "class": "PublicChatType", + "properties": [] + }, + { + "name": "chatActionBarReportSpam", + "description": "The chat can be reported as spam using the method reportChat with the reason chatReportReasonSpam", + "class": "ChatActionBar", + "properties": [ + { + "name": "can_unarchive", + "type": "Bool", + "description": "If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings" + } + ] + }, + { + "name": "chatActionBarReportUnrelatedLocation", + "description": "The chat is a location-based supergroup, which can be reported as having unrelated location using the method reportChat with the reason chatReportReasonUnrelatedLocation", + "class": "ChatActionBar", + "properties": [] + }, + { + "name": "chatActionBarReportAddBlock", + "description": "The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method blockUser, or the other user can be added to the contact list using the method addContact", + "class": "ChatActionBar", + "properties": [ + { + "name": "can_unarchive", + "type": "Bool", + "description": "If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings" + }, + { + "name": "distance", + "type": "int32", + "description": "If non-negative, the current user was found by the peer through searchChatsNearby and this is the distance between the users" + } + ] + }, + { + "name": "chatActionBarAddContact", + "description": "The chat is a private or secret chat and the other user can be added to the contact list using the method addContact", + "class": "ChatActionBar", + "properties": [] + }, + { + "name": "chatActionBarSharePhoneNumber", + "description": "The chat is a private or secret chat with a mutual contact and the user's phone number can be shared with the other user using the method sharePhoneNumber", + "class": "ChatActionBar", + "properties": [] + }, + { + "name": "keyboardButtonTypeText", + "description": "A simple button, with text that should be sent when the button is pressed", + "class": "KeyboardButtonType", + "properties": [] + }, + { + "name": "keyboardButtonTypeRequestPhoneNumber", + "description": "A button that sends the user's phone number when pressed; available only in private chats", + "class": "KeyboardButtonType", + "properties": [] + }, + { + "name": "keyboardButtonTypeRequestLocation", + "description": "A button that sends the user's location when pressed; available only in private chats", + "class": "KeyboardButtonType", + "properties": [] + }, + { + "name": "keyboardButtonTypeRequestPoll", + "description": "A button that allows the user to create and send a poll when pressed; available only in private chats", + "class": "KeyboardButtonType", + "properties": [ + { + "name": "force_regular", + "type": "Bool", + "description": "If true, only regular polls must be allowed to create" + }, + { + "name": "force_quiz", + "type": "Bool", + "description": "If true, only polls in quiz mode must be allowed to create" + } + ] + }, + { + "name": "keyboardButton", + "description": "Represents a single button in a bot keyboard", + "class": "KeyboardButton", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Text of the button" + }, + { + "name": "type", + "type": "KeyboardButtonType", + "description": "Type of the button" + } + ] + }, + { + "name": "inlineKeyboardButtonTypeUrl", + "description": "A button that opens a specified URL", + "class": "InlineKeyboardButtonType", + "properties": [ + { + "name": "url", + "type": "string", + "description": "HTTP or tg:// URL to open" + } + ] + }, + { + "name": "inlineKeyboardButtonTypeLoginUrl", + "description": "A button that opens a specified URL and automatically logs in in current user if they allowed to do that", + "class": "InlineKeyboardButtonType", + "properties": [ + { + "name": "url", + "type": "string", + "description": "An HTTP URL to open" + }, + { + "name": "id", + "type": "int32", + "description": "Unique button identifier" + }, + { + "name": "forward_text", + "type": "string", + "description": "If non-empty, new text of the button in forwarded messages" + } + ] + }, + { + "name": "inlineKeyboardButtonTypeCallback", + "description": "A button that sends a callback query to a bot", + "class": "InlineKeyboardButtonType", + "properties": [ + { + "name": "data", + "type": "bytes", + "description": "Data to be sent to the bot via a callback query" + } + ] + }, + { + "name": "inlineKeyboardButtonTypeCallbackWithPassword", + "description": "A button that asks for password of the current user and then sends a callback query to a bot", + "class": "InlineKeyboardButtonType", + "properties": [ + { + "name": "data", + "type": "bytes", + "description": "Data to be sent to the bot via a callback query" + } + ] + }, + { + "name": "inlineKeyboardButtonTypeCallbackGame", + "description": "A button with a game that sends a 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", + "class": "InlineKeyboardButtonType", + "properties": [] + }, + { + "name": "inlineKeyboardButtonTypeSwitchInline", + "description": "A button that forces an inline query to the bot to be inserted in the input field", + "class": "InlineKeyboardButtonType", + "properties": [ + { + "name": "query", + "type": "string", + "description": "Inline query to be sent to the bot" + }, + { + "name": "in_current_chat", + "type": "Bool", + "description": "True, if the inline query should be sent from the current chat" + } + ] + }, + { + "name": "inlineKeyboardButtonTypeBuy", + "description": "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", + "class": "InlineKeyboardButtonType", + "properties": [] + }, + { + "name": "inlineKeyboardButton", + "description": "Represents a single button in an inline keyboard", + "class": "InlineKeyboardButton", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Text of the button" + }, + { + "name": "type", + "type": "InlineKeyboardButtonType", + "description": "Type of the button" + } + ] + }, + { + "name": "replyMarkupRemoveKeyboard", + "description": "Instructs application 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", + "class": "ReplyMarkup", + "properties": [ + { + "name": "is_personal", + "type": "Bool", + "description": "True, if the keyboard is removed only for the mentioned users or the target user of a reply" + } + ] + }, + { + "name": "replyMarkupForceReply", + "description": "Instructs application to force a reply to this message", + "class": "ReplyMarkup", + "properties": [ + { + "name": "is_personal", + "type": "Bool", + "description": "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" + } + ] + }, + { + "name": "replyMarkupShowKeyboard", + "description": "Contains a custom keyboard layout to quickly reply to bots", + "class": "ReplyMarkup", + "properties": [ + { + "name": "rows", + "type": "vector\u003cvector\u003ckeyboardButton\u003e\u003e", + "description": "A list of rows of bot keyboard buttons" + }, + { + "name": "resize_keyboard", + "type": "Bool", + "description": "True, if the application needs to resize the keyboard vertically" + }, + { + "name": "one_time", + "type": "Bool", + "description": "True, if the application needs to hide the keyboard after use" + }, + { + "name": "is_personal", + "type": "Bool", + "description": "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" + } + ] + }, + { + "name": "replyMarkupInlineKeyboard", + "description": "Contains an inline keyboard layout", + "class": "ReplyMarkup", + "properties": [ + { + "name": "rows", + "type": "vector\u003cvector\u003cinlineKeyboardButton\u003e\u003e", + "description": "A list of rows of inline keyboard buttons" + } + ] + }, + { + "name": "loginUrlInfoOpen", + "description": "An HTTP url needs to be open", + "class": "LoginUrlInfo", + "properties": [ + { + "name": "url", + "type": "string", + "description": "The URL to open" + }, + { + "name": "skip_confirm", + "type": "Bool", + "description": "True, if there is no need to show an ordinary open URL confirm" + } + ] + }, + { + "name": "loginUrlInfoRequestConfirmation", + "description": "An authorization confirmation dialog needs to be shown to the user", + "class": "LoginUrlInfo", + "properties": [ + { + "name": "url", + "type": "string", + "description": "An HTTP URL to be opened" + }, + { + "name": "domain", + "type": "string", + "description": "A domain of the URL" + }, + { + "name": "bot_user_id", + "type": "int32", + "description": "User identifier of a bot linked with the website" + }, + { + "name": "request_write_access", + "type": "Bool", + "description": "True, if the user needs to be requested to give the permission to the bot to send them messages" + } + ] + }, + { + "name": "messageThreadInfo", + "description": "Contains information about a message thread", + "class": "MessageThreadInfo", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to which the message thread belongs" + }, + { + "name": "message_thread_id", + "type": "int53", + "description": "Message thread identifier, unique within the chat" + }, + { + "name": "reply_info", + "type": "messageReplyInfo", + "description": "Contains information about the message thread" + }, + { + "name": "messages", + "type": "vector\u003cmessage\u003e", + "description": "The messages from which the thread starts. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id)" + }, + { + "name": "draft_message", + "type": "draftMessage", + "description": "A draft of a message in the message thread; may be null" + } + ] + }, + { + "name": "richTextPlain", + "description": "A plain text", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Text" + } + ] + }, + { + "name": "richTextBold", + "description": "A bold rich text", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + } + ] + }, + { + "name": "richTextItalic", + "description": "An italicized rich text", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + } + ] + }, + { + "name": "richTextUnderline", + "description": "An underlined rich text", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + } + ] + }, + { + "name": "richTextStrikethrough", + "description": "A strikethrough rich text", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + } + ] + }, + { + "name": "richTextFixed", + "description": "A fixed-width rich text", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + } + ] + }, + { + "name": "richTextUrl", + "description": "A rich text URL link", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + }, + { + "name": "url", + "type": "string", + "description": "URL" + }, + { + "name": "is_cached", + "type": "Bool", + "description": "True, if the URL has cached instant view server-side" + } + ] + }, + { + "name": "richTextEmailAddress", + "description": "A rich text email link", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + }, + { + "name": "email_address", + "type": "string", + "description": "Email address" + } + ] + }, + { + "name": "richTextSubscript", + "description": "A subscript rich text", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + } + ] + }, + { + "name": "richTextSuperscript", + "description": "A superscript rich text", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + } + ] + }, + { + "name": "richTextMarked", + "description": "A marked rich text", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + } + ] + }, + { + "name": "richTextPhoneNumber", + "description": "A rich text phone number", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + }, + { + "name": "phone_number", + "type": "string", + "description": "Phone number" + } + ] + }, + { + "name": "richTextIcon", + "description": "A small image inside the text", + "class": "RichText", + "properties": [ + { + "name": "document", + "type": "document", + "description": "The image represented as a document. The image can be in GIF, JPEG or PNG format" + }, + { + "name": "width", + "type": "int32", + "description": "Width of a bounding box in which the image should be shown; 0 if unknown" + }, + { + "name": "height", + "type": "int32", + "description": "Height of a bounding box in which the image should be shown; 0 if unknown" + } + ] + }, + { + "name": "richTextReference", + "description": "A reference to a richTexts object on the same web page", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "The text" + }, + { + "name": "anchor_name", + "type": "string", + "description": "The name of a richTextAnchor object, which is the first element of the target richTexts object" + }, + { + "name": "url", + "type": "string", + "description": "An HTTP URL, opening the reference" + } + ] + }, + { + "name": "richTextAnchor", + "description": "An anchor", + "class": "RichText", + "properties": [ + { + "name": "name", + "type": "string", + "description": "Anchor name" + } + ] + }, + { + "name": "richTextAnchorLink", + "description": "A link to an anchor on the same web page", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "The link text" + }, + { + "name": "anchor_name", + "type": "string", + "description": "The anchor name. If the name is empty, the link should bring back to top" + }, + { + "name": "url", + "type": "string", + "description": "An HTTP URL, opening the anchor" + } + ] + }, + { + "name": "richTexts", + "description": "A concatenation of rich texts", + "class": "RichText", + "properties": [ + { + "name": "texts", + "type": "vector\u003cRichText\u003e", + "description": "Texts" + } + ] + }, + { + "name": "pageBlockCaption", + "description": "Contains a caption of an instant view web page block, consisting of a text and a trailing credit", + "class": "PageBlockCaption", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Content of the caption" + }, + { + "name": "credit", + "type": "RichText", + "description": "Block credit (like HTML tag \u003ccite\u003e)" + } + ] + }, + { + "name": "pageBlockListItem", + "description": "Describes an item of a list page block", + "class": "PageBlockListItem", + "properties": [ + { + "name": "label", + "type": "string", + "description": "Item label" + }, + { + "name": "page_blocks", + "type": "vector\u003cPageBlock\u003e", + "description": "Item blocks" + } + ] + }, + { + "name": "pageBlockHorizontalAlignmentLeft", + "description": "The content should be left-aligned", + "class": "PageBlockHorizontalAlignment", + "properties": [] + }, + { + "name": "pageBlockHorizontalAlignmentCenter", + "description": "The content should be center-aligned", + "class": "PageBlockHorizontalAlignment", + "properties": [] + }, + { + "name": "pageBlockHorizontalAlignmentRight", + "description": "The content should be right-aligned", + "class": "PageBlockHorizontalAlignment", + "properties": [] + }, + { + "name": "pageBlockVerticalAlignmentTop", + "description": "The content should be top-aligned", + "class": "PageBlockVerticalAlignment", + "properties": [] + }, + { + "name": "pageBlockVerticalAlignmentMiddle", + "description": "The content should be middle-aligned", + "class": "PageBlockVerticalAlignment", + "properties": [] + }, + { + "name": "pageBlockVerticalAlignmentBottom", + "description": "The content should be bottom-aligned", + "class": "PageBlockVerticalAlignment", + "properties": [] + }, + { + "name": "pageBlockTableCell", + "description": "Represents a cell of a table", + "class": "PageBlockTableCell", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Cell text; may be null. If the text is null, then the cell should be invisible" + }, + { + "name": "is_header", + "type": "Bool", + "description": "True, if it is a header cell" + }, + { + "name": "colspan", + "type": "int32", + "description": "The number of columns the cell should span" + }, + { + "name": "rowspan", + "type": "int32", + "description": "The number of rows the cell should span" + }, + { + "name": "align", + "type": "PageBlockHorizontalAlignment", + "description": "Horizontal cell content alignment" + }, + { + "name": "valign", + "type": "PageBlockVerticalAlignment", + "description": "Vertical cell content alignment" + } + ] + }, + { + "name": "pageBlockRelatedArticle", + "description": "Contains information about a related article", + "class": "PageBlockRelatedArticle", + "properties": [ + { + "name": "url", + "type": "string", + "description": "Related article URL" + }, + { + "name": "title", + "type": "string", + "description": "Article title; may be empty" + }, + { + "name": "description", + "type": "string", + "description": "Article description; may be empty" + }, + { + "name": "photo", + "type": "photo", + "description": "Article photo; may be null" + }, + { + "name": "author", + "type": "string", + "description": "Article author; may be empty" + }, + { + "name": "publish_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the article was published; 0 if unknown" + } + ] + }, + { + "name": "pageBlockTitle", + "description": "The title of a page", + "class": "PageBlock", + "properties": [ + { + "name": "title", + "type": "RichText", + "description": "Title" + } + ] + }, + { + "name": "pageBlockSubtitle", + "description": "The subtitle of a page", + "class": "PageBlock", + "properties": [ + { + "name": "subtitle", + "type": "RichText", + "description": "Subtitle" + } + ] + }, + { + "name": "pageBlockAuthorDate", + "description": "The author and publishing date of a page", + "class": "PageBlock", + "properties": [ + { + "name": "author", + "type": "RichText", + "description": "Author" + }, + { + "name": "publish_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the article was published; 0 if unknown" + } + ] + }, + { + "name": "pageBlockHeader", + "description": "A header", + "class": "PageBlock", + "properties": [ + { + "name": "header", + "type": "RichText", + "description": "Header" + } + ] + }, + { + "name": "pageBlockSubheader", + "description": "A subheader", + "class": "PageBlock", + "properties": [ + { + "name": "subheader", + "type": "RichText", + "description": "Subheader" + } + ] + }, + { + "name": "pageBlockKicker", + "description": "A kicker", + "class": "PageBlock", + "properties": [ + { + "name": "kicker", + "type": "RichText", + "description": "Kicker" + } + ] + }, + { + "name": "pageBlockParagraph", + "description": "A text paragraph", + "class": "PageBlock", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Paragraph text" + } + ] + }, + { + "name": "pageBlockPreformatted", + "description": "A preformatted text paragraph", + "class": "PageBlock", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Paragraph text" + }, + { + "name": "language", + "type": "string", + "description": "Programming language for which the text should be formatted" + } + ] + }, + { + "name": "pageBlockFooter", + "description": "The footer of a page", + "class": "PageBlock", + "properties": [ + { + "name": "footer", + "type": "RichText", + "description": "Footer" + } + ] + }, + { + "name": "pageBlockDivider", + "description": "An empty block separating a page", + "class": "PageBlock", + "properties": [] + }, + { + "name": "pageBlockAnchor", + "description": "An invisible anchor on a page, which can be used in a URL to open the page from the specified anchor", + "class": "PageBlock", + "properties": [ + { + "name": "name", + "type": "string", + "description": "Name of the anchor" + } + ] + }, + { + "name": "pageBlockList", + "description": "A list of data blocks", + "class": "PageBlock", + "properties": [ + { + "name": "items", + "type": "vector\u003cpageBlockListItem\u003e", + "description": "The items of the list" + } + ] + }, + { + "name": "pageBlockBlockQuote", + "description": "A block quote", + "class": "PageBlock", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Quote text" + }, + { + "name": "credit", + "type": "RichText", + "description": "Quote credit" + } + ] + }, + { + "name": "pageBlockPullQuote", + "description": "A pull quote", + "class": "PageBlock", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Quote text" + }, + { + "name": "credit", + "type": "RichText", + "description": "Quote credit" + } + ] + }, + { + "name": "pageBlockAnimation", + "description": "An animation", + "class": "PageBlock", + "properties": [ + { + "name": "animation", + "type": "animation", + "description": "Animation file; may be null" + }, + { + "name": "caption", + "type": "pageBlockCaption", + "description": "Animation caption" + }, + { + "name": "need_autoplay", + "type": "Bool", + "description": "True, if the animation should be played automatically" + } + ] + }, + { + "name": "pageBlockAudio", + "description": "An audio file", + "class": "PageBlock", + "properties": [ + { + "name": "audio", + "type": "audio", + "description": "Audio file; may be null" + }, + { + "name": "caption", + "type": "pageBlockCaption", + "description": "Audio file caption" + } + ] + }, + { + "name": "pageBlockPhoto", + "description": "A photo", + "class": "PageBlock", + "properties": [ + { + "name": "photo", + "type": "photo", + "description": "Photo file; may be null" + }, + { + "name": "caption", + "type": "pageBlockCaption", + "description": "Photo caption" + }, + { + "name": "url", + "type": "string", + "description": "URL that needs to be opened when the photo is clicked" + } + ] + }, + { + "name": "pageBlockVideo", + "description": "A video", + "class": "PageBlock", + "properties": [ + { + "name": "video", + "type": "video", + "description": "Video file; may be null" + }, + { + "name": "caption", + "type": "pageBlockCaption", + "description": "Video caption" + }, + { + "name": "need_autoplay", + "type": "Bool", + "description": "True, if the video should be played automatically" + }, + { + "name": "is_looped", + "type": "Bool", + "description": "True, if the video should be looped" + } + ] + }, + { + "name": "pageBlockVoiceNote", + "description": "A voice note", + "class": "PageBlock", + "properties": [ + { + "name": "voice_note", + "type": "voiceNote", + "description": "Voice note; may be null" + }, + { + "name": "caption", + "type": "pageBlockCaption", + "description": "Voice note caption" + } + ] + }, + { + "name": "pageBlockCover", + "description": "A page cover", + "class": "PageBlock", + "properties": [ + { + "name": "cover", + "type": "PageBlock", + "description": "Cover" + } + ] + }, + { + "name": "pageBlockEmbedded", + "description": "An embedded web page", + "class": "PageBlock", + "properties": [ + { + "name": "url", + "type": "string", + "description": "Web page URL, if available" + }, + { + "name": "html", + "type": "string", + "description": "HTML-markup of the embedded page" + }, + { + "name": "poster_photo", + "type": "photo", + "description": "Poster photo, if available; may be null" + }, + { + "name": "width", + "type": "int32", + "description": "Block width; 0 if unknown" + }, + { + "name": "height", + "type": "int32", + "description": "Block height; 0 if unknown" + }, + { + "name": "caption", + "type": "pageBlockCaption", + "description": "Block caption" + }, + { + "name": "is_full_width", + "type": "Bool", + "description": "True, if the block should be full width" + }, + { + "name": "allow_scrolling", + "type": "Bool", + "description": "True, if scrolling should be allowed" + } + ] + }, + { + "name": "pageBlockEmbeddedPost", + "description": "An embedded post", + "class": "PageBlock", + "properties": [ + { + "name": "url", + "type": "string", + "description": "Web page URL" + }, + { + "name": "author", + "type": "string", + "description": "Post author" + }, + { + "name": "author_photo", + "type": "photo", + "description": "Post author photo; may be null" + }, + { + "name": "date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the post was created; 0 if unknown" + }, + { + "name": "page_blocks", + "type": "vector\u003cPageBlock\u003e", + "description": "Post content" + }, + { + "name": "caption", + "type": "pageBlockCaption", + "description": "Post caption" + } + ] + }, + { + "name": "pageBlockCollage", + "description": "A collage", + "class": "PageBlock", + "properties": [ + { + "name": "page_blocks", + "type": "vector\u003cPageBlock\u003e", + "description": "Collage item contents" + }, + { + "name": "caption", + "type": "pageBlockCaption", + "description": "Block caption" + } + ] + }, + { + "name": "pageBlockSlideshow", + "description": "A slideshow", + "class": "PageBlock", + "properties": [ + { + "name": "page_blocks", + "type": "vector\u003cPageBlock\u003e", + "description": "Slideshow item contents" + }, + { + "name": "caption", + "type": "pageBlockCaption", + "description": "Block caption" + } + ] + }, + { + "name": "pageBlockChatLink", + "description": "A link to a chat", + "class": "PageBlock", + "properties": [ + { + "name": "title", + "type": "string", + "description": "Chat title" + }, + { + "name": "photo", + "type": "chatPhotoInfo", + "description": "Chat photo; may be null" + }, + { + "name": "username", + "type": "string", + "description": "Chat username, by which all other information about the chat should be resolved" + } + ] + }, + { + "name": "pageBlockTable", + "description": "A table", + "class": "PageBlock", + "properties": [ + { + "name": "caption", + "type": "RichText", + "description": "Table caption" + }, + { + "name": "cells", + "type": "vector\u003cvector\u003cpageBlockTableCell\u003e\u003e", + "description": "Table cells" + }, + { + "name": "is_bordered", + "type": "Bool", + "description": "True, if the table is bordered" + }, + { + "name": "is_striped", + "type": "Bool", + "description": "True, if the table is striped" + } + ] + }, + { + "name": "pageBlockDetails", + "description": "A collapsible block", + "class": "PageBlock", + "properties": [ + { + "name": "header", + "type": "RichText", + "description": "Always visible heading for the block" + }, + { + "name": "page_blocks", + "type": "vector\u003cPageBlock\u003e", + "description": "Block contents" + }, + { + "name": "is_open", + "type": "Bool", + "description": "True, if the block is open by default" + } + ] + }, + { + "name": "pageBlockRelatedArticles", + "description": "Related articles", + "class": "PageBlock", + "properties": [ + { + "name": "header", + "type": "RichText", + "description": "Block header" + }, + { + "name": "articles", + "type": "vector\u003cpageBlockRelatedArticle\u003e", + "description": "List of related articles" + } + ] + }, + { + "name": "pageBlockMap", + "description": "A map", + "class": "PageBlock", + "properties": [ + { + "name": "location", + "type": "location", + "description": "Location of the map center" + }, + { + "name": "zoom", + "type": "int32", + "description": "Map zoom level" + }, + { + "name": "width", + "type": "int32", + "description": "Map width" + }, + { + "name": "height", + "type": "int32", + "description": "Map height" + }, + { + "name": "caption", + "type": "pageBlockCaption", + "description": "Block caption" + } + ] + }, + { + "name": "webPageInstantView", + "description": "Describes an instant view page for a web page", + "class": "WebPageInstantView", + "properties": [ + { + "name": "page_blocks", + "type": "vector\u003cPageBlock\u003e", + "description": "Content of the web page" + }, + { + "name": "view_count", + "type": "int32", + "description": "Number of the instant view views; 0 if unknown" + }, + { + "name": "version", + "type": "int32", + "description": "Version of the instant view, currently can be 1 or 2" + }, + { + "name": "is_rtl", + "type": "Bool", + "description": "True, if the instant view must be shown from right to left" + }, + { + "name": "is_full", + "type": "Bool", + "description": "True, if the instant view contains the full page. A network request might be needed to get the full web page instant view" + } + ] + }, + { + "name": "webPage", + "description": "Describes a web page preview", + "class": "WebPage", + "properties": [ + { + "name": "url", + "type": "string", + "description": "Original URL of the link" + }, + { + "name": "display_url", + "type": "string", + "description": "URL to display" + }, + { + "name": "type", + "type": "string", + "description": "Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else" + }, + { + "name": "site_name", + "type": "string", + "description": "Short name of the site (e.g., Google Docs, App Store)" + }, + { + "name": "title", + "type": "string", + "description": "Title of the content" + }, + { + "name": "description", + "type": "formattedText", + "description": "Description of the content" + }, + { + "name": "photo", + "type": "photo", + "description": "Image representing the content; may be null" + }, + { + "name": "embed_url", + "type": "string", + "description": "URL to show in the embedded preview" + }, + { + "name": "embed_type", + "type": "string", + "description": "MIME type of the embedded preview, (e.g., text/html or video/mp4)" + }, + { + "name": "embed_width", + "type": "int32", + "description": "Width of the embedded preview" + }, + { + "name": "embed_height", + "type": "int32", + "description": "Height of the embedded preview" + }, + { + "name": "duration", + "type": "int32", + "description": "Duration of the content, in seconds" + }, + { + "name": "author", + "type": "string", + "description": "Author of the content" + }, + { + "name": "animation", + "type": "animation", + "description": "Preview of the content as an animation, if available; may be null" + }, + { + "name": "audio", + "type": "audio", + "description": "Preview of the content as an audio file, if available; may be null" + }, + { + "name": "document", + "type": "document", + "description": "Preview of the content as a document, if available (currently only available for small PDF files and ZIP archives); may be null" + }, + { + "name": "sticker", + "type": "sticker", + "description": "Preview of the content as a sticker for small WEBP files, if available; may be null" + }, + { + "name": "video", + "type": "video", + "description": "Preview of the content as a video, if available; may be null" + }, + { + "name": "video_note", + "type": "videoNote", + "description": "Preview of the content as a video note, if available; may be null" + }, + { + "name": "voice_note", + "type": "voiceNote", + "description": "Preview of the content as a voice note, if available; may be null" + }, + { + "name": "instant_view_version", + "type": "int32", + "description": "Version of instant view, available for the web page (currently can be 1 or 2), 0 if none" + } + ] + }, + { + "name": "countryInfo", + "description": "Contains information about a country", + "class": "CountryInfo", + "properties": [ + { + "name": "country_code", + "type": "string", + "description": "A two-letter ISO 3166-1 alpha-2 country code" + }, + { + "name": "name", + "type": "string", + "description": "Native name of the country" + }, + { + "name": "english_name", + "type": "string", + "description": "English name of the country" + }, + { + "name": "is_hidden", + "type": "Bool", + "description": "True, if the country should be hidden from the list of all countries" + }, + { + "name": "calling_codes", + "type": "vector\u003cstring\u003e", + "description": "List of country calling codes" + } + ] + }, + { + "name": "countries", + "description": "Contains information about countries", + "class": "Countries", + "properties": [ + { + "name": "countries", + "type": "vector\u003ccountryInfo\u003e", + "description": "The list of countries" + } + ] + }, + { + "name": "phoneNumberInfo", + "description": "Contains information about a phone number", + "class": "PhoneNumberInfo", + "properties": [ + { + "name": "country", + "type": "countryInfo", + "description": "Information about the country to which the phone number belongs; may be null" + }, + { + "name": "country_calling_code", + "type": "string", + "description": "The part of the phone number denoting country calling code or its part" + }, + { + "name": "formatted_phone_number", + "type": "string", + "description": "The phone number without country calling code formatted accordingly to local rules" + } + ] + }, + { + "name": "bankCardActionOpenUrl", + "description": "Describes an action associated with a bank card number", + "class": "BankCardActionOpenUrl", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Action text" + }, + { + "name": "url", + "type": "string", + "description": "The URL to be opened" + } + ] + }, + { + "name": "bankCardInfo", + "description": "Information about a bank card", + "class": "BankCardInfo", + "properties": [ + { + "name": "title", + "type": "string", + "description": "Title of the bank card description" + }, + { + "name": "actions", + "type": "vector\u003cbankCardActionOpenUrl\u003e", + "description": "Actions that can be done with the bank card number" + } + ] + }, + { + "name": "address", + "description": "Describes an address", + "class": "Address", + "properties": [ + { + "name": "country_code", + "type": "string", + "description": "A two-letter ISO 3166-1 alpha-2 country code" + }, + { + "name": "state", + "type": "string", + "description": "State, if applicable" + }, + { + "name": "city", + "type": "string", + "description": "City" + }, + { + "name": "street_line1", + "type": "string", + "description": "First line of the address" + }, + { + "name": "street_line2", + "type": "string", + "description": "Second line of the address" + }, + { + "name": "postal_code", + "type": "string", + "description": "Address postal code" + } + ] + }, + { + "name": "labeledPricePart", + "description": "Portion of the price of a product (e.g., \"delivery cost\", \"tax amount\")", + "class": "LabeledPricePart", + "properties": [ + { + "name": "label", + "type": "string", + "description": "Label for this portion of the product price" + }, + { + "name": "amount", + "type": "int53", + "description": "Currency amount in minimal quantity of the currency" + } + ] + }, + { + "name": "invoice", + "description": "Product invoice", + "class": "Invoice", + "properties": [ + { + "name": "currency", + "type": "string", + "description": "ISO 4217 currency code" + }, + { + "name": "price_parts", + "type": "vector\u003clabeledPricePart\u003e", + "description": "A list of objects used to calculate the total price of the product" + }, + { + "name": "is_test", + "type": "Bool", + "description": "True, if the payment is a test payment" + }, + { + "name": "need_name", + "type": "Bool", + "description": "True, if the user's name is needed for payment" + }, + { + "name": "need_phone_number", + "type": "Bool", + "description": "True, if the user's phone number is needed for payment" + }, + { + "name": "need_email_address", + "type": "Bool", + "description": "True, if the user's email address is needed for payment" + }, + { + "name": "need_shipping_address", + "type": "Bool", + "description": "True, if the user's shipping address is needed for payment" + }, + { + "name": "send_phone_number_to_provider", + "type": "Bool", + "description": "True, if the user's phone number will be sent to the provider" + }, + { + "name": "send_email_address_to_provider", + "type": "Bool", + "description": "True, if the user's email address will be sent to the provider" + }, + { + "name": "is_flexible", + "type": "Bool", + "description": "True, if the total price depends on the shipping method" + } + ] + }, + { + "name": "orderInfo", + "description": "Order information", + "class": "OrderInfo", + "properties": [ + { + "name": "name", + "type": "string", + "description": "Name of the user" + }, + { + "name": "phone_number", + "type": "string", + "description": "Phone number of the user" + }, + { + "name": "email_address", + "type": "string", + "description": "Email address of the user" + }, + { + "name": "shipping_address", + "type": "address", + "description": "Shipping address for this order; may be null" + } + ] + }, + { + "name": "shippingOption", + "description": "One shipping option", + "class": "ShippingOption", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Shipping option identifier" + }, + { + "name": "title", + "type": "string", + "description": "Option title" + }, + { + "name": "price_parts", + "type": "vector\u003clabeledPricePart\u003e", + "description": "A list of objects used to calculate the total shipping costs" + } + ] + }, + { + "name": "savedCredentials", + "description": "Contains information about saved card credentials", + "class": "SavedCredentials", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the saved credentials" + }, + { + "name": "title", + "type": "string", + "description": "Title of the saved credentials" + } + ] + }, + { + "name": "inputCredentialsSaved", + "description": "Applies if a user chooses some previously saved payment credentials. To use their previously saved credentials, the user must have a valid temporary password", + "class": "InputCredentials", + "properties": [ + { + "name": "saved_credentials_id", + "type": "string", + "description": "Identifier of the saved credentials" + } + ] + }, + { + "name": "inputCredentialsNew", + "description": "Applies if a user enters new credentials on a payment provider website", + "class": "InputCredentials", + "properties": [ + { + "name": "data", + "type": "string", + "description": "Contains JSON-encoded data with a credential identifier from the payment provider" + }, + { + "name": "allow_save", + "type": "Bool", + "description": "True, if the credential identifier can be saved on the server side" + } + ] + }, + { + "name": "inputCredentialsAndroidPay", + "description": "Applies if a user enters new credentials using Android Pay", + "class": "InputCredentials", + "properties": [ + { + "name": "data", + "type": "string", + "description": "JSON-encoded data with the credential identifier" + } + ] + }, + { + "name": "inputCredentialsApplePay", + "description": "Applies if a user enters new credentials using Apple Pay", + "class": "InputCredentials", + "properties": [ + { + "name": "data", + "type": "string", + "description": "JSON-encoded data with the credential identifier" + } + ] + }, + { + "name": "paymentsProviderStripe", + "description": "Stripe payment provider", + "class": "PaymentsProviderStripe", + "properties": [ + { + "name": "publishable_key", + "type": "string", + "description": "Stripe API publishable key" + }, + { + "name": "need_country", + "type": "Bool", + "description": "True, if the user country must be provided" + }, + { + "name": "need_postal_code", + "type": "Bool", + "description": "True, if the user ZIP/postal code must be provided" + }, + { + "name": "need_cardholder_name", + "type": "Bool", + "description": "True, if the cardholder name must be provided" + } + ] + }, + { + "name": "paymentForm", + "description": "Contains information about an invoice payment form", + "class": "PaymentForm", + "properties": [ + { + "name": "invoice", + "type": "invoice", + "description": "Full information of the invoice" + }, + { + "name": "url", + "type": "string", + "description": "Payment form URL" + }, + { + "name": "payments_provider", + "type": "paymentsProviderStripe", + "description": "Contains information about the payment provider, if available, to support it natively without the need for opening the URL; may be null" + }, + { + "name": "saved_order_info", + "type": "orderInfo", + "description": "Saved server-side order information; may be null" + }, + { + "name": "saved_credentials", + "type": "savedCredentials", + "description": "Contains information about saved card credentials; may be null" + }, + { + "name": "can_save_credentials", + "type": "Bool", + "description": "True, if the user can choose to save credentials" + }, + { + "name": "need_password", + "type": "Bool", + "description": "True, if the user will be able to save credentials protected by a password they set up" + } + ] + }, + { + "name": "validatedOrderInfo", + "description": "Contains a temporary identifier of validated order information, which is stored for one hour. Also contains the available shipping options", + "class": "ValidatedOrderInfo", + "properties": [ + { + "name": "order_info_id", + "type": "string", + "description": "Temporary identifier of the order information" + }, + { + "name": "shipping_options", + "type": "vector\u003cshippingOption\u003e", + "description": "Available shipping options" + } + ] + }, + { + "name": "paymentResult", + "description": "Contains the result of a payment request", + "class": "PaymentResult", + "properties": [ + { + "name": "success", + "type": "Bool", + "description": "True, if the payment request was successful; otherwise the verification_url will be not empty" + }, + { + "name": "verification_url", + "type": "string", + "description": "URL for additional payment credentials verification" + } + ] + }, + { + "name": "paymentReceipt", + "description": "Contains information about a successful payment", + "class": "PaymentReceipt", + "properties": [ + { + "name": "date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the payment was made" + }, + { + "name": "payments_provider_user_id", + "type": "int32", + "description": "User identifier of the payment provider bot" + }, + { + "name": "invoice", + "type": "invoice", + "description": "Contains information about the invoice" + }, + { + "name": "order_info", + "type": "orderInfo", + "description": "Contains order information; may be null" + }, + { + "name": "shipping_option", + "type": "shippingOption", + "description": "Chosen shipping option; may be null" + }, + { + "name": "credentials_title", + "type": "string", + "description": "Title of the saved credentials" + } + ] + }, + { + "name": "datedFile", + "description": "File with the date it was uploaded", + "class": "DatedFile", + "properties": [ + { + "name": "file", + "type": "file", + "description": "The file" + }, + { + "name": "date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the file was uploaded" + } + ] + }, + { + "name": "passportElementTypePersonalDetails", + "description": "A Telegram Passport element containing the user's personal details", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypePassport", + "description": "A Telegram Passport element containing the user's passport", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeDriverLicense", + "description": "A Telegram Passport element containing the user's driver license", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeIdentityCard", + "description": "A Telegram Passport element containing the user's identity card", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeInternalPassport", + "description": "A Telegram Passport element containing the user's internal passport", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeAddress", + "description": "A Telegram Passport element containing the user's address", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeUtilityBill", + "description": "A Telegram Passport element containing the user's utility bill", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeBankStatement", + "description": "A Telegram Passport element containing the user's bank statement", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeRentalAgreement", + "description": "A Telegram Passport element containing the user's rental agreement", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypePassportRegistration", + "description": "A Telegram Passport element containing the registration page of the user's passport", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeTemporaryRegistration", + "description": "A Telegram Passport element containing the user's temporary registration", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypePhoneNumber", + "description": "A Telegram Passport element containing the user's phone number", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeEmailAddress", + "description": "A Telegram Passport element containing the user's email address", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "date", + "description": "Represents a date according to the Gregorian calendar", + "class": "Date", + "properties": [ + { + "name": "day", + "type": "int32", + "description": "Day of the month, 1-31" + }, + { + "name": "month", + "type": "int32", + "description": "Month, 1-12" + }, + { + "name": "year", + "type": "int32", + "description": "Year, 1-9999" + } + ] + }, + { + "name": "personalDetails", + "description": "Contains the user's personal details", + "class": "PersonalDetails", + "properties": [ + { + "name": "first_name", + "type": "string", + "description": "First name of the user written in English; 1-255 characters" + }, + { + "name": "middle_name", + "type": "string", + "description": "Middle name of the user written in English; 0-255 characters" + }, + { + "name": "last_name", + "type": "string", + "description": "Last name of the user written in English; 1-255 characters" + }, + { + "name": "native_first_name", + "type": "string", + "description": "Native first name of the user; 1-255 characters" + }, + { + "name": "native_middle_name", + "type": "string", + "description": "Native middle name of the user; 0-255 characters" + }, + { + "name": "native_last_name", + "type": "string", + "description": "Native last name of the user; 1-255 characters" + }, + { + "name": "birthdate", + "type": "date", + "description": "Birthdate of the user" + }, + { + "name": "gender", + "type": "string", + "description": "Gender of the user, \"male\" or \"female\"" + }, + { + "name": "country_code", + "type": "string", + "description": "A two-letter ISO 3166-1 alpha-2 country code of the user's country" + }, + { + "name": "residence_country_code", + "type": "string", + "description": "A two-letter ISO 3166-1 alpha-2 country code of the user's residence country" + } + ] + }, + { + "name": "identityDocument", + "description": "An identity document", + "class": "IdentityDocument", + "properties": [ + { + "name": "number", + "type": "string", + "description": "Document number; 1-24 characters" + }, + { + "name": "expiry_date", + "type": "date", + "description": "Document expiry date; may be null" + }, + { + "name": "front_side", + "type": "datedFile", + "description": "Front side of the document" + }, + { + "name": "reverse_side", + "type": "datedFile", + "description": "Reverse side of the document; only for driver license and identity card" + }, + { + "name": "selfie", + "type": "datedFile", + "description": "Selfie with the document; may be null" + }, + { + "name": "translation", + "type": "vector\u003cdatedFile\u003e", + "description": "List of files containing a certified English translation of the document" + } + ] + }, + { + "name": "inputIdentityDocument", + "description": "An identity document to be saved to Telegram Passport", + "class": "InputIdentityDocument", + "properties": [ + { + "name": "number", + "type": "string", + "description": "Document number; 1-24 characters" + }, + { + "name": "expiry_date", + "type": "date", + "description": "Document expiry date, if available" + }, + { + "name": "front_side", + "type": "InputFile", + "description": "Front side of the document" + }, + { + "name": "reverse_side", + "type": "InputFile", + "description": "Reverse side of the document; only for driver license and identity card" + }, + { + "name": "selfie", + "type": "InputFile", + "description": "Selfie with the document, if available" + }, + { + "name": "translation", + "type": "vector\u003cInputFile\u003e", + "description": "List of files containing a certified English translation of the document" + } + ] + }, + { + "name": "personalDocument", + "description": "A personal document, containing some information about a user", + "class": "PersonalDocument", + "properties": [ + { + "name": "files", + "type": "vector\u003cdatedFile\u003e", + "description": "List of files containing the pages of the document" + }, + { + "name": "translation", + "type": "vector\u003cdatedFile\u003e", + "description": "List of files containing a certified English translation of the document" + } + ] + }, + { + "name": "inputPersonalDocument", + "description": "A personal document to be saved to Telegram Passport", + "class": "InputPersonalDocument", + "properties": [ + { + "name": "files", + "type": "vector\u003cInputFile\u003e", + "description": "List of files containing the pages of the document" + }, + { + "name": "translation", + "type": "vector\u003cInputFile\u003e", + "description": "List of files containing a certified English translation of the document" + } + ] + }, + { + "name": "passportElementPersonalDetails", + "description": "A Telegram Passport element containing the user's personal details", + "class": "PassportElement", + "properties": [ + { + "name": "personal_details", + "type": "personalDetails", + "description": "Personal details of the user" + } + ] + }, + { + "name": "passportElementPassport", + "description": "A Telegram Passport element containing the user's passport", + "class": "PassportElement", + "properties": [ + { + "name": "passport", + "type": "identityDocument", + "description": "Passport" + } + ] + }, + { + "name": "passportElementDriverLicense", + "description": "A Telegram Passport element containing the user's driver license", + "class": "PassportElement", + "properties": [ + { + "name": "driver_license", + "type": "identityDocument", + "description": "Driver license" + } + ] + }, + { + "name": "passportElementIdentityCard", + "description": "A Telegram Passport element containing the user's identity card", + "class": "PassportElement", + "properties": [ + { + "name": "identity_card", + "type": "identityDocument", + "description": "Identity card" + } + ] + }, + { + "name": "passportElementInternalPassport", + "description": "A Telegram Passport element containing the user's internal passport", + "class": "PassportElement", + "properties": [ + { + "name": "internal_passport", + "type": "identityDocument", + "description": "Internal passport" + } + ] + }, + { + "name": "passportElementAddress", + "description": "A Telegram Passport element containing the user's address", + "class": "PassportElement", + "properties": [ + { + "name": "address", + "type": "address", + "description": "Address" + } + ] + }, + { + "name": "passportElementUtilityBill", + "description": "A Telegram Passport element containing the user's utility bill", + "class": "PassportElement", + "properties": [ + { + "name": "utility_bill", + "type": "personalDocument", + "description": "Utility bill" + } + ] + }, + { + "name": "passportElementBankStatement", + "description": "A Telegram Passport element containing the user's bank statement", + "class": "PassportElement", + "properties": [ + { + "name": "bank_statement", + "type": "personalDocument", + "description": "Bank statement" + } + ] + }, + { + "name": "passportElementRentalAgreement", + "description": "A Telegram Passport element containing the user's rental agreement", + "class": "PassportElement", + "properties": [ + { + "name": "rental_agreement", + "type": "personalDocument", + "description": "Rental agreement" + } + ] + }, + { + "name": "passportElementPassportRegistration", + "description": "A Telegram Passport element containing the user's passport registration pages", + "class": "PassportElement", + "properties": [ + { + "name": "passport_registration", + "type": "personalDocument", + "description": "Passport registration pages" + } + ] + }, + { + "name": "passportElementTemporaryRegistration", + "description": "A Telegram Passport element containing the user's temporary registration", + "class": "PassportElement", + "properties": [ + { + "name": "temporary_registration", + "type": "personalDocument", + "description": "Temporary registration" + } + ] + }, + { + "name": "passportElementPhoneNumber", + "description": "A Telegram Passport element containing the user's phone number", + "class": "PassportElement", + "properties": [ + { + "name": "phone_number", + "type": "string", + "description": "Phone number" + } + ] + }, + { + "name": "passportElementEmailAddress", + "description": "A Telegram Passport element containing the user's email address", + "class": "PassportElement", + "properties": [ + { + "name": "email_address", + "type": "string", + "description": "Email address" + } + ] + }, + { + "name": "inputPassportElementPersonalDetails", + "description": "A Telegram Passport element to be saved containing the user's personal details", + "class": "InputPassportElement", + "properties": [ + { + "name": "personal_details", + "type": "personalDetails", + "description": "Personal details of the user" + } + ] + }, + { + "name": "inputPassportElementPassport", + "description": "A Telegram Passport element to be saved containing the user's passport", + "class": "InputPassportElement", + "properties": [ + { + "name": "passport", + "type": "inputIdentityDocument", + "description": "The passport to be saved" + } + ] + }, + { + "name": "inputPassportElementDriverLicense", + "description": "A Telegram Passport element to be saved containing the user's driver license", + "class": "InputPassportElement", + "properties": [ + { + "name": "driver_license", + "type": "inputIdentityDocument", + "description": "The driver license to be saved" + } + ] + }, + { + "name": "inputPassportElementIdentityCard", + "description": "A Telegram Passport element to be saved containing the user's identity card", + "class": "InputPassportElement", + "properties": [ + { + "name": "identity_card", + "type": "inputIdentityDocument", + "description": "The identity card to be saved" + } + ] + }, + { + "name": "inputPassportElementInternalPassport", + "description": "A Telegram Passport element to be saved containing the user's internal passport", + "class": "InputPassportElement", + "properties": [ + { + "name": "internal_passport", + "type": "inputIdentityDocument", + "description": "The internal passport to be saved" + } + ] + }, + { + "name": "inputPassportElementAddress", + "description": "A Telegram Passport element to be saved containing the user's address", + "class": "InputPassportElement", + "properties": [ + { + "name": "address", + "type": "address", + "description": "The address to be saved" + } + ] + }, + { + "name": "inputPassportElementUtilityBill", + "description": "A Telegram Passport element to be saved containing the user's utility bill", + "class": "InputPassportElement", + "properties": [ + { + "name": "utility_bill", + "type": "inputPersonalDocument", + "description": "The utility bill to be saved" + } + ] + }, + { + "name": "inputPassportElementBankStatement", + "description": "A Telegram Passport element to be saved containing the user's bank statement", + "class": "InputPassportElement", + "properties": [ + { + "name": "bank_statement", + "type": "inputPersonalDocument", + "description": "The bank statement to be saved" + } + ] + }, + { + "name": "inputPassportElementRentalAgreement", + "description": "A Telegram Passport element to be saved containing the user's rental agreement", + "class": "InputPassportElement", + "properties": [ + { + "name": "rental_agreement", + "type": "inputPersonalDocument", + "description": "The rental agreement to be saved" + } + ] + }, + { + "name": "inputPassportElementPassportRegistration", + "description": "A Telegram Passport element to be saved containing the user's passport registration", + "class": "InputPassportElement", + "properties": [ + { + "name": "passport_registration", + "type": "inputPersonalDocument", + "description": "The passport registration page to be saved" + } + ] + }, + { + "name": "inputPassportElementTemporaryRegistration", + "description": "A Telegram Passport element to be saved containing the user's temporary registration", + "class": "InputPassportElement", + "properties": [ + { + "name": "temporary_registration", + "type": "inputPersonalDocument", + "description": "The temporary registration document to be saved" + } + ] + }, + { + "name": "inputPassportElementPhoneNumber", + "description": "A Telegram Passport element to be saved containing the user's phone number", + "class": "InputPassportElement", + "properties": [ + { + "name": "phone_number", + "type": "string", + "description": "The phone number to be saved" + } + ] + }, + { + "name": "inputPassportElementEmailAddress", + "description": "A Telegram Passport element to be saved containing the user's email address", + "class": "InputPassportElement", + "properties": [ + { + "name": "email_address", + "type": "string", + "description": "The email address to be saved" + } + ] + }, + { + "name": "passportElements", + "description": "Contains information about saved Telegram Passport elements", + "class": "PassportElements", + "properties": [ + { + "name": "elements", + "type": "vector\u003cPassportElement\u003e", + "description": "Telegram Passport elements" + } + ] + }, + { + "name": "passportElementErrorSourceUnspecified", + "description": "The element contains an error in an unspecified place. The error will be considered resolved when new data is added", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementErrorSourceDataField", + "description": "One of the data fields contains an error. The error will be considered resolved when the value of the field changes", + "class": "PassportElementErrorSource", + "properties": [ + { + "name": "field_name", + "type": "string", + "description": "Field name" + } + ] + }, + { + "name": "passportElementErrorSourceFrontSide", + "description": "The front side of the document contains an error. The error will be considered resolved when the file with the front side changes", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementErrorSourceReverseSide", + "description": "The reverse side of the document contains an error. The error will be considered resolved when the file with the reverse side changes", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementErrorSourceSelfie", + "description": "The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementErrorSourceTranslationFile", + "description": "One of files with the translation of the document contains an error. The error will be considered resolved when the file changes", + "class": "PassportElementErrorSource", + "properties": [ + { + "name": "file_index", + "type": "int32", + "description": "Index of a file with the error" + } + ] + }, + { + "name": "passportElementErrorSourceTranslationFiles", + "description": "The translation of the document contains an error. The error will be considered resolved when the list of translation files changes", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementErrorSourceFile", + "description": "The file contains an error. The error will be considered resolved when the file changes", + "class": "PassportElementErrorSource", + "properties": [ + { + "name": "file_index", + "type": "int32", + "description": "Index of a file with the error" + } + ] + }, + { + "name": "passportElementErrorSourceFiles", + "description": "The list of attached files contains an error. The error will be considered resolved when the list of files changes", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementError", + "description": "Contains the description of an error in a Telegram Passport element", + "class": "PassportElementError", + "properties": [ + { + "name": "type", + "type": "PassportElementType", + "description": "Type of the Telegram Passport element which has the error" + }, + { + "name": "message", + "type": "string", + "description": "Error message" + }, + { + "name": "source", + "type": "PassportElementErrorSource", + "description": "Error source" + } + ] + }, + { + "name": "passportSuitableElement", + "description": "Contains information about a Telegram Passport element that was requested by a service", + "class": "PassportSuitableElement", + "properties": [ + { + "name": "type", + "type": "PassportElementType", + "description": "Type of the element" + }, + { + "name": "is_selfie_required", + "type": "Bool", + "description": "True, if a selfie is required with the identity document" + }, + { + "name": "is_translation_required", + "type": "Bool", + "description": "True, if a certified English translation is required with the document" + }, + { + "name": "is_native_name_required", + "type": "Bool", + "description": "True, if personal details must include the user's name in the language of their country of residence" + } + ] + }, + { + "name": "passportRequiredElement", + "description": "Contains a description of the required Telegram Passport element that was requested by a service", + "class": "PassportRequiredElement", + "properties": [ + { + "name": "suitable_elements", + "type": "vector\u003cpassportSuitableElement\u003e", + "description": "List of Telegram Passport elements any of which is enough to provide" + } + ] + }, + { + "name": "passportAuthorizationForm", + "description": "Contains information about a Telegram Passport authorization form that was requested", + "class": "PassportAuthorizationForm", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Unique identifier of the authorization form" + }, + { + "name": "required_elements", + "type": "vector\u003cpassportRequiredElement\u003e", + "description": "Information about the Telegram Passport elements that must be provided to complete the form" + }, + { + "name": "privacy_policy_url", + "type": "string", + "description": "URL for the privacy policy of the service; may be empty" + } + ] + }, + { + "name": "passportElementsWithErrors", + "description": "Contains information about a Telegram Passport elements and corresponding errors", + "class": "PassportElementsWithErrors", + "properties": [ + { + "name": "elements", + "type": "vector\u003cPassportElement\u003e", + "description": "Telegram Passport elements" + }, + { + "name": "errors", + "type": "vector\u003cpassportElementError\u003e", + "description": "Errors in the elements that are already available" + } + ] + }, + { + "name": "encryptedCredentials", + "description": "Contains encrypted Telegram Passport data credentials", + "class": "EncryptedCredentials", + "properties": [ + { + "name": "data", + "type": "bytes", + "description": "The encrypted credentials" + }, + { + "name": "hash", + "type": "bytes", + "description": "The decrypted data hash" + }, + { + "name": "secret", + "type": "bytes", + "description": "Secret for data decryption, encrypted with the service's public key" + } + ] + }, + { + "name": "encryptedPassportElement", + "description": "Contains information about an encrypted Telegram Passport element; for bots only", + "class": "EncryptedPassportElement", + "properties": [ + { + "name": "type", + "type": "PassportElementType", + "description": "Type of Telegram Passport element" + }, + { + "name": "data", + "type": "bytes", + "description": "Encrypted JSON-encoded data about the user" + }, + { + "name": "front_side", + "type": "datedFile", + "description": "The front side of an identity document" + }, + { + "name": "reverse_side", + "type": "datedFile", + "description": "The reverse side of an identity document; may be null" + }, + { + "name": "selfie", + "type": "datedFile", + "description": "Selfie with the document; may be null" + }, + { + "name": "translation", + "type": "vector\u003cdatedFile\u003e", + "description": "List of files containing a certified English translation of the document" + }, + { + "name": "files", + "type": "vector\u003cdatedFile\u003e", + "description": "List of attached files" + }, + { + "name": "value", + "type": "string", + "description": "Unencrypted data, phone number or email address" + }, + { + "name": "hash", + "type": "string", + "description": "Hash of the entire element" + } + ] + }, + { + "name": "inputPassportElementErrorSourceUnspecified", + "description": "The element contains an error in an unspecified place. The error will be considered resolved when new data is added", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "element_hash", + "type": "bytes", + "description": "Current hash of the entire element" + } + ] + }, + { + "name": "inputPassportElementErrorSourceDataField", + "description": "A data field contains an error. The error is considered resolved when the field's value changes", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "field_name", + "type": "string", + "description": "Field name" + }, + { + "name": "data_hash", + "type": "bytes", + "description": "Current data hash" + } + ] + }, + { + "name": "inputPassportElementErrorSourceFrontSide", + "description": "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", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hash", + "type": "bytes", + "description": "Current hash of the file containing the front side" + } + ] + }, + { + "name": "inputPassportElementErrorSourceReverseSide", + "description": "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", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hash", + "type": "bytes", + "description": "Current hash of the file containing the reverse side" + } + ] + }, + { + "name": "inputPassportElementErrorSourceSelfie", + "description": "The selfie contains an error. The error is considered resolved when the file with the selfie changes", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hash", + "type": "bytes", + "description": "Current hash of the file containing the selfie" + } + ] + }, + { + "name": "inputPassportElementErrorSourceTranslationFile", + "description": "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", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hash", + "type": "bytes", + "description": "Current hash of the file containing the translation" + } + ] + }, + { + "name": "inputPassportElementErrorSourceTranslationFiles", + "description": "The translation of the document contains an error. The error is considered resolved when the list of files changes", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hashes", + "type": "vector\u003cbytes\u003e", + "description": "Current hashes of all files with the translation" + } + ] + }, + { + "name": "inputPassportElementErrorSourceFile", + "description": "The file contains an error. The error is considered resolved when the file changes", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hash", + "type": "bytes", + "description": "Current hash of the file which has the error" + } + ] + }, + { + "name": "inputPassportElementErrorSourceFiles", + "description": "The list of attached files contains an error. The error is considered resolved when the file list changes", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hashes", + "type": "vector\u003cbytes\u003e", + "description": "Current hashes of all attached files" + } + ] + }, + { + "name": "inputPassportElementError", + "description": "Contains the description of an error in a Telegram Passport element; for bots only", + "class": "InputPassportElementError", + "properties": [ + { + "name": "type", + "type": "PassportElementType", + "description": "Type of Telegram Passport element that has the error" + }, + { + "name": "message", + "type": "string", + "description": "Error message" + }, + { + "name": "source", + "type": "InputPassportElementErrorSource", + "description": "Error source" + } + ] + }, + { + "name": "messageText", + "description": "A text message", + "class": "MessageContent", + "properties": [ + { + "name": "text", + "type": "formattedText", + "description": "Text of the message" + }, + { + "name": "web_page", + "type": "webPage", + "description": "A preview of the web page that's mentioned in the text; may be null" + } + ] + }, + { + "name": "messageAnimation", + "description": "An animation message (GIF-style).", + "class": "MessageContent", + "properties": [ + { + "name": "animation", + "type": "animation", + "description": "The animation description" + }, + { + "name": "caption", + "type": "formattedText", + "description": "Animation caption" + }, + { + "name": "is_secret", + "type": "Bool", + "description": "True, if the animation thumbnail must be blurred and the animation must be shown only while tapped" + } + ] + }, + { + "name": "messageAudio", + "description": "An audio message", + "class": "MessageContent", + "properties": [ + { + "name": "audio", + "type": "audio", + "description": "The audio description" + }, + { + "name": "caption", + "type": "formattedText", + "description": "Audio caption" + } + ] + }, + { + "name": "messageDocument", + "description": "A document message (general file)", + "class": "MessageContent", + "properties": [ + { + "name": "document", + "type": "document", + "description": "The document description" + }, + { + "name": "caption", + "type": "formattedText", + "description": "Document caption" + } + ] + }, + { + "name": "messagePhoto", + "description": "A photo message", + "class": "MessageContent", + "properties": [ + { + "name": "photo", + "type": "photo", + "description": "The photo description" + }, + { + "name": "caption", + "type": "formattedText", + "description": "Photo caption" + }, + { + "name": "is_secret", + "type": "Bool", + "description": "True, if the photo must be blurred and must be shown only while tapped" + } + ] + }, + { + "name": "messageExpiredPhoto", + "description": "An expired photo message (self-destructed after TTL has elapsed)", + "class": "MessageContent", + "properties": [] + }, + { + "name": "messageSticker", + "description": "A sticker message", + "class": "MessageContent", + "properties": [ + { + "name": "sticker", + "type": "sticker", + "description": "The sticker description" + } + ] + }, + { + "name": "messageVideo", + "description": "A video message", + "class": "MessageContent", + "properties": [ + { + "name": "video", + "type": "video", + "description": "The video description" + }, + { + "name": "caption", + "type": "formattedText", + "description": "Video caption" + }, + { + "name": "is_secret", + "type": "Bool", + "description": "True, if the video thumbnail must be blurred and the video must be shown only while tapped" + } + ] + }, + { + "name": "messageExpiredVideo", + "description": "An expired video message (self-destructed after TTL has elapsed)", + "class": "MessageContent", + "properties": [] + }, + { + "name": "messageVideoNote", + "description": "A video note message", + "class": "MessageContent", + "properties": [ + { + "name": "video_note", + "type": "videoNote", + "description": "The video note description" + }, + { + "name": "is_viewed", + "type": "Bool", + "description": "True, if at least one of the recipients has viewed the video note" + }, + { + "name": "is_secret", + "type": "Bool", + "description": "True, if the video note thumbnail must be blurred and the video note must be shown only while tapped" + } + ] + }, + { + "name": "messageVoiceNote", + "description": "A voice note message", + "class": "MessageContent", + "properties": [ + { + "name": "voice_note", + "type": "voiceNote", + "description": "The voice note description" + }, + { + "name": "caption", + "type": "formattedText", + "description": "Voice note caption" + }, + { + "name": "is_listened", + "type": "Bool", + "description": "True, if at least one of the recipients has listened to the voice note" + } + ] + }, + { + "name": "messageLocation", + "description": "A message with a location", + "class": "MessageContent", + "properties": [ + { + "name": "location", + "type": "location", + "description": "The location description" + }, + { + "name": "live_period", + "type": "int32", + "description": "Time relative to the message send date, for which the location can be updated, in seconds" + }, + { + "name": "expires_in", + "type": "int32", + "description": "Left time for which the location can be updated, in seconds. updateMessageContent is not sent when this field changes" + }, + { + "name": "heading", + "type": "int32", + "description": "For live locations, a direction in which the location moves, in degrees; 1-360. If 0 the direction is unknown" + }, + { + "name": "proximity_alert_radius", + "type": "int32", + "description": "For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). 0 if the notification is disabled. Available only for the message sender" + } + ] + }, + { + "name": "messageVenue", + "description": "A message with information about a venue", + "class": "MessageContent", + "properties": [ + { + "name": "venue", + "type": "venue", + "description": "The venue description" + } + ] + }, + { + "name": "messageContact", + "description": "A message with a user contact", + "class": "MessageContent", + "properties": [ + { + "name": "contact", + "type": "contact", + "description": "The contact description" + } + ] + }, + { + "name": "messageDice", + "description": "A dice message. The dice value is randomly generated by the server", + "class": "MessageContent", + "properties": [ + { + "name": "initial_state", + "type": "DiceStickers", + "description": "The animated stickers with the initial dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known" + }, + { + "name": "final_state", + "type": "DiceStickers", + "description": "The animated stickers with the final dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known" + }, + { + "name": "emoji", + "type": "string", + "description": "Emoji on which the dice throw animation is based" + }, + { + "name": "value", + "type": "int32", + "description": "The dice value. If the value is 0, the dice don't have final state yet" + }, + { + "name": "success_animation_frame_number", + "type": "int32", + "description": "Number of frame after which a success animation like a shower of confetti needs to be shown on updateMessageSendSucceeded" + } + ] + }, + { + "name": "messageGame", + "description": "A message with a game", + "class": "MessageContent", + "properties": [ + { + "name": "game", + "type": "game", + "description": "The game description" + } + ] + }, + { + "name": "messagePoll", + "description": "A message with a poll", + "class": "MessageContent", + "properties": [ + { + "name": "poll", + "type": "poll", + "description": "The poll description" + } + ] + }, + { + "name": "messageInvoice", + "description": "A message with an invoice from a bot", + "class": "MessageContent", + "properties": [ + { + "name": "title", + "type": "string", + "description": "Product title" + }, + { + "name": "description", + "type": "string", + "description": "Product description" + }, + { + "name": "photo", + "type": "photo", + "description": "Product photo; may be null" + }, + { + "name": "currency", + "type": "string", + "description": "Currency for the product price" + }, + { + "name": "total_amount", + "type": "int53", + "description": "Product total price in the minimal quantity of the currency" + }, + { + "name": "start_parameter", + "type": "string", + "description": "Unique invoice bot start_parameter. To share an invoice use the URL https://t.me/{bot_username}?start={start_parameter}" + }, + { + "name": "is_test", + "type": "Bool", + "description": "True, if the invoice is a test invoice" + }, + { + "name": "need_shipping_address", + "type": "Bool", + "description": "True, if the shipping address should be specified" + }, + { + "name": "receipt_message_id", + "type": "int53", + "description": "The identifier of the message with the receipt, after the product has been purchased" + } + ] + }, + { + "name": "messageCall", + "description": "A message with information about an ended call", + "class": "MessageContent", + "properties": [ + { + "name": "is_video", + "type": "Bool", + "description": "True, if the call was a video call" + }, + { + "name": "discard_reason", + "type": "CallDiscardReason", + "description": "Reason why the call was discarded" + }, + { + "name": "duration", + "type": "int32", + "description": "Call duration, in seconds" + } + ] + }, + { + "name": "messageBasicGroupChatCreate", + "description": "A newly created basic group", + "class": "MessageContent", + "properties": [ + { + "name": "title", + "type": "string", + "description": "Title of the basic group" + }, + { + "name": "member_user_ids", + "type": "vector\u003cint32\u003e", + "description": "User identifiers of members in the basic group" + } + ] + }, + { + "name": "messageSupergroupChatCreate", + "description": "A newly created supergroup or channel", + "class": "MessageContent", + "properties": [ + { + "name": "title", + "type": "string", + "description": "Title of the supergroup or channel" + } + ] + }, + { + "name": "messageChatChangeTitle", + "description": "An updated chat title", + "class": "MessageContent", + "properties": [ + { + "name": "title", + "type": "string", + "description": "New chat title" + } + ] + }, + { + "name": "messageChatChangePhoto", + "description": "An updated chat photo", + "class": "MessageContent", + "properties": [ + { + "name": "photo", + "type": "chatPhoto", + "description": "New chat photo" + } + ] + }, + { + "name": "messageChatDeletePhoto", + "description": "A deleted chat photo", + "class": "MessageContent", + "properties": [] + }, + { + "name": "messageChatAddMembers", + "description": "New chat members were added", + "class": "MessageContent", + "properties": [ + { + "name": "member_user_ids", + "type": "vector\u003cint32\u003e", + "description": "User identifiers of the new members" + } + ] + }, + { + "name": "messageChatJoinByLink", + "description": "A new member joined the chat by invite link", + "class": "MessageContent", + "properties": [] + }, + { + "name": "messageChatDeleteMember", + "description": "A chat member was deleted", + "class": "MessageContent", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier of the deleted chat member" + } + ] + }, + { + "name": "messageChatUpgradeTo", + "description": "A basic group was upgraded to a supergroup and was deactivated as the result", + "class": "MessageContent", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "Identifier of the supergroup to which the basic group was upgraded" + } + ] + }, + { + "name": "messageChatUpgradeFrom", + "description": "A supergroup has been created from a basic group", + "class": "MessageContent", + "properties": [ + { + "name": "title", + "type": "string", + "description": "Title of the newly created supergroup" + }, + { + "name": "basic_group_id", + "type": "int32", + "description": "The identifier of the original basic group" + } + ] + }, + { + "name": "messagePinMessage", + "description": "A message has been pinned", + "class": "MessageContent", + "properties": [ + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the pinned message, can be an identifier of a deleted message or 0" + } + ] + }, + { + "name": "messageScreenshotTaken", + "description": "A screenshot of a message in the chat has been taken", + "class": "MessageContent", + "properties": [] + }, + { + "name": "messageChatSetTtl", + "description": "The TTL (Time To Live) setting messages in a secret chat has been changed", + "class": "MessageContent", + "properties": [ + { + "name": "ttl", + "type": "int32", + "description": "New TTL" + } + ] + }, + { + "name": "messageCustomServiceAction", + "description": "A non-standard action has happened in the chat", + "class": "MessageContent", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Message text to be shown in the chat" + } + ] + }, + { + "name": "messageGameScore", + "description": "A new high score was achieved in a game", + "class": "MessageContent", + "properties": [ + { + "name": "game_message_id", + "type": "int53", + "description": "Identifier of the message with the game, can be an identifier of a deleted message" + }, + { + "name": "game_id", + "type": "int64", + "description": "Identifier of the game; may be different from the games presented in the message with the game" + }, + { + "name": "score", + "type": "int32", + "description": "New score" + } + ] + }, + { + "name": "messagePaymentSuccessful", + "description": "A payment has been completed", + "class": "MessageContent", + "properties": [ + { + "name": "invoice_message_id", + "type": "int53", + "description": "Identifier of the message with the corresponding invoice; can be an identifier of a deleted message" + }, + { + "name": "currency", + "type": "string", + "description": "Currency for the price of the product" + }, + { + "name": "total_amount", + "type": "int53", + "description": "Total price for the product, in the minimal quantity of the currency" + } + ] + }, + { + "name": "messagePaymentSuccessfulBot", + "description": "A payment has been completed; for bots only", + "class": "MessageContent", + "properties": [ + { + "name": "invoice_message_id", + "type": "int53", + "description": "Identifier of the message with the corresponding invoice; can be an identifier of a deleted message" + }, + { + "name": "currency", + "type": "string", + "description": "Currency for price of the product" + }, + { + "name": "total_amount", + "type": "int53", + "description": "Total price for the product, in the minimal quantity of the currency" + }, + { + "name": "invoice_payload", + "type": "bytes", + "description": "Invoice payload" + }, + { + "name": "shipping_option_id", + "type": "string", + "description": "Identifier of the shipping option chosen by the user; may be empty if not applicable" + }, + { + "name": "order_info", + "type": "orderInfo", + "description": "Information about the order; may be null" + }, + { + "name": "telegram_payment_charge_id", + "type": "string", + "description": "Telegram payment identifier" + }, + { + "name": "provider_payment_charge_id", + "type": "string", + "description": "Provider payment identifier" + } + ] + }, + { + "name": "messageContactRegistered", + "description": "A contact has registered with Telegram", + "class": "MessageContent", + "properties": [] + }, + { + "name": "messageWebsiteConnected", + "description": "The current user has connected a website by logging in using Telegram Login Widget on it", + "class": "MessageContent", + "properties": [ + { + "name": "domain_name", + "type": "string", + "description": "Domain name of the connected website" + } + ] + }, + { + "name": "messagePassportDataSent", + "description": "Telegram Passport data has been sent", + "class": "MessageContent", + "properties": [ + { + "name": "types", + "type": "vector\u003cPassportElementType\u003e", + "description": "List of Telegram Passport element types sent" + } + ] + }, + { + "name": "messagePassportDataReceived", + "description": "Telegram Passport data has been received; for bots only", + "class": "MessageContent", + "properties": [ + { + "name": "elements", + "type": "vector\u003cencryptedPassportElement\u003e", + "description": "List of received Telegram Passport elements" + }, + { + "name": "credentials", + "type": "encryptedCredentials", + "description": "Encrypted data credentials" + } + ] + }, + { + "name": "messageProximityAlertTriggered", + "description": "A user in the chat came within proximity alert range", + "class": "MessageContent", + "properties": [ + { + "name": "traveler", + "type": "MessageSender", + "description": "The user or chat, which triggered the proximity alert" + }, + { + "name": "watcher", + "type": "MessageSender", + "description": "The user or chat, which subscribed for the proximity alert" + }, + { + "name": "distance", + "type": "int32", + "description": "The distance between the users" + } + ] + }, + { + "name": "messageUnsupported", + "description": "Message content that is not supported in the current TDLib version", + "class": "MessageContent", + "properties": [] + }, + { + "name": "textEntityTypeMention", + "description": "A mention of a user by their username", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypeHashtag", + "description": "A hashtag text, beginning with \"#\"", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypeCashtag", + "description": "A cashtag text, beginning with \"$\" and consisting of capital english letters (i.e. \"$USD\")", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypeBotCommand", + "description": "A bot command, beginning with \"/\". This shouldn't be highlighted if there are no bots in the chat", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypeUrl", + "description": "An HTTP URL", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypeEmailAddress", + "description": "An email address", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypePhoneNumber", + "description": "A phone number", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypeBankCardNumber", + "description": "A bank card number. The getBankCardInfo method can be used to get information about the bank card", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypeBold", + "description": "A bold text", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypeItalic", + "description": "An italic text", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypeUnderline", + "description": "An underlined text", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypeStrikethrough", + "description": "A strikethrough text", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypeCode", + "description": "Text that must be formatted as if inside a code HTML tag", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypePre", + "description": "Text that must be formatted as if inside a pre HTML tag", + "class": "TextEntityType", + "properties": [] + }, + { + "name": "textEntityTypePreCode", + "description": "Text that must be formatted as if inside pre, and code HTML tags", + "class": "TextEntityType", + "properties": [ + { + "name": "language", + "type": "string", + "description": "Programming language of the code; as defined by the sender" + } + ] + }, + { + "name": "textEntityTypeTextUrl", + "description": "A text description shown instead of a raw URL", + "class": "TextEntityType", + "properties": [ + { + "name": "url", + "type": "string", + "description": "HTTP or tg:// URL to be opened when the link is clicked" + } + ] + }, + { + "name": "textEntityTypeMentionName", + "description": "A text shows instead of a raw mention of the user (e.g., when the user has no username)", + "class": "TextEntityType", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Identifier of the mentioned user" + } + ] + }, + { + "name": "inputThumbnail", + "description": "A thumbnail to be sent along with a file; must be in JPEG or WEBP format for stickers, and less than 200 KB in size", + "class": "InputThumbnail", + "properties": [ + { + "name": "thumbnail", + "type": "InputFile", + "description": "Thumbnail file to send. Sending thumbnails by file_id is currently not supported" + }, + { + "name": "width", + "type": "int32", + "description": "Thumbnail width, usually shouldn't exceed 320. Use 0 if unknown" + }, + { + "name": "height", + "type": "int32", + "description": "Thumbnail height, usually shouldn't exceed 320. Use 0 if unknown" + } + ] + }, + { + "name": "messageSchedulingStateSendAtDate", + "description": "The message will be sent at the specified date", + "class": "MessageSchedulingState", + "properties": [ + { + "name": "send_date", + "type": "int32", + "description": "Date the message will be sent. The date must be within 367 days in the future" + } + ] + }, + { + "name": "messageSchedulingStateSendWhenOnline", + "description": "The message will be sent when the peer will be online. Applicable to private chats only and when the exact online status of the peer is known", + "class": "MessageSchedulingState", + "properties": [] + }, + { + "name": "messageSendOptions", + "description": "Options to be used when a message is sent", + "class": "MessageSendOptions", + "properties": [ + { + "name": "disable_notification", + "type": "Bool", + "description": "Pass true to disable notification for the message" + }, + { + "name": "from_background", + "type": "Bool", + "description": "Pass true if the message is sent from the background" + }, + { + "name": "scheduling_state", + "type": "MessageSchedulingState", + "description": "Message scheduling state. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled" + } + ] + }, + { + "name": "messageCopyOptions", + "description": "Options to be used when a message content is copied without a link to the original message", + "class": "MessageCopyOptions", + "properties": [ + { + "name": "send_copy", + "type": "Bool", + "description": "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" + }, + { + "name": "replace_caption", + "type": "Bool", + "description": "True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false" + }, + { + "name": "new_caption", + "type": "formattedText", + "description": "New message caption. Ignored if replace_caption is false" + } + ] + }, + { + "name": "inputMessageText", + "description": "A text message", + "class": "InputMessageContent", + "properties": [ + { + "name": "text", + "type": "formattedText", + "description": "Formatted text to be sent; 1-GetOption(\"message_text_length_max\") characters. Only Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually" + }, + { + "name": "disable_web_page_preview", + "type": "Bool", + "description": "True, if rich web page previews for URLs in the message text should be disabled" + }, + { + "name": "clear_draft", + "type": "Bool", + "description": "True, if a chat message draft should be deleted" + } + ] + }, + { + "name": "inputMessageAnimation", + "description": "An animation message (GIF-style).", + "class": "InputMessageContent", + "properties": [ + { + "name": "animation", + "type": "InputFile", + "description": "Animation file to be sent" + }, + { + "name": "thumbnail", + "type": "inputThumbnail", + "description": "Animation thumbnail, if available" + }, + { + "name": "added_sticker_file_ids", + "type": "vector\u003cint32\u003e", + "description": "File identifiers of the stickers added to the animation, if applicable" + }, + { + "name": "duration", + "type": "int32", + "description": "Duration of the animation, in seconds" + }, + { + "name": "width", + "type": "int32", + "description": "Width of the animation; may be replaced by the server" + }, + { + "name": "height", + "type": "int32", + "description": "Height of the animation; may be replaced by the server" + }, + { + "name": "caption", + "type": "formattedText", + "description": "Animation caption; 0-GetOption(\"message_caption_length_max\") characters" + } + ] + }, + { + "name": "inputMessageAudio", + "description": "An audio message", + "class": "InputMessageContent", + "properties": [ + { + "name": "audio", + "type": "InputFile", + "description": "Audio file to be sent" + }, + { + "name": "album_cover_thumbnail", + "type": "inputThumbnail", + "description": "Thumbnail of the cover for the album, if available" + }, + { + "name": "duration", + "type": "int32", + "description": "Duration of the audio, in seconds; may be replaced by the server" + }, + { + "name": "title", + "type": "string", + "description": "Title of the audio; 0-64 characters; may be replaced by the server" + }, + { + "name": "performer", + "type": "string", + "description": "Performer of the audio; 0-64 characters, may be replaced by the server" + }, + { + "name": "caption", + "type": "formattedText", + "description": "Audio caption; 0-GetOption(\"message_caption_length_max\") characters" + } + ] + }, + { + "name": "inputMessageDocument", + "description": "A document message (general file)", + "class": "InputMessageContent", + "properties": [ + { + "name": "document", + "type": "InputFile", + "description": "Document to be sent" + }, + { + "name": "thumbnail", + "type": "inputThumbnail", + "description": "Document thumbnail, if available" + }, + { + "name": "disable_content_type_detection", + "type": "Bool", + "description": "If true, automatic file type detection will be disabled and the document will be always sent as file. Always true for files sent to secret chats" + }, + { + "name": "caption", + "type": "formattedText", + "description": "Document caption; 0-GetOption(\"message_caption_length_max\") characters" + } + ] + }, + { + "name": "inputMessagePhoto", + "description": "A photo message", + "class": "InputMessageContent", + "properties": [ + { + "name": "photo", + "type": "InputFile", + "description": "Photo to send" + }, + { + "name": "thumbnail", + "type": "inputThumbnail", + "description": "Photo thumbnail to be sent, this is sent to the other party in secret chats only" + }, + { + "name": "added_sticker_file_ids", + "type": "vector\u003cint32\u003e", + "description": "File identifiers of the stickers added to the photo, if applicable" + }, + { + "name": "width", + "type": "int32", + "description": "Photo width" + }, + { + "name": "height", + "type": "int32", + "description": "Photo height" + }, + { + "name": "caption", + "type": "formattedText", + "description": "Photo caption; 0-GetOption(\"message_caption_length_max\") characters" + }, + { + "name": "ttl", + "type": "int32", + "description": "Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats" + } + ] + }, + { + "name": "inputMessageSticker", + "description": "A sticker message", + "class": "InputMessageContent", + "properties": [ + { + "name": "sticker", + "type": "InputFile", + "description": "Sticker to be sent" + }, + { + "name": "thumbnail", + "type": "inputThumbnail", + "description": "Sticker thumbnail, if available" + }, + { + "name": "width", + "type": "int32", + "description": "Sticker width" + }, + { + "name": "height", + "type": "int32", + "description": "Sticker height" + } + ] + }, + { + "name": "inputMessageVideo", + "description": "A video message", + "class": "InputMessageContent", + "properties": [ + { + "name": "video", + "type": "InputFile", + "description": "Video to be sent" + }, + { + "name": "thumbnail", + "type": "inputThumbnail", + "description": "Video thumbnail, if available" + }, + { + "name": "added_sticker_file_ids", + "type": "vector\u003cint32\u003e", + "description": "File identifiers of the stickers added to the video, if applicable" + }, + { + "name": "duration", + "type": "int32", + "description": "Duration of the video, in seconds" + }, + { + "name": "width", + "type": "int32", + "description": "Video width" + }, + { + "name": "height", + "type": "int32", + "description": "Video height" + }, + { + "name": "supports_streaming", + "type": "Bool", + "description": "True, if the video should be tried to be streamed" + }, + { + "name": "caption", + "type": "formattedText", + "description": "Video caption; 0-GetOption(\"message_caption_length_max\") characters" + }, + { + "name": "ttl", + "type": "int32", + "description": "Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats" + } + ] + }, + { + "name": "inputMessageVideoNote", + "description": "A video note message", + "class": "InputMessageContent", + "properties": [ + { + "name": "video_note", + "type": "InputFile", + "description": "Video note to be sent" + }, + { + "name": "thumbnail", + "type": "inputThumbnail", + "description": "Video thumbnail, if available" + }, + { + "name": "duration", + "type": "int32", + "description": "Duration of the video, in seconds" + }, + { + "name": "length", + "type": "int32", + "description": "Video width and height; must be positive and not greater than 640" + } + ] + }, + { + "name": "inputMessageVoiceNote", + "description": "A voice note message", + "class": "InputMessageContent", + "properties": [ + { + "name": "voice_note", + "type": "InputFile", + "description": "Voice note to be sent" + }, + { + "name": "duration", + "type": "int32", + "description": "Duration of the voice note, in seconds" + }, + { + "name": "waveform", + "type": "bytes", + "description": "Waveform representation of the voice note, in 5-bit format" + }, + { + "name": "caption", + "type": "formattedText", + "description": "Voice note caption; 0-GetOption(\"message_caption_length_max\") characters" + } + ] + }, + { + "name": "inputMessageLocation", + "description": "A message with a location", + "class": "InputMessageContent", + "properties": [ + { + "name": "location", + "type": "location", + "description": "Location to be sent" + }, + { + "name": "live_period", + "type": "int32", + "description": "Period for which the location can be updated, in seconds; should be between 60 and 86400 for a live location and 0 otherwise" + }, + { + "name": "heading", + "type": "int32", + "description": "For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 if unknown" + }, + { + "name": "proximity_alert_radius", + "type": "int32", + "description": "For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled. Can't be enabled in channels and Saved Messages" + } + ] + }, + { + "name": "inputMessageVenue", + "description": "A message with information about a venue", + "class": "InputMessageContent", + "properties": [ + { + "name": "venue", + "type": "venue", + "description": "Venue to send" + } + ] + }, + { + "name": "inputMessageContact", + "description": "A message containing a user contact", + "class": "InputMessageContent", + "properties": [ + { + "name": "contact", + "type": "contact", + "description": "Contact to send" + } + ] + }, + { + "name": "inputMessageDice", + "description": "A dice message", + "class": "InputMessageContent", + "properties": [ + { + "name": "emoji", + "type": "string", + "description": "Emoji on which the dice throw animation is based" + }, + { + "name": "clear_draft", + "type": "Bool", + "description": "True, if a chat message draft should be deleted" + } + ] + }, + { + "name": "inputMessageGame", + "description": "A message with a game; not supported for channels or secret chats", + "class": "InputMessageContent", + "properties": [ + { + "name": "bot_user_id", + "type": "int32", + "description": "User identifier of the bot that owns the game" + }, + { + "name": "game_short_name", + "type": "string", + "description": "Short name of the game" + } + ] + }, + { + "name": "inputMessageInvoice", + "description": "A message with an invoice; can be used only by bots and only in private chats", + "class": "InputMessageContent", + "properties": [ + { + "name": "invoice", + "type": "invoice", + "description": "Invoice" + }, + { + "name": "title", + "type": "string", + "description": "Product title; 1-32 characters" + }, + { + "name": "description", + "type": "string", + "description": "Product description; 0-255 characters" + }, + { + "name": "photo_url", + "type": "string", + "description": "Product photo URL; optional" + }, + { + "name": "photo_size", + "type": "int32", + "description": "Product photo size" + }, + { + "name": "photo_width", + "type": "int32", + "description": "Product photo width" + }, + { + "name": "photo_height", + "type": "int32", + "description": "Product photo height" + }, + { + "name": "payload", + "type": "bytes", + "description": "The invoice payload" + }, + { + "name": "provider_token", + "type": "string", + "description": "Payment provider token" + }, + { + "name": "provider_data", + "type": "string", + "description": "JSON-encoded data about the invoice, which will be shared with the payment provider" + }, + { + "name": "start_parameter", + "type": "string", + "description": "Unique invoice bot start_parameter for the generation of this invoice" + } + ] + }, + { + "name": "inputMessagePoll", + "description": "A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot", + "class": "InputMessageContent", + "properties": [ + { + "name": "question", + "type": "string", + "description": "Poll question, 1-255 characters (up to 300 characters for bots)" + }, + { + "name": "options", + "type": "vector\u003cstring\u003e", + "description": "List of poll answer options, 2-10 strings 1-100 characters each" + }, + { + "name": "is_anonymous", + "type": "Bool", + "description": "True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels" + }, + { + "name": "type", + "type": "PollType", + "description": "Type of the poll" + }, + { + "name": "open_period", + "type": "int32", + "description": "Amount of time the poll will be active after creation, in seconds; for bots only" + }, + { + "name": "close_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the poll will be automatically closed; for bots only" + }, + { + "name": "is_closed", + "type": "Bool", + "description": "True, if the poll needs to be sent already closed; for bots only" + } + ] + }, + { + "name": "inputMessageForwarded", + "description": "A forwarded message", + "class": "InputMessageContent", + "properties": [ + { + "name": "from_chat_id", + "type": "int53", + "description": "Identifier for the chat this forwarded message came from" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message to forward" + }, + { + "name": "in_game_share", + "type": "Bool", + "description": "True, if a game message should be shared within a launched game; applies only to game messages" + }, + { + "name": "copy_options", + "type": "messageCopyOptions", + "description": "Options to be used to copy content of the message without a link to the original message" + } + ] + }, + { + "name": "searchMessagesFilterEmpty", + "description": "Returns all found messages, no filter is applied", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterAnimation", + "description": "Returns only animation messages", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterAudio", + "description": "Returns only audio messages", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterDocument", + "description": "Returns only document messages", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterPhoto", + "description": "Returns only photo messages", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterVideo", + "description": "Returns only video messages", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterVoiceNote", + "description": "Returns only voice note messages", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterPhotoAndVideo", + "description": "Returns only photo and video messages", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterUrl", + "description": "Returns only messages containing URLs", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterChatPhoto", + "description": "Returns only messages containing chat photos", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterCall", + "description": "Returns only call messages", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterMissedCall", + "description": "Returns only incoming call messages with missed/declined discard reasons", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterVideoNote", + "description": "Returns only video note messages", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterVoiceAndVideoNote", + "description": "Returns only voice and video note messages", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterMention", + "description": "Returns only messages with mentions of the current user, or messages that are replies to their messages", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterUnreadMention", + "description": "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, a message thread or by the sending user", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterFailedToSend", + "description": "Returns only failed to send messages. This filter can be used only if the message database is used", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "searchMessagesFilterPinned", + "description": "Returns only pinned messages", + "class": "SearchMessagesFilter", + "properties": [] + }, + { + "name": "chatActionTyping", + "description": "The user is typing a message", + "class": "ChatAction", + "properties": [] + }, + { + "name": "chatActionRecordingVideo", + "description": "The user is recording a video", + "class": "ChatAction", + "properties": [] + }, + { + "name": "chatActionUploadingVideo", + "description": "The user is uploading a video", + "class": "ChatAction", + "properties": [ + { + "name": "progress", + "type": "int32", + "description": "Upload progress, as a percentage" + } + ] + }, + { + "name": "chatActionRecordingVoiceNote", + "description": "The user is recording a voice note", + "class": "ChatAction", + "properties": [] + }, + { + "name": "chatActionUploadingVoiceNote", + "description": "The user is uploading a voice note", + "class": "ChatAction", + "properties": [ + { + "name": "progress", + "type": "int32", + "description": "Upload progress, as a percentage" + } + ] + }, + { + "name": "chatActionUploadingPhoto", + "description": "The user is uploading a photo", + "class": "ChatAction", + "properties": [ + { + "name": "progress", + "type": "int32", + "description": "Upload progress, as a percentage" + } + ] + }, + { + "name": "chatActionUploadingDocument", + "description": "The user is uploading a document", + "class": "ChatAction", + "properties": [ + { + "name": "progress", + "type": "int32", + "description": "Upload progress, as a percentage" + } + ] + }, + { + "name": "chatActionChoosingLocation", + "description": "The user is picking a location or venue to send", + "class": "ChatAction", + "properties": [] + }, + { + "name": "chatActionChoosingContact", + "description": "The user is picking a contact to send", + "class": "ChatAction", + "properties": [] + }, + { + "name": "chatActionStartPlayingGame", + "description": "The user has started to play a game", + "class": "ChatAction", + "properties": [] + }, + { + "name": "chatActionRecordingVideoNote", + "description": "The user is recording a video note", + "class": "ChatAction", + "properties": [] + }, + { + "name": "chatActionUploadingVideoNote", + "description": "The user is uploading a video note", + "class": "ChatAction", + "properties": [ + { + "name": "progress", + "type": "int32", + "description": "Upload progress, as a percentage" + } + ] + }, + { + "name": "chatActionCancel", + "description": "The user has cancelled the previous action", + "class": "ChatAction", + "properties": [] + }, + { + "name": "userStatusEmpty", + "description": "The user status was never changed", + "class": "UserStatus", + "properties": [] + }, + { + "name": "userStatusOnline", + "description": "The user is online", + "class": "UserStatus", + "properties": [ + { + "name": "expires", + "type": "int32", + "description": "Point in time (Unix timestamp) when the user's online status will expire" + } + ] + }, + { + "name": "userStatusOffline", + "description": "The user is offline", + "class": "UserStatus", + "properties": [ + { + "name": "was_online", + "type": "int32", + "description": "Point in time (Unix timestamp) when the user was last online" + } + ] + }, + { + "name": "userStatusRecently", + "description": "The user was online recently", + "class": "UserStatus", + "properties": [] + }, + { + "name": "userStatusLastWeek", + "description": "The user is offline, but was online last week", + "class": "UserStatus", + "properties": [] + }, + { + "name": "userStatusLastMonth", + "description": "The user is offline, but was online last month", + "class": "UserStatus", + "properties": [] + }, + { + "name": "stickers", + "description": "Represents a list of stickers", + "class": "Stickers", + "properties": [ + { + "name": "stickers", + "type": "vector\u003csticker\u003e", + "description": "List of stickers" + } + ] + }, + { + "name": "emojis", + "description": "Represents a list of emoji", + "class": "Emojis", + "properties": [ + { + "name": "emojis", + "type": "vector\u003cstring\u003e", + "description": "List of emojis" + } + ] + }, + { + "name": "stickerSet", + "description": "Represents a sticker set", + "class": "StickerSet", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Identifier of the sticker set" + }, + { + "name": "title", + "type": "string", + "description": "Title of the sticker set" + }, + { + "name": "name", + "type": "string", + "description": "Name of the sticker set" + }, + { + "name": "thumbnail", + "type": "thumbnail", + "description": "Sticker set thumbnail in WEBP or TGS format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed" + }, + { + "name": "is_installed", + "type": "Bool", + "description": "True, if the sticker set has been installed by the current user" + }, + { + "name": "is_archived", + "type": "Bool", + "description": "True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously" + }, + { + "name": "is_official", + "type": "Bool", + "description": "True, if the sticker set is official" + }, + { + "name": "is_animated", + "type": "Bool", + "description": "True, is the stickers in the set are animated" + }, + { + "name": "is_masks", + "type": "Bool", + "description": "True, if the stickers in the set are masks" + }, + { + "name": "is_viewed", + "type": "Bool", + "description": "True for already viewed trending sticker sets" + }, + { + "name": "stickers", + "type": "vector\u003csticker\u003e", + "description": "List of stickers in this set" + }, + { + "name": "emojis", + "type": "vector\u003cemojis\u003e", + "description": "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" + } + ] + }, + { + "name": "stickerSetInfo", + "description": "Represents short information about a sticker set", + "class": "StickerSetInfo", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Identifier of the sticker set" + }, + { + "name": "title", + "type": "string", + "description": "Title of the sticker set" + }, + { + "name": "name", + "type": "string", + "description": "Name of the sticker set" + }, + { + "name": "thumbnail", + "type": "thumbnail", + "description": "Sticker set thumbnail in WEBP or TGS format with width and height 100; may be null" + }, + { + "name": "is_installed", + "type": "Bool", + "description": "True, if the sticker set has been installed by current user" + }, + { + "name": "is_archived", + "type": "Bool", + "description": "True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously" + }, + { + "name": "is_official", + "type": "Bool", + "description": "True, if the sticker set is official" + }, + { + "name": "is_animated", + "type": "Bool", + "description": "True, is the stickers in the set are animated" + }, + { + "name": "is_masks", + "type": "Bool", + "description": "True, if the stickers in the set are masks" + }, + { + "name": "is_viewed", + "type": "Bool", + "description": "True for already viewed trending sticker sets" + }, + { + "name": "size", + "type": "int32", + "description": "Total number of stickers in the set" + }, + { + "name": "covers", + "type": "vector\u003csticker\u003e", + "description": "Contains up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full set should be requested" + } + ] + }, + { + "name": "stickerSets", + "description": "Represents a list of sticker sets", + "class": "StickerSets", + "properties": [ + { + "name": "total_count", + "type": "int32", + "description": "Approximate total number of sticker sets found" + }, + { + "name": "sets", + "type": "vector\u003cstickerSetInfo\u003e", + "description": "List of sticker sets" + } + ] + }, + { + "name": "callDiscardReasonEmpty", + "description": "The call wasn't discarded, or the reason is unknown", + "class": "CallDiscardReason", + "properties": [] + }, + { + "name": "callDiscardReasonMissed", + "description": "The call was ended before the conversation started. It was cancelled by the caller or missed by the other party", + "class": "CallDiscardReason", + "properties": [] + }, + { + "name": "callDiscardReasonDeclined", + "description": "The call was ended before the conversation started. It was declined by the other party", + "class": "CallDiscardReason", + "properties": [] + }, + { + "name": "callDiscardReasonDisconnected", + "description": "The call was ended during the conversation because the users were disconnected", + "class": "CallDiscardReason", + "properties": [] + }, + { + "name": "callDiscardReasonHungUp", + "description": "The call was ended because one of the parties hung up", + "class": "CallDiscardReason", + "properties": [] + }, + { + "name": "callProtocol", + "description": "Specifies the supported call protocols", + "class": "CallProtocol", + "properties": [ + { + "name": "udp_p2p", + "type": "Bool", + "description": "True, if UDP peer-to-peer connections are supported" + }, + { + "name": "udp_reflector", + "type": "Bool", + "description": "True, if connection through UDP reflectors is supported" + }, + { + "name": "min_layer", + "type": "int32", + "description": "The minimum supported API layer; use 65" + }, + { + "name": "max_layer", + "type": "int32", + "description": "The maximum supported API layer; use 65" + }, + { + "name": "library_versions", + "type": "vector\u003cstring\u003e", + "description": "List of supported libtgvoip versions" + } + ] + }, + { + "name": "callServerTypeTelegramReflector", + "description": "A Telegram call reflector", + "class": "CallServerType", + "properties": [ + { + "name": "peer_tag", + "type": "bytes", + "description": "A peer tag to be used with the reflector" + } + ] + }, + { + "name": "callServerTypeWebrtc", + "description": "A WebRTC server", + "class": "CallServerType", + "properties": [ + { + "name": "username", + "type": "string", + "description": "Username to be used for authentication" + }, + { + "name": "password", + "type": "string", + "description": "Authentication password" + }, + { + "name": "supports_turn", + "type": "Bool", + "description": "True, if the server supports TURN" + }, + { + "name": "supports_stun", + "type": "Bool", + "description": "True, if the server supports STUN" + } + ] + }, + { + "name": "callServer", + "description": "Describes a server for relaying call data", + "class": "CallServer", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Server identifier" + }, + { + "name": "ip_address", + "type": "string", + "description": "Server IPv4 address" + }, + { + "name": "ipv6_address", + "type": "string", + "description": "Server IPv6 address" + }, + { + "name": "port", + "type": "int32", + "description": "Server port number" + }, + { + "name": "type", + "type": "CallServerType", + "description": "Server type" + } + ] + }, + { + "name": "callId", + "description": "Contains the call identifier", + "class": "CallId", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Call identifier" + } + ] + }, + { + "name": "callStatePending", + "description": "The call is pending, waiting to be accepted by a user", + "class": "CallState", + "properties": [ + { + "name": "is_created", + "type": "Bool", + "description": "True, if the call has already been created by the server" + }, + { + "name": "is_received", + "type": "Bool", + "description": "True, if the call has already been received by the other party" + } + ] + }, + { + "name": "callStateExchangingKeys", + "description": "The call has been answered and encryption keys are being exchanged", + "class": "CallState", + "properties": [] + }, + { + "name": "callStateReady", + "description": "The call is ready to use", + "class": "CallState", + "properties": [ + { + "name": "protocol", + "type": "callProtocol", + "description": "Call protocols supported by the peer" + }, + { + "name": "servers", + "type": "vector\u003ccallServer\u003e", + "description": "List of available call servers" + }, + { + "name": "config", + "type": "string", + "description": "A JSON-encoded call config" + }, + { + "name": "encryption_key", + "type": "bytes", + "description": "Call encryption key" + }, + { + "name": "emojis", + "type": "vector\u003cstring\u003e", + "description": "Encryption key emojis fingerprint" + }, + { + "name": "allow_p2p", + "type": "Bool", + "description": "True, if peer-to-peer connection is allowed by users privacy settings" + } + ] + }, + { + "name": "callStateHangingUp", + "description": "The call is hanging up after discardCall has been called", + "class": "CallState", + "properties": [] + }, + { + "name": "callStateDiscarded", + "description": "The call has ended successfully", + "class": "CallState", + "properties": [ + { + "name": "reason", + "type": "CallDiscardReason", + "description": "The reason, why the call has ended" + }, + { + "name": "need_rating", + "type": "Bool", + "description": "True, if the call rating should be sent to the server" + }, + { + "name": "need_debug_information", + "type": "Bool", + "description": "True, if the call debug information should be sent to the server" + } + ] + }, + { + "name": "callStateError", + "description": "The call has ended with an error", + "class": "CallState", + "properties": [ + { + "name": "error", + "type": "error", + "description": "Error. An error with the code 4005000 will be returned if an outgoing call is missed because of an expired timeout" + } + ] + }, + { + "name": "callProblemEcho", + "description": "The user heard their own voice", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemNoise", + "description": "The user heard background noise", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemInterruptions", + "description": "The other side kept disappearing", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemDistortedSpeech", + "description": "The speech was distorted", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemSilentLocal", + "description": "The user couldn't hear the other side", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemSilentRemote", + "description": "The other side couldn't hear the user", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemDropped", + "description": "The call ended unexpectedly", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemDistortedVideo", + "description": "The video was distorted", + "class": "CallProblem", + "properties": [] + }, + { + "name": "callProblemPixelatedVideo", + "description": "The video was pixelated", + "class": "CallProblem", + "properties": [] + }, + { + "name": "call", + "description": "Describes a call", + "class": "Call", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Call identifier, not persistent" + }, + { + "name": "user_id", + "type": "int32", + "description": "Peer user identifier" + }, + { + "name": "is_outgoing", + "type": "Bool", + "description": "True, if the call is outgoing" + }, + { + "name": "is_video", + "type": "Bool", + "description": "True, if the call is a video call" + }, + { + "name": "state", + "type": "CallState", + "description": "Call state" + } + ] + }, + { + "name": "phoneNumberAuthenticationSettings", + "description": "Contains settings for the authentication of the user's phone number", + "class": "PhoneNumberAuthenticationSettings", + "properties": [ + { + "name": "allow_flash_call", + "type": "Bool", + "description": "Pass true if the authentication code may be sent via flash call to the specified phone number" + }, + { + "name": "is_current_phone_number", + "type": "Bool", + "description": "Pass true if the authenticated phone number is used on the current device" + }, + { + "name": "allow_sms_retriever_api", + "type": "Bool", + "description": "For official applications only. True, if the application can use Android SMS Retriever API (requires Google Play Services \u003e= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details" + } + ] + }, + { + "name": "animations", + "description": "Represents a list of animations", + "class": "Animations", + "properties": [ + { + "name": "animations", + "type": "vector\u003canimation\u003e", + "description": "List of animations" + } + ] + }, + { + "name": "diceStickersRegular", + "description": "A regular animated sticker", + "class": "DiceStickers", + "properties": [ + { + "name": "sticker", + "type": "sticker", + "description": "The animated sticker with the dice animation" + } + ] + }, + { + "name": "diceStickersSlotMachine", + "description": "Animated stickers to be combined into a slot machine", + "class": "DiceStickers", + "properties": [ + { + "name": "background", + "type": "sticker", + "description": "The animated sticker with the slot machine background. The background animation must start playing after all reel animations finish" + }, + { + "name": "lever", + "type": "sticker", + "description": "The animated sticker with the lever animation. The lever animation must play once in the initial dice state" + }, + { + "name": "left_reel", + "type": "sticker", + "description": "The animated sticker with the left reel" + }, + { + "name": "center_reel", + "type": "sticker", + "description": "The animated sticker with the center reel" + }, + { + "name": "right_reel", + "type": "sticker", + "description": "The animated sticker with the right reel" + } + ] + }, + { + "name": "importedContacts", + "description": "Represents the result of an ImportContacts request", + "class": "ImportedContacts", + "properties": [ + { + "name": "user_ids", + "type": "vector\u003cint32\u003e", + "description": "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" + }, + { + "name": "importer_count", + "type": "vector\u003cint32\u003e", + "description": "The number of users that imported the corresponding contact; 0 for already registered users or if unavailable" + } + ] + }, + { + "name": "httpUrl", + "description": "Contains an HTTP URL", + "class": "HttpUrl", + "properties": [ + { + "name": "url", + "type": "string", + "description": "The URL" + } + ] + }, + { + "name": "inputInlineQueryResultAnimation", + "description": "Represents a link to an animated GIF or an animated (i.e. without sound) H.264/MPEG-4 AVC video", + "class": "InputInlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "title", + "type": "string", + "description": "Title of the query result" + }, + { + "name": "thumbnail_url", + "type": "string", + "description": "URL of the result thumbnail (JPEG, GIF, or MPEG4), if it exists" + }, + { + "name": "thumbnail_mime_type", + "type": "string", + "description": "MIME type of the video thumbnail. If non-empty, must be one of \"image/jpeg\", \"image/gif\" and \"video/mp4\"" + }, + { + "name": "video_url", + "type": "string", + "description": "The URL of the video file (file size must not exceed 1MB)" + }, + { + "name": "video_mime_type", + "type": "string", + "description": "MIME type of the video file. Must be one of \"image/gif\" and \"video/mp4\"" + }, + { + "name": "video_duration", + "type": "int32", + "description": "Duration of the video, in seconds" + }, + { + "name": "video_width", + "type": "int32", + "description": "Width of the video" + }, + { + "name": "video_height", + "type": "int32", + "description": "Height of the video" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The message reply markup. Must be of type replyMarkupInlineKeyboard or null" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAnimation, InputMessageLocation, InputMessageVenue or InputMessageContact" + } + ] + }, + { + "name": "inputInlineQueryResultArticle", + "description": "Represents a link to an article or web page", + "class": "InputInlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "url", + "type": "string", + "description": "URL of the result, if it exists" + }, + { + "name": "hide_url", + "type": "Bool", + "description": "True, if the URL must be not shown" + }, + { + "name": "title", + "type": "string", + "description": "Title of the result" + }, + { + "name": "description", + "type": "string", + "description": "A short description of the result" + }, + { + "name": "thumbnail_url", + "type": "string", + "description": "URL of the result thumbnail, if it exists" + }, + { + "name": "thumbnail_width", + "type": "int32", + "description": "Thumbnail width, if known" + }, + { + "name": "thumbnail_height", + "type": "int32", + "description": "Thumbnail height, if known" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The message reply markup. Must be of type replyMarkupInlineKeyboard or null" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact" + } + ] + }, + { + "name": "inputInlineQueryResultAudio", + "description": "Represents a link to an MP3 audio file", + "class": "InputInlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "title", + "type": "string", + "description": "Title of the audio file" + }, + { + "name": "performer", + "type": "string", + "description": "Performer of the audio file" + }, + { + "name": "audio_url", + "type": "string", + "description": "The URL of the audio file" + }, + { + "name": "audio_duration", + "type": "int32", + "description": "Audio file duration, in seconds" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The message reply markup. Must be of type replyMarkupInlineKeyboard or null" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAudio, InputMessageLocation, InputMessageVenue or InputMessageContact" + } + ] + }, + { + "name": "inputInlineQueryResultContact", + "description": "Represents a user contact", + "class": "InputInlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "contact", + "type": "contact", + "description": "User contact" + }, + { + "name": "thumbnail_url", + "type": "string", + "description": "URL of the result thumbnail, if it exists" + }, + { + "name": "thumbnail_width", + "type": "int32", + "description": "Thumbnail width, if known" + }, + { + "name": "thumbnail_height", + "type": "int32", + "description": "Thumbnail height, if known" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The message reply markup. Must be of type replyMarkupInlineKeyboard or null" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact" + } + ] + }, + { + "name": "inputInlineQueryResultDocument", + "description": "Represents a link to a file", + "class": "InputInlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "title", + "type": "string", + "description": "Title of the resulting file" + }, + { + "name": "description", + "type": "string", + "description": "Short description of the result, if known" + }, + { + "name": "document_url", + "type": "string", + "description": "URL of the file" + }, + { + "name": "mime_type", + "type": "string", + "description": "MIME type of the file content; only \"application/pdf\" and \"application/zip\" are currently allowed" + }, + { + "name": "thumbnail_url", + "type": "string", + "description": "The URL of the file thumbnail, if it exists" + }, + { + "name": "thumbnail_width", + "type": "int32", + "description": "Width of the thumbnail" + }, + { + "name": "thumbnail_height", + "type": "int32", + "description": "Height of the thumbnail" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The message reply markup. Must be of type replyMarkupInlineKeyboard or null" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageDocument, InputMessageLocation, InputMessageVenue or InputMessageContact" + } + ] + }, + { + "name": "inputInlineQueryResultGame", + "description": "Represents a game", + "class": "InputInlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "game_short_name", + "type": "string", + "description": "Short name of the game" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "Message reply markup. Must be of type replyMarkupInlineKeyboard or null" + } + ] + }, + { + "name": "inputInlineQueryResultLocation", + "description": "Represents a point on the map", + "class": "InputInlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "location", + "type": "location", + "description": "Location result" + }, + { + "name": "live_period", + "type": "int32", + "description": "Amount of time relative to the message sent time until the location can be updated, in seconds" + }, + { + "name": "title", + "type": "string", + "description": "Title of the result" + }, + { + "name": "thumbnail_url", + "type": "string", + "description": "URL of the result thumbnail, if it exists" + }, + { + "name": "thumbnail_width", + "type": "int32", + "description": "Thumbnail width, if known" + }, + { + "name": "thumbnail_height", + "type": "int32", + "description": "Thumbnail height, if known" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The message reply markup. Must be of type replyMarkupInlineKeyboard or null" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact" + } + ] + }, + { + "name": "inputInlineQueryResultPhoto", + "description": "Represents link to a JPEG image", + "class": "InputInlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "title", + "type": "string", + "description": "Title of the result, if known" + }, + { + "name": "description", + "type": "string", + "description": "A short description of the result, if known" + }, + { + "name": "thumbnail_url", + "type": "string", + "description": "URL of the photo thumbnail, if it exists" + }, + { + "name": "photo_url", + "type": "string", + "description": "The URL of the JPEG photo (photo size must not exceed 5MB)" + }, + { + "name": "photo_width", + "type": "int32", + "description": "Width of the photo" + }, + { + "name": "photo_height", + "type": "int32", + "description": "Height of the photo" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The message reply markup. Must be of type replyMarkupInlineKeyboard or null" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessagePhoto, InputMessageLocation, InputMessageVenue or InputMessageContact" + } + ] + }, + { + "name": "inputInlineQueryResultSticker", + "description": "Represents a link to a WEBP or TGS sticker", + "class": "InputInlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "thumbnail_url", + "type": "string", + "description": "URL of the sticker thumbnail, if it exists" + }, + { + "name": "sticker_url", + "type": "string", + "description": "The URL of the WEBP or TGS sticker (sticker file size must not exceed 5MB)" + }, + { + "name": "sticker_width", + "type": "int32", + "description": "Width of the sticker" + }, + { + "name": "sticker_height", + "type": "int32", + "description": "Height of the sticker" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The message reply markup. Must be of type replyMarkupInlineKeyboard or null" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be sent. Must be one of the following types: InputMessageText, inputMessageSticker, InputMessageLocation, InputMessageVenue or InputMessageContact" + } + ] + }, + { + "name": "inputInlineQueryResultVenue", + "description": "Represents information about a venue", + "class": "InputInlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "venue", + "type": "venue", + "description": "Venue result" + }, + { + "name": "thumbnail_url", + "type": "string", + "description": "URL of the result thumbnail, if it exists" + }, + { + "name": "thumbnail_width", + "type": "int32", + "description": "Thumbnail width, if known" + }, + { + "name": "thumbnail_height", + "type": "int32", + "description": "Thumbnail height, if known" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The message reply markup. Must be of type replyMarkupInlineKeyboard or null" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact" + } + ] + }, + { + "name": "inputInlineQueryResultVideo", + "description": "Represents a link to a page containing an embedded video player or a video file", + "class": "InputInlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "title", + "type": "string", + "description": "Title of the result" + }, + { + "name": "description", + "type": "string", + "description": "A short description of the result, if known" + }, + { + "name": "thumbnail_url", + "type": "string", + "description": "The URL of the video thumbnail (JPEG), if it exists" + }, + { + "name": "video_url", + "type": "string", + "description": "URL of the embedded video player or video file" + }, + { + "name": "mime_type", + "type": "string", + "description": "MIME type of the content of the video URL, only \"text/html\" or \"video/mp4\" are currently supported" + }, + { + "name": "video_width", + "type": "int32", + "description": "Width of the video" + }, + { + "name": "video_height", + "type": "int32", + "description": "Height of the video" + }, + { + "name": "video_duration", + "type": "int32", + "description": "Video duration, in seconds" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The message reply markup. Must be of type replyMarkupInlineKeyboard or null" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageVideo, InputMessageLocation, InputMessageVenue or InputMessageContact" + } + ] + }, + { + "name": "inputInlineQueryResultVoiceNote", + "description": "Represents a link to an opus-encoded audio file within an OGG container, single channel audio", + "class": "InputInlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "title", + "type": "string", + "description": "Title of the voice note" + }, + { + "name": "voice_note_url", + "type": "string", + "description": "The URL of the voice note file" + }, + { + "name": "voice_note_duration", + "type": "int32", + "description": "Duration of the voice note, in seconds" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The message reply markup. Must be of type replyMarkupInlineKeyboard or null" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageVoiceNote, InputMessageLocation, InputMessageVenue or InputMessageContact" + } + ] + }, + { + "name": "inlineQueryResultArticle", + "description": "Represents a link to an article or web page", + "class": "InlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "url", + "type": "string", + "description": "URL of the result, if it exists" + }, + { + "name": "hide_url", + "type": "Bool", + "description": "True, if the URL must be not shown" + }, + { + "name": "title", + "type": "string", + "description": "Title of the result" + }, + { + "name": "description", + "type": "string", + "description": "A short description of the result" + }, + { + "name": "thumbnail", + "type": "thumbnail", + "description": "Result thumbnail in JPEG format; may be null" + } + ] + }, + { + "name": "inlineQueryResultContact", + "description": "Represents a user contact", + "class": "InlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "contact", + "type": "contact", + "description": "A user contact" + }, + { + "name": "thumbnail", + "type": "thumbnail", + "description": "Result thumbnail in JPEG format; may be null" + } + ] + }, + { + "name": "inlineQueryResultLocation", + "description": "Represents a point on the map", + "class": "InlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "location", + "type": "location", + "description": "Location result" + }, + { + "name": "title", + "type": "string", + "description": "Title of the result" + }, + { + "name": "thumbnail", + "type": "thumbnail", + "description": "Result thumbnail in JPEG format; may be null" + } + ] + }, + { + "name": "inlineQueryResultVenue", + "description": "Represents information about a venue", + "class": "InlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "venue", + "type": "venue", + "description": "Venue result" + }, + { + "name": "thumbnail", + "type": "thumbnail", + "description": "Result thumbnail in JPEG format; may be null" + } + ] + }, + { + "name": "inlineQueryResultGame", + "description": "Represents information about a game", + "class": "InlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "game", + "type": "game", + "description": "Game result" + } + ] + }, + { + "name": "inlineQueryResultAnimation", + "description": "Represents an animation file", + "class": "InlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "animation", + "type": "animation", + "description": "Animation file" + }, + { + "name": "title", + "type": "string", + "description": "Animation title" + } + ] + }, + { + "name": "inlineQueryResultAudio", + "description": "Represents an audio file", + "class": "InlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "audio", + "type": "audio", + "description": "Audio file" + } + ] + }, + { + "name": "inlineQueryResultDocument", + "description": "Represents a document", + "class": "InlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "document", + "type": "document", + "description": "Document" + }, + { + "name": "title", + "type": "string", + "description": "Document title" + }, + { + "name": "description", + "type": "string", + "description": "Document description" + } + ] + }, + { + "name": "inlineQueryResultPhoto", + "description": "Represents a photo", + "class": "InlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "photo", + "type": "photo", + "description": "Photo" + }, + { + "name": "title", + "type": "string", + "description": "Title of the result, if known" + }, + { + "name": "description", + "type": "string", + "description": "A short description of the result, if known" + } + ] + }, + { + "name": "inlineQueryResultSticker", + "description": "Represents a sticker", + "class": "InlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "sticker", + "type": "sticker", + "description": "Sticker" + } + ] + }, + { + "name": "inlineQueryResultVideo", + "description": "Represents a video", + "class": "InlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "video", + "type": "video", + "description": "Video" + }, + { + "name": "title", + "type": "string", + "description": "Title of the video" + }, + { + "name": "description", + "type": "string", + "description": "Description of the video" + } + ] + }, + { + "name": "inlineQueryResultVoiceNote", + "description": "Represents a voice note", + "class": "InlineQueryResult", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique identifier of the query result" + }, + { + "name": "voice_note", + "type": "voiceNote", + "description": "Voice note" + }, + { + "name": "title", + "type": "string", + "description": "Title of the voice note" + } + ] + }, + { + "name": "inlineQueryResults", + "description": "Represents the results of the inline query. Use sendInlineQueryResultMessage to send the result of the query", + "class": "InlineQueryResults", + "properties": [ + { + "name": "inline_query_id", + "type": "int64", + "description": "Unique identifier of the inline query" + }, + { + "name": "next_offset", + "type": "string", + "description": "The offset for the next request. If empty, there are no more results" + }, + { + "name": "results", + "type": "vector\u003cInlineQueryResult\u003e", + "description": "Results of the query" + }, + { + "name": "switch_pm_text", + "type": "string", + "description": "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" + }, + { + "name": "switch_pm_parameter", + "type": "string", + "description": "Parameter for the bot start message" + } + ] + }, + { + "name": "callbackQueryPayloadData", + "description": "The payload for a general callback button", + "class": "CallbackQueryPayload", + "properties": [ + { + "name": "data", + "type": "bytes", + "description": "Data that was attached to the callback button" + } + ] + }, + { + "name": "callbackQueryPayloadDataWithPassword", + "description": "The payload for a callback button requiring password", + "class": "CallbackQueryPayload", + "properties": [ + { + "name": "password", + "type": "string", + "description": "The password for the current user" + }, + { + "name": "data", + "type": "bytes", + "description": "Data that was attached to the callback button" + } + ] + }, + { + "name": "callbackQueryPayloadGame", + "description": "The payload for a game callback button", + "class": "CallbackQueryPayload", + "properties": [ + { + "name": "game_short_name", + "type": "string", + "description": "A short name of the game that was attached to the callback button" + } + ] + }, + { + "name": "callbackQueryAnswer", + "description": "Contains a bot's answer to a callback query", + "class": "CallbackQueryAnswer", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Text of the answer" + }, + { + "name": "show_alert", + "type": "Bool", + "description": "True, if an alert should be shown to the user instead of a toast notification" + }, + { + "name": "url", + "type": "string", + "description": "URL to be opened" + } + ] + }, + { + "name": "customRequestResult", + "description": "Contains the result of a custom request", + "class": "CustomRequestResult", + "properties": [ + { + "name": "result", + "type": "string", + "description": "A JSON-serialized result" + } + ] + }, + { + "name": "gameHighScore", + "description": "Contains one row of the game high score table", + "class": "GameHighScore", + "properties": [ + { + "name": "position", + "type": "int32", + "description": "Position in the high score table" + }, + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "score", + "type": "int32", + "description": "User score" + } + ] + }, + { + "name": "gameHighScores", + "description": "Contains a list of game high scores", + "class": "GameHighScores", + "properties": [ + { + "name": "scores", + "type": "vector\u003cgameHighScore\u003e", + "description": "A list of game high scores" + } + ] + }, + { + "name": "chatEventMessageEdited", + "description": "A message was edited", + "class": "ChatEventAction", + "properties": [ + { + "name": "old_message", + "type": "message", + "description": "The original message before the edit" + }, + { + "name": "new_message", + "type": "message", + "description": "The message after it was edited" + } + ] + }, + { + "name": "chatEventMessageDeleted", + "description": "A message was deleted", + "class": "ChatEventAction", + "properties": [ + { + "name": "message", + "type": "message", + "description": "Deleted message" + } + ] + }, + { + "name": "chatEventPollStopped", + "description": "A poll in a message was stopped", + "class": "ChatEventAction", + "properties": [ + { + "name": "message", + "type": "message", + "description": "The message with the poll" + } + ] + }, + { + "name": "chatEventMessagePinned", + "description": "A message was pinned", + "class": "ChatEventAction", + "properties": [ + { + "name": "message", + "type": "message", + "description": "Pinned message" + } + ] + }, + { + "name": "chatEventMessageUnpinned", + "description": "A message was unpinned", + "class": "ChatEventAction", + "properties": [ + { + "name": "message", + "type": "message", + "description": "Unpinned message" + } + ] + }, + { + "name": "chatEventMemberJoined", + "description": "A new member joined the chat", + "class": "ChatEventAction", + "properties": [] + }, + { + "name": "chatEventMemberLeft", + "description": "A member left the chat", + "class": "ChatEventAction", + "properties": [] + }, + { + "name": "chatEventMemberInvited", + "description": "A new chat member was invited", + "class": "ChatEventAction", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "New member user identifier" + }, + { + "name": "status", + "type": "ChatMemberStatus", + "description": "New member status" + } + ] + }, + { + "name": "chatEventMemberPromoted", + "description": "A chat member has gained/lost administrator status, or the list of their administrator privileges has changed", + "class": "ChatEventAction", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Chat member user identifier" + }, + { + "name": "old_status", + "type": "ChatMemberStatus", + "description": "Previous status of the chat member" + }, + { + "name": "new_status", + "type": "ChatMemberStatus", + "description": "New status of the chat member" + } + ] + }, + { + "name": "chatEventMemberRestricted", + "description": "A chat member was restricted/unrestricted or banned/unbanned, or the list of their restrictions has changed", + "class": "ChatEventAction", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Chat member user identifier" + }, + { + "name": "old_status", + "type": "ChatMemberStatus", + "description": "Previous status of the chat member" + }, + { + "name": "new_status", + "type": "ChatMemberStatus", + "description": "New status of the chat member" + } + ] + }, + { + "name": "chatEventTitleChanged", + "description": "The chat title was changed", + "class": "ChatEventAction", + "properties": [ + { + "name": "old_title", + "type": "string", + "description": "Previous chat title" + }, + { + "name": "new_title", + "type": "string", + "description": "New chat title" + } + ] + }, + { + "name": "chatEventPermissionsChanged", + "description": "The chat permissions was changed", + "class": "ChatEventAction", + "properties": [ + { + "name": "old_permissions", + "type": "chatPermissions", + "description": "Previous chat permissions" + }, + { + "name": "new_permissions", + "type": "chatPermissions", + "description": "New chat permissions" + } + ] + }, + { + "name": "chatEventDescriptionChanged", + "description": "The chat description was changed", + "class": "ChatEventAction", + "properties": [ + { + "name": "old_description", + "type": "string", + "description": "Previous chat description" + }, + { + "name": "new_description", + "type": "string", + "description": "New chat description" + } + ] + }, + { + "name": "chatEventUsernameChanged", + "description": "The chat username was changed", + "class": "ChatEventAction", + "properties": [ + { + "name": "old_username", + "type": "string", + "description": "Previous chat username" + }, + { + "name": "new_username", + "type": "string", + "description": "New chat username" + } + ] + }, + { + "name": "chatEventPhotoChanged", + "description": "The chat photo was changed", + "class": "ChatEventAction", + "properties": [ + { + "name": "old_photo", + "type": "chatPhoto", + "description": "Previous chat photo value; may be null" + }, + { + "name": "new_photo", + "type": "chatPhoto", + "description": "New chat photo value; may be null" + } + ] + }, + { + "name": "chatEventInvitesToggled", + "description": "The can_invite_users permission of a supergroup chat was toggled", + "class": "ChatEventAction", + "properties": [ + { + "name": "can_invite_users", + "type": "Bool", + "description": "New value of can_invite_users permission" + } + ] + }, + { + "name": "chatEventLinkedChatChanged", + "description": "The linked chat of a supergroup was changed", + "class": "ChatEventAction", + "properties": [ + { + "name": "old_linked_chat_id", + "type": "int53", + "description": "Previous supergroup linked chat identifier" + }, + { + "name": "new_linked_chat_id", + "type": "int53", + "description": "New supergroup linked chat identifier" + } + ] + }, + { + "name": "chatEventSlowModeDelayChanged", + "description": "The slow_mode_delay setting of a supergroup was changed", + "class": "ChatEventAction", + "properties": [ + { + "name": "old_slow_mode_delay", + "type": "int32", + "description": "Previous value of slow_mode_delay" + }, + { + "name": "new_slow_mode_delay", + "type": "int32", + "description": "New value of slow_mode_delay" + } + ] + }, + { + "name": "chatEventSignMessagesToggled", + "description": "The sign_messages setting of a channel was toggled", + "class": "ChatEventAction", + "properties": [ + { + "name": "sign_messages", + "type": "Bool", + "description": "New value of sign_messages" + } + ] + }, + { + "name": "chatEventStickerSetChanged", + "description": "The supergroup sticker set was changed", + "class": "ChatEventAction", + "properties": [ + { + "name": "old_sticker_set_id", + "type": "int64", + "description": "Previous identifier of the chat sticker set; 0 if none" + }, + { + "name": "new_sticker_set_id", + "type": "int64", + "description": "New identifier of the chat sticker set; 0 if none" + } + ] + }, + { + "name": "chatEventLocationChanged", + "description": "The supergroup location was changed", + "class": "ChatEventAction", + "properties": [ + { + "name": "old_location", + "type": "chatLocation", + "description": "Previous location; may be null" + }, + { + "name": "new_location", + "type": "chatLocation", + "description": "New location; may be null" + } + ] + }, + { + "name": "chatEventIsAllHistoryAvailableToggled", + "description": "The is_all_history_available setting of a supergroup was toggled", + "class": "ChatEventAction", + "properties": [ + { + "name": "is_all_history_available", + "type": "Bool", + "description": "New value of is_all_history_available" + } + ] + }, + { + "name": "chatEvent", + "description": "Represents a chat event", + "class": "ChatEvent", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Chat event identifier" + }, + { + "name": "date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the event happened" + }, + { + "name": "user_id", + "type": "int32", + "description": "Identifier of the user who performed the action that triggered the event" + }, + { + "name": "action", + "type": "ChatEventAction", + "description": "Action performed by the user" + } + ] + }, + { + "name": "chatEvents", + "description": "Contains a list of chat events", + "class": "ChatEvents", + "properties": [ + { + "name": "events", + "type": "vector\u003cchatEvent\u003e", + "description": "List of events" + } + ] + }, + { + "name": "chatEventLogFilters", + "description": "Represents a set of filters used to obtain a chat event log", + "class": "ChatEventLogFilters", + "properties": [ + { + "name": "message_edits", + "type": "Bool", + "description": "True, if message edits should be returned" + }, + { + "name": "message_deletions", + "type": "Bool", + "description": "True, if message deletions should be returned" + }, + { + "name": "message_pins", + "type": "Bool", + "description": "True, if pin/unpin events should be returned" + }, + { + "name": "member_joins", + "type": "Bool", + "description": "True, if members joining events should be returned" + }, + { + "name": "member_leaves", + "type": "Bool", + "description": "True, if members leaving events should be returned" + }, + { + "name": "member_invites", + "type": "Bool", + "description": "True, if invited member events should be returned" + }, + { + "name": "member_promotions", + "type": "Bool", + "description": "True, if member promotion/demotion events should be returned" + }, + { + "name": "member_restrictions", + "type": "Bool", + "description": "True, if member restricted/unrestricted/banned/unbanned events should be returned" + }, + { + "name": "info_changes", + "type": "Bool", + "description": "True, if changes in chat information should be returned" + }, + { + "name": "setting_changes", + "type": "Bool", + "description": "True, if changes in chat settings should be returned" + } + ] + }, + { + "name": "languagePackStringValueOrdinary", + "description": "An ordinary language pack string", + "class": "LanguagePackStringValue", + "properties": [ + { + "name": "value", + "type": "string", + "description": "String value" + } + ] + }, + { + "name": "languagePackStringValuePluralized", + "description": "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", + "class": "LanguagePackStringValue", + "properties": [ + { + "name": "zero_value", + "type": "string", + "description": "Value for zero objects" + }, + { + "name": "one_value", + "type": "string", + "description": "Value for one object" + }, + { + "name": "two_value", + "type": "string", + "description": "Value for two objects" + }, + { + "name": "few_value", + "type": "string", + "description": "Value for few objects" + }, + { + "name": "many_value", + "type": "string", + "description": "Value for many objects" + }, + { + "name": "other_value", + "type": "string", + "description": "Default value" + } + ] + }, + { + "name": "languagePackStringValueDeleted", + "description": "A deleted language pack string, the value should be taken from the built-in english language pack", + "class": "LanguagePackStringValue", + "properties": [] + }, + { + "name": "languagePackString", + "description": "Represents one language pack string", + "class": "LanguagePackString", + "properties": [ + { + "name": "key", + "type": "string", + "description": "String key" + }, + { + "name": "value", + "type": "LanguagePackStringValue", + "description": "String value" + } + ] + }, + { + "name": "languagePackStrings", + "description": "Contains a list of language pack strings", + "class": "LanguagePackStrings", + "properties": [ + { + "name": "strings", + "type": "vector\u003clanguagePackString\u003e", + "description": "A list of language pack strings" + } + ] + }, + { + "name": "languagePackInfo", + "description": "Contains information about a language pack", + "class": "LanguagePackInfo", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique language pack identifier" + }, + { + "name": "base_language_pack_id", + "type": "string", + "description": "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" + }, + { + "name": "name", + "type": "string", + "description": "Language name" + }, + { + "name": "native_name", + "type": "string", + "description": "Name of the language in that language" + }, + { + "name": "plural_code", + "type": "string", + "description": "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" + }, + { + "name": "is_official", + "type": "Bool", + "description": "True, if the language pack is official" + }, + { + "name": "is_rtl", + "type": "Bool", + "description": "True, if the language pack strings are RTL" + }, + { + "name": "is_beta", + "type": "Bool", + "description": "True, if the language pack is a beta language pack" + }, + { + "name": "is_installed", + "type": "Bool", + "description": "True, if the language pack is installed by the current user" + }, + { + "name": "total_string_count", + "type": "int32", + "description": "Total number of non-deleted strings from the language pack" + }, + { + "name": "translated_string_count", + "type": "int32", + "description": "Total number of translated strings from the language pack" + }, + { + "name": "local_string_count", + "type": "int32", + "description": "Total number of non-deleted strings from the language pack available locally" + }, + { + "name": "translation_url", + "type": "string", + "description": "Link to language translation interface; empty for custom local language packs" + } + ] + }, + { + "name": "localizationTargetInfo", + "description": "Contains information about the current localization target", + "class": "LocalizationTargetInfo", + "properties": [ + { + "name": "language_packs", + "type": "vector\u003clanguagePackInfo\u003e", + "description": "List of available language packs for this application" + } + ] + }, + { + "name": "deviceTokenFirebaseCloudMessaging", + "description": "A token for Firebase Cloud Messaging", + "class": "DeviceToken", + "properties": [ + { + "name": "token", + "type": "string", + "description": "Device registration token; may be empty to de-register a device" + }, + { + "name": "encrypt", + "type": "Bool", + "description": "True, if push notifications should be additionally encrypted" + } + ] + }, + { + "name": "deviceTokenApplePush", + "description": "A token for Apple Push Notification service", + "class": "DeviceToken", + "properties": [ + { + "name": "device_token", + "type": "string", + "description": "Device token; may be empty to de-register a device" + }, + { + "name": "is_app_sandbox", + "type": "Bool", + "description": "True, if App Sandbox is enabled" + } + ] + }, + { + "name": "deviceTokenApplePushVoIP", + "description": "A token for Apple Push Notification service VoIP notifications", + "class": "DeviceToken", + "properties": [ + { + "name": "device_token", + "type": "string", + "description": "Device token; may be empty to de-register a device" + }, + { + "name": "is_app_sandbox", + "type": "Bool", + "description": "True, if App Sandbox is enabled" + }, + { + "name": "encrypt", + "type": "Bool", + "description": "True, if push notifications should be additionally encrypted" + } + ] + }, + { + "name": "deviceTokenWindowsPush", + "description": "A token for Windows Push Notification Services", + "class": "DeviceToken", + "properties": [ + { + "name": "access_token", + "type": "string", + "description": "The access token that will be used to send notifications; may be empty to de-register a device" + } + ] + }, + { + "name": "deviceTokenMicrosoftPush", + "description": "A token for Microsoft Push Notification Service", + "class": "DeviceToken", + "properties": [ + { + "name": "channel_uri", + "type": "string", + "description": "Push notification channel URI; may be empty to de-register a device" + } + ] + }, + { + "name": "deviceTokenMicrosoftPushVoIP", + "description": "A token for Microsoft Push Notification Service VoIP channel", + "class": "DeviceToken", + "properties": [ + { + "name": "channel_uri", + "type": "string", + "description": "Push notification channel URI; may be empty to de-register a device" + } + ] + }, + { + "name": "deviceTokenWebPush", + "description": "A token for web Push API", + "class": "DeviceToken", + "properties": [ + { + "name": "endpoint", + "type": "string", + "description": "Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device" + }, + { + "name": "p256dh_base64url", + "type": "string", + "description": "Base64url-encoded P-256 elliptic curve Diffie-Hellman public key" + }, + { + "name": "auth_base64url", + "type": "string", + "description": "Base64url-encoded authentication secret" + } + ] + }, + { + "name": "deviceTokenSimplePush", + "description": "A token for Simple Push API for Firefox OS", + "class": "DeviceToken", + "properties": [ + { + "name": "endpoint", + "type": "string", + "description": "Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device" + } + ] + }, + { + "name": "deviceTokenUbuntuPush", + "description": "A token for Ubuntu Push Client service", + "class": "DeviceToken", + "properties": [ + { + "name": "token", + "type": "string", + "description": "Token; may be empty to de-register a device" + } + ] + }, + { + "name": "deviceTokenBlackBerryPush", + "description": "A token for BlackBerry Push Service", + "class": "DeviceToken", + "properties": [ + { + "name": "token", + "type": "string", + "description": "Token; may be empty to de-register a device" + } + ] + }, + { + "name": "deviceTokenTizenPush", + "description": "A token for Tizen Push Service", + "class": "DeviceToken", + "properties": [ + { + "name": "reg_id", + "type": "string", + "description": "Push service registration identifier; may be empty to de-register a device" + } + ] + }, + { + "name": "pushReceiverId", + "description": "Contains a globally unique push receiver identifier, which can be used to identify which account has received a push notification", + "class": "PushReceiverId", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "The globally unique identifier of push notification subscription" + } + ] + }, + { + "name": "backgroundFillSolid", + "description": "Describes a solid fill of a background", + "class": "BackgroundFill", + "properties": [ + { + "name": "color", + "type": "int32", + "description": "A color of the background in the RGB24 format" + } + ] + }, + { + "name": "backgroundFillGradient", + "description": "Describes a gradient fill of a background", + "class": "BackgroundFill", + "properties": [ + { + "name": "top_color", + "type": "int32", + "description": "A top color of the background in the RGB24 format" + }, + { + "name": "bottom_color", + "type": "int32", + "description": "A bottom color of the background in the RGB24 format" + }, + { + "name": "rotation_angle", + "type": "int32", + "description": "Clockwise rotation angle of the gradient, in degrees; 0-359. Should be always divisible by 45" + } + ] + }, + { + "name": "backgroundTypeWallpaper", + "description": "A wallpaper in JPEG format", + "class": "BackgroundType", + "properties": [ + { + "name": "is_blurred", + "type": "Bool", + "description": "True, if the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12" + }, + { + "name": "is_moving", + "type": "Bool", + "description": "True, if the background needs to be slightly moved when device is tilted" + } + ] + }, + { + "name": "backgroundTypePattern", + "description": "A PNG or TGV (gzipped subset of SVG with MIME type \"application/x-tgwallpattern\") pattern to be combined with the background fill chosen by the user", + "class": "BackgroundType", + "properties": [ + { + "name": "fill", + "type": "BackgroundFill", + "description": "Description of the background fill" + }, + { + "name": "intensity", + "type": "int32", + "description": "Intensity of the pattern when it is shown above the filled background, 0-100" + }, + { + "name": "is_moving", + "type": "Bool", + "description": "True, if the background needs to be slightly moved when device is tilted" + } + ] + }, + { + "name": "backgroundTypeFill", + "description": "A filled background", + "class": "BackgroundType", + "properties": [ + { + "name": "fill", + "type": "BackgroundFill", + "description": "Description of the background fill" + } + ] + }, + { + "name": "background", + "description": "Describes a chat background", + "class": "Background", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Unique background identifier" + }, + { + "name": "is_default", + "type": "Bool", + "description": "True, if this is one of default backgrounds" + }, + { + "name": "is_dark", + "type": "Bool", + "description": "True, if the background is dark and is recommended to be used with dark theme" + }, + { + "name": "name", + "type": "string", + "description": "Unique background name" + }, + { + "name": "document", + "type": "document", + "description": "Document with the background; may be null. Null only for filled backgrounds" + }, + { + "name": "type", + "type": "BackgroundType", + "description": "Type of the background" + } + ] + }, + { + "name": "backgrounds", + "description": "Contains a list of backgrounds", + "class": "Backgrounds", + "properties": [ + { + "name": "backgrounds", + "type": "vector\u003cbackground\u003e", + "description": "A list of backgrounds" + } + ] + }, + { + "name": "inputBackgroundLocal", + "description": "A background from a local file", + "class": "InputBackground", + "properties": [ + { + "name": "background", + "type": "InputFile", + "description": "Background file to use. Only inputFileLocal and inputFileGenerated are supported. The file must be in JPEG format for wallpapers and in PNG format for patterns" + } + ] + }, + { + "name": "inputBackgroundRemote", + "description": "A background from the server", + "class": "InputBackground", + "properties": [ + { + "name": "background_id", + "type": "int64", + "description": "The background identifier" + } + ] + }, + { + "name": "hashtags", + "description": "Contains a list of hashtags", + "class": "Hashtags", + "properties": [ + { + "name": "hashtags", + "type": "vector\u003cstring\u003e", + "description": "A list of hashtags" + } + ] + }, + { + "name": "canTransferOwnershipResultOk", + "description": "The session can be used", + "class": "CanTransferOwnershipResult", + "properties": [] + }, + { + "name": "canTransferOwnershipResultPasswordNeeded", + "description": "The 2-step verification needs to be enabled first", + "class": "CanTransferOwnershipResult", + "properties": [] + }, + { + "name": "canTransferOwnershipResultPasswordTooFresh", + "description": "The 2-step verification was enabled recently, user needs to wait", + "class": "CanTransferOwnershipResult", + "properties": [ + { + "name": "retry_after", + "type": "int32", + "description": "Time left before the session can be used to transfer ownership of a chat, in seconds" + } + ] + }, + { + "name": "canTransferOwnershipResultSessionTooFresh", + "description": "The session was created recently, user needs to wait", + "class": "CanTransferOwnershipResult", + "properties": [ + { + "name": "retry_after", + "type": "int32", + "description": "Time left before the session can be used to transfer ownership of a chat, in seconds" + } + ] + }, + { + "name": "checkChatUsernameResultOk", + "description": "The username can be set", + "class": "CheckChatUsernameResult", + "properties": [] + }, + { + "name": "checkChatUsernameResultUsernameInvalid", + "description": "The username is invalid", + "class": "CheckChatUsernameResult", + "properties": [] + }, + { + "name": "checkChatUsernameResultUsernameOccupied", + "description": "The username is occupied", + "class": "CheckChatUsernameResult", + "properties": [] + }, + { + "name": "checkChatUsernameResultPublicChatsTooMuch", + "description": "The user has too much chats with username, one of them should be made private first", + "class": "CheckChatUsernameResult", + "properties": [] + }, + { + "name": "checkChatUsernameResultPublicGroupsUnavailable", + "description": "The user can't be a member of a public supergroup", + "class": "CheckChatUsernameResult", + "properties": [] + }, + { + "name": "pushMessageContentHidden", + "description": "A general message with hidden content", + "class": "PushMessageContent", + "properties": [ + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentAnimation", + "description": "An animation message (GIF-style).", + "class": "PushMessageContent", + "properties": [ + { + "name": "animation", + "type": "animation", + "description": "Message content; may be null" + }, + { + "name": "caption", + "type": "string", + "description": "Animation caption" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentAudio", + "description": "An audio message", + "class": "PushMessageContent", + "properties": [ + { + "name": "audio", + "type": "audio", + "description": "Message content; may be null" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentContact", + "description": "A message with a user contact", + "class": "PushMessageContent", + "properties": [ + { + "name": "name", + "type": "string", + "description": "Contact's name" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentContactRegistered", + "description": "A contact has registered with Telegram", + "class": "PushMessageContent", + "properties": [] + }, + { + "name": "pushMessageContentDocument", + "description": "A document message (a general file)", + "class": "PushMessageContent", + "properties": [ + { + "name": "document", + "type": "document", + "description": "Message content; may be null" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentGame", + "description": "A message with a game", + "class": "PushMessageContent", + "properties": [ + { + "name": "title", + "type": "string", + "description": "Game title, empty for pinned game message" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentGameScore", + "description": "A new high score was achieved in a game", + "class": "PushMessageContent", + "properties": [ + { + "name": "title", + "type": "string", + "description": "Game title, empty for pinned message" + }, + { + "name": "score", + "type": "int32", + "description": "New score, 0 for pinned message" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentInvoice", + "description": "A message with an invoice from a bot", + "class": "PushMessageContent", + "properties": [ + { + "name": "price", + "type": "string", + "description": "Product price" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentLocation", + "description": "A message with a location", + "class": "PushMessageContent", + "properties": [ + { + "name": "is_live", + "type": "Bool", + "description": "True, if the location is live" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentPhoto", + "description": "A photo message", + "class": "PushMessageContent", + "properties": [ + { + "name": "photo", + "type": "photo", + "description": "Message content; may be null" + }, + { + "name": "caption", + "type": "string", + "description": "Photo caption" + }, + { + "name": "is_secret", + "type": "Bool", + "description": "True, if the photo is secret" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentPoll", + "description": "A message with a poll", + "class": "PushMessageContent", + "properties": [ + { + "name": "question", + "type": "string", + "description": "Poll question" + }, + { + "name": "is_regular", + "type": "Bool", + "description": "True, if the poll is regular and not in quiz mode" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentScreenshotTaken", + "description": "A screenshot of a message in the chat has been taken", + "class": "PushMessageContent", + "properties": [] + }, + { + "name": "pushMessageContentSticker", + "description": "A message with a sticker", + "class": "PushMessageContent", + "properties": [ + { + "name": "sticker", + "type": "sticker", + "description": "Message content; may be null" + }, + { + "name": "emoji", + "type": "string", + "description": "Emoji corresponding to the sticker; may be empty" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentText", + "description": "A text message", + "class": "PushMessageContent", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Message text" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentVideo", + "description": "A video message", + "class": "PushMessageContent", + "properties": [ + { + "name": "video", + "type": "video", + "description": "Message content; may be null" + }, + { + "name": "caption", + "type": "string", + "description": "Video caption" + }, + { + "name": "is_secret", + "type": "Bool", + "description": "True, if the video is secret" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentVideoNote", + "description": "A video note message", + "class": "PushMessageContent", + "properties": [ + { + "name": "video_note", + "type": "videoNote", + "description": "Message content; may be null" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentVoiceNote", + "description": "A voice note message", + "class": "PushMessageContent", + "properties": [ + { + "name": "voice_note", + "type": "voiceNote", + "description": "Message content; may be null" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentBasicGroupChatCreate", + "description": "A newly created basic group", + "class": "PushMessageContent", + "properties": [] + }, + { + "name": "pushMessageContentChatAddMembers", + "description": "New chat members were invited to a group", + "class": "PushMessageContent", + "properties": [ + { + "name": "member_name", + "type": "string", + "description": "Name of the added member" + }, + { + "name": "is_current_user", + "type": "Bool", + "description": "True, if the current user was added to the group" + }, + { + "name": "is_returned", + "type": "Bool", + "description": "True, if the user has returned to the group themself" + } + ] + }, + { + "name": "pushMessageContentChatChangePhoto", + "description": "A chat photo was edited", + "class": "PushMessageContent", + "properties": [] + }, + { + "name": "pushMessageContentChatChangeTitle", + "description": "A chat title was edited", + "class": "PushMessageContent", + "properties": [ + { + "name": "title", + "type": "string", + "description": "New chat title" + } + ] + }, + { + "name": "pushMessageContentChatDeleteMember", + "description": "A chat member was deleted", + "class": "PushMessageContent", + "properties": [ + { + "name": "member_name", + "type": "string", + "description": "Name of the deleted member" + }, + { + "name": "is_current_user", + "type": "Bool", + "description": "True, if the current user was deleted from the group" + }, + { + "name": "is_left", + "type": "Bool", + "description": "True, if the user has left the group themself" + } + ] + }, + { + "name": "pushMessageContentChatJoinByLink", + "description": "A new member joined the chat by invite link", + "class": "PushMessageContent", + "properties": [] + }, + { + "name": "pushMessageContentMessageForwards", + "description": "A forwarded messages", + "class": "PushMessageContent", + "properties": [ + { + "name": "total_count", + "type": "int32", + "description": "Number of forwarded messages" + } + ] + }, + { + "name": "pushMessageContentMediaAlbum", + "description": "A media album", + "class": "PushMessageContent", + "properties": [ + { + "name": "total_count", + "type": "int32", + "description": "Number of messages in the album" + }, + { + "name": "has_photos", + "type": "Bool", + "description": "True, if the album has at least one photo" + }, + { + "name": "has_videos", + "type": "Bool", + "description": "True, if the album has at least one video" + }, + { + "name": "has_audios", + "type": "Bool", + "description": "True, if the album has at least one audio file" + }, + { + "name": "has_documents", + "type": "Bool", + "description": "True, if the album has at least one document" + } + ] + }, + { + "name": "notificationTypeNewMessage", + "description": "New message was received", + "class": "NotificationType", + "properties": [ + { + "name": "message", + "type": "message", + "description": "The message" + } + ] + }, + { + "name": "notificationTypeNewSecretChat", + "description": "New secret chat was created", + "class": "NotificationType", + "properties": [] + }, + { + "name": "notificationTypeNewCall", + "description": "New call was received", + "class": "NotificationType", + "properties": [ + { + "name": "call_id", + "type": "int32", + "description": "Call identifier" + } + ] + }, + { + "name": "notificationTypeNewPushMessage", + "description": "New message was received through a push notification", + "class": "NotificationType", + "properties": [ + { + "name": "message_id", + "type": "int53", + "description": "The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages, or as reply_to_message_id" + }, + { + "name": "sender", + "type": "MessageSender", + "description": "The sender of the message. Corresponding user or chat may be inaccessible" + }, + { + "name": "sender_name", + "type": "string", + "description": "Name of the sender" + }, + { + "name": "is_outgoing", + "type": "Bool", + "description": "True, if the message is outgoing" + }, + { + "name": "content", + "type": "PushMessageContent", + "description": "Push message content" + } + ] + }, + { + "name": "notificationGroupTypeMessages", + "description": "A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with ordinary unread messages", + "class": "NotificationGroupType", + "properties": [] + }, + { + "name": "notificationGroupTypeMentions", + "description": "A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with unread mentions of the current user, replies to their messages, or a pinned message", + "class": "NotificationGroupType", + "properties": [] + }, + { + "name": "notificationGroupTypeSecretChat", + "description": "A group containing a notification of type notificationTypeNewSecretChat", + "class": "NotificationGroupType", + "properties": [] + }, + { + "name": "notificationGroupTypeCalls", + "description": "A group containing notifications of type notificationTypeNewCall", + "class": "NotificationGroupType", + "properties": [] + }, + { + "name": "notification", + "description": "Contains information about a notification", + "class": "Notification", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Unique persistent identifier of this notification" + }, + { + "name": "date", + "type": "int32", + "description": "Notification date" + }, + { + "name": "is_silent", + "type": "Bool", + "description": "True, if the notification was initially silent" + }, + { + "name": "type", + "type": "NotificationType", + "description": "Notification type" + } + ] + }, + { + "name": "notificationGroup", + "description": "Describes a group of notifications", + "class": "NotificationGroup", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Unique persistent auto-incremented from 1 identifier of the notification group" + }, + { + "name": "type", + "type": "NotificationGroupType", + "description": "Type of the group" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of a chat to which all notifications in the group belong" + }, + { + "name": "total_count", + "type": "int32", + "description": "Total number of active notifications in the group" + }, + { + "name": "notifications", + "type": "vector\u003cnotification\u003e", + "description": "The list of active notifications" + } + ] + }, + { + "name": "optionValueBoolean", + "description": "Represents a boolean option", + "class": "OptionValue", + "properties": [ + { + "name": "value", + "type": "Bool", + "description": "The value of the option" + } + ] + }, + { + "name": "optionValueEmpty", + "description": "Represents an unknown option or an option which has a default value", + "class": "OptionValue", + "properties": [] + }, + { + "name": "optionValueInteger", + "description": "Represents an integer option", + "class": "OptionValue", + "properties": [ + { + "name": "value", + "type": "int64", + "description": "The value of the option" + } + ] + }, + { + "name": "optionValueString", + "description": "Represents a string option", + "class": "OptionValue", + "properties": [ + { + "name": "value", + "type": "string", + "description": "The value of the option" + } + ] + }, + { + "name": "jsonObjectMember", + "description": "Represents one member of a JSON object", + "class": "JsonObjectMember", + "properties": [ + { + "name": "key", + "type": "string", + "description": "Member's key" + }, + { + "name": "value", + "type": "JsonValue", + "description": "Member's value" + } + ] + }, + { + "name": "jsonValueNull", + "description": "Represents a null JSON value", + "class": "JsonValue", + "properties": [] + }, + { + "name": "jsonValueBoolean", + "description": "Represents a boolean JSON value", + "class": "JsonValue", + "properties": [ + { + "name": "value", + "type": "Bool", + "description": "The value" + } + ] + }, + { + "name": "jsonValueNumber", + "description": "Represents a numeric JSON value", + "class": "JsonValue", + "properties": [ + { + "name": "value", + "type": "double", + "description": "The value" + } + ] + }, + { + "name": "jsonValueString", + "description": "Represents a string JSON value", + "class": "JsonValue", + "properties": [ + { + "name": "value", + "type": "string", + "description": "The value" + } + ] + }, + { + "name": "jsonValueArray", + "description": "Represents a JSON array", + "class": "JsonValue", + "properties": [ + { + "name": "values", + "type": "vector\u003cJsonValue\u003e", + "description": "The list of array elements" + } + ] + }, + { + "name": "jsonValueObject", + "description": "Represents a JSON object", + "class": "JsonValue", + "properties": [ + { + "name": "members", + "type": "vector\u003cjsonObjectMember\u003e", + "description": "The list of object members" + } + ] + }, + { + "name": "userPrivacySettingRuleAllowAll", + "description": "A rule to allow all users to do something", + "class": "UserPrivacySettingRule", + "properties": [] + }, + { + "name": "userPrivacySettingRuleAllowContacts", + "description": "A rule to allow all of a user's contacts to do something", + "class": "UserPrivacySettingRule", + "properties": [] + }, + { + "name": "userPrivacySettingRuleAllowUsers", + "description": "A rule to allow certain specified users to do something", + "class": "UserPrivacySettingRule", + "properties": [ + { + "name": "user_ids", + "type": "vector\u003cint32\u003e", + "description": "The user identifiers, total number of users in all rules must not exceed 1000" + } + ] + }, + { + "name": "userPrivacySettingRuleAllowChatMembers", + "description": "A rule to allow all members of certain specified basic groups and supergroups to doing something", + "class": "UserPrivacySettingRule", + "properties": [ + { + "name": "chat_ids", + "type": "vector\u003cint53\u003e", + "description": "The chat identifiers, total number of chats in all rules must not exceed 20" + } + ] + }, + { + "name": "userPrivacySettingRuleRestrictAll", + "description": "A rule to restrict all users from doing something", + "class": "UserPrivacySettingRule", + "properties": [] + }, + { + "name": "userPrivacySettingRuleRestrictContacts", + "description": "A rule to restrict all contacts of a user from doing something", + "class": "UserPrivacySettingRule", + "properties": [] + }, + { + "name": "userPrivacySettingRuleRestrictUsers", + "description": "A rule to restrict all specified users from doing something", + "class": "UserPrivacySettingRule", + "properties": [ + { + "name": "user_ids", + "type": "vector\u003cint32\u003e", + "description": "The user identifiers, total number of users in all rules must not exceed 1000" + } + ] + }, + { + "name": "userPrivacySettingRuleRestrictChatMembers", + "description": "A rule to restrict all members of specified basic groups and supergroups from doing something", + "class": "UserPrivacySettingRule", + "properties": [ + { + "name": "chat_ids", + "type": "vector\u003cint53\u003e", + "description": "The chat identifiers, total number of chats in all rules must not exceed 20" + } + ] + }, + { + "name": "userPrivacySettingRules", + "description": "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", + "class": "UserPrivacySettingRules", + "properties": [ + { + "name": "rules", + "type": "vector\u003cUserPrivacySettingRule\u003e", + "description": "A list of rules" + } + ] + }, + { + "name": "userPrivacySettingShowStatus", + "description": "A privacy setting for managing whether the user's online status is visible", + "class": "UserPrivacySetting", + "properties": [] + }, + { + "name": "userPrivacySettingShowProfilePhoto", + "description": "A privacy setting for managing whether the user's profile photo is visible", + "class": "UserPrivacySetting", + "properties": [] + }, + { + "name": "userPrivacySettingShowLinkInForwardedMessages", + "description": "A privacy setting for managing whether a link to the user's account is included in forwarded messages", + "class": "UserPrivacySetting", + "properties": [] + }, + { + "name": "userPrivacySettingShowPhoneNumber", + "description": "A privacy setting for managing whether the user's phone number is visible", + "class": "UserPrivacySetting", + "properties": [] + }, + { + "name": "userPrivacySettingAllowChatInvites", + "description": "A privacy setting for managing whether the user can be invited to chats", + "class": "UserPrivacySetting", + "properties": [] + }, + { + "name": "userPrivacySettingAllowCalls", + "description": "A privacy setting for managing whether the user can be called", + "class": "UserPrivacySetting", + "properties": [] + }, + { + "name": "userPrivacySettingAllowPeerToPeerCalls", + "description": "A privacy setting for managing whether peer-to-peer connections can be used for calls", + "class": "UserPrivacySetting", + "properties": [] + }, + { + "name": "userPrivacySettingAllowFindingByPhoneNumber", + "description": "A privacy setting for managing whether the user can be found by their phone number. Checked only if the phone number is not known to the other user. Can be set only to \"Allow contacts\" or \"Allow all\"", + "class": "UserPrivacySetting", + "properties": [] + }, + { + "name": "accountTtl", + "description": "Contains information about the period of inactivity after which the current user's account will automatically be deleted", + "class": "AccountTtl", + "properties": [ + { + "name": "days", + "type": "int32", + "description": "Number of days of inactivity before the account will be flagged for deletion; should range from 30-366 days" + } + ] + }, + { + "name": "session", + "description": "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", + "class": "Session", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Session identifier" + }, + { + "name": "is_current", + "type": "Bool", + "description": "True, if this session is the current session" + }, + { + "name": "is_password_pending", + "type": "Bool", + "description": "True, if a password is needed to complete authorization of the session" + }, + { + "name": "api_id", + "type": "int32", + "description": "Telegram API identifier, as provided by the application" + }, + { + "name": "application_name", + "type": "string", + "description": "Name of the application, as provided by the application" + }, + { + "name": "application_version", + "type": "string", + "description": "The version of the application, as provided by the application" + }, + { + "name": "is_official_application", + "type": "Bool", + "description": "True, if the application is an official application or uses the api_id of an official application" + }, + { + "name": "device_model", + "type": "string", + "description": "Model of the device the application has been run or is running on, as provided by the application" + }, + { + "name": "platform", + "type": "string", + "description": "Operating system the application has been run or is running on, as provided by the application" + }, + { + "name": "system_version", + "type": "string", + "description": "Version of the operating system the application has been run or is running on, as provided by the application" + }, + { + "name": "log_in_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the user has logged in" + }, + { + "name": "last_active_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the session was last used" + }, + { + "name": "ip", + "type": "string", + "description": "IP address from which the session was created, in human-readable format" + }, + { + "name": "country", + "type": "string", + "description": "A two-letter country code for the country from which the session was created, based on the IP address" + }, + { + "name": "region", + "type": "string", + "description": "Region code from which the session was created, based on the IP address" + } + ] + }, + { + "name": "sessions", + "description": "Contains a list of sessions", + "class": "Sessions", + "properties": [ + { + "name": "sessions", + "type": "vector\u003csession\u003e", + "description": "List of sessions" + } + ] + }, + { + "name": "connectedWebsite", + "description": "Contains information about one website the current user is logged in with Telegram", + "class": "ConnectedWebsite", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Website identifier" + }, + { + "name": "domain_name", + "type": "string", + "description": "The domain name of the website" + }, + { + "name": "bot_user_id", + "type": "int32", + "description": "User identifier of a bot linked with the website" + }, + { + "name": "browser", + "type": "string", + "description": "The version of a browser used to log in" + }, + { + "name": "platform", + "type": "string", + "description": "Operating system the browser is running on" + }, + { + "name": "log_in_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the user was logged in" + }, + { + "name": "last_active_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when obtained authorization was last used" + }, + { + "name": "ip", + "type": "string", + "description": "IP address from which the user was logged in, in human-readable format" + }, + { + "name": "location", + "type": "string", + "description": "Human-readable description of a country and a region, from which the user was logged in, based on the IP address" + } + ] + }, + { + "name": "connectedWebsites", + "description": "Contains a list of websites the current user is logged in with Telegram", + "class": "ConnectedWebsites", + "properties": [ + { + "name": "websites", + "type": "vector\u003cconnectedWebsite\u003e", + "description": "List of connected websites" + } + ] + }, + { + "name": "chatReportReasonSpam", + "description": "The chat contains spam messages", + "class": "ChatReportReason", + "properties": [] + }, + { + "name": "chatReportReasonViolence", + "description": "The chat promotes violence", + "class": "ChatReportReason", + "properties": [] + }, + { + "name": "chatReportReasonPornography", + "description": "The chat contains pornographic messages", + "class": "ChatReportReason", + "properties": [] + }, + { + "name": "chatReportReasonChildAbuse", + "description": "The chat has child abuse related content", + "class": "ChatReportReason", + "properties": [] + }, + { + "name": "chatReportReasonCopyright", + "description": "The chat contains copyrighted content", + "class": "ChatReportReason", + "properties": [] + }, + { + "name": "chatReportReasonUnrelatedLocation", + "description": "The location-based chat is unrelated to its stated location", + "class": "ChatReportReason", + "properties": [] + }, + { + "name": "chatReportReasonCustom", + "description": "A custom reason provided by the user", + "class": "ChatReportReason", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Report text" + } + ] + }, + { + "name": "messageLink", + "description": "Contains an HTTPS link to a message in a supergroup or channel", + "class": "MessageLink", + "properties": [ + { + "name": "link", + "type": "string", + "description": "Message link" + }, + { + "name": "is_public", + "type": "Bool", + "description": "True, if the link will work for non-members of the chat" + } + ] + }, + { + "name": "messageLinkInfo", + "description": "Contains information about a link to a message in a chat", + "class": "MessageLinkInfo", + "properties": [ + { + "name": "is_public", + "type": "Bool", + "description": "True, if the link is a public link for a message in a chat" + }, + { + "name": "chat_id", + "type": "int53", + "description": "If found, identifier of the chat to which the message belongs, 0 otherwise" + }, + { + "name": "message", + "type": "message", + "description": "If found, the linked message; may be null" + }, + { + "name": "for_album", + "type": "Bool", + "description": "True, if the whole media album to which the message belongs is linked" + }, + { + "name": "for_comment", + "type": "Bool", + "description": "True, if the message is linked as a channel post comment or from a message thread" + } + ] + }, + { + "name": "filePart", + "description": "Contains a part of a file", + "class": "FilePart", + "properties": [ + { + "name": "data", + "type": "bytes", + "description": "File bytes" + } + ] + }, + { + "name": "fileTypeNone", + "description": "The data is not a file", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeAnimation", + "description": "The file is an animation", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeAudio", + "description": "The file is an audio file", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeDocument", + "description": "The file is a document", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypePhoto", + "description": "The file is a photo", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeProfilePhoto", + "description": "The file is a profile photo", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeSecret", + "description": "The file was sent to a secret chat (the file type is not known to the server)", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeSecretThumbnail", + "description": "The file is a thumbnail of a file from a secret chat", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeSecure", + "description": "The file is a file from Secure storage used for storing Telegram Passport files", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeSticker", + "description": "The file is a sticker", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeThumbnail", + "description": "The file is a thumbnail of another file", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeUnknown", + "description": "The file type is not yet known", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeVideo", + "description": "The file is a video", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeVideoNote", + "description": "The file is a video note", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeVoiceNote", + "description": "The file is a voice note", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeWallpaper", + "description": "The file is a wallpaper or a background pattern", + "class": "FileType", + "properties": [] + }, + { + "name": "storageStatisticsByFileType", + "description": "Contains the storage usage statistics for a specific file type", + "class": "StorageStatisticsByFileType", + "properties": [ + { + "name": "file_type", + "type": "FileType", + "description": "File type" + }, + { + "name": "size", + "type": "int53", + "description": "Total size of the files" + }, + { + "name": "count", + "type": "int32", + "description": "Total number of files" + } + ] + }, + { + "name": "storageStatisticsByChat", + "description": "Contains the storage usage statistics for a specific chat", + "class": "StorageStatisticsByChat", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier; 0 if none" + }, + { + "name": "size", + "type": "int53", + "description": "Total size of the files in the chat" + }, + { + "name": "count", + "type": "int32", + "description": "Total number of files in the chat" + }, + { + "name": "by_file_type", + "type": "vector\u003cstorageStatisticsByFileType\u003e", + "description": "Statistics split by file types" + } + ] + }, + { + "name": "storageStatistics", + "description": "Contains the exact storage usage statistics split by chats and file type", + "class": "StorageStatistics", + "properties": [ + { + "name": "size", + "type": "int53", + "description": "Total size of files" + }, + { + "name": "count", + "type": "int32", + "description": "Total number of files" + }, + { + "name": "by_chat", + "type": "vector\u003cstorageStatisticsByChat\u003e", + "description": "Statistics split by chats" + } + ] + }, + { + "name": "storageStatisticsFast", + "description": "Contains approximate storage usage statistics, excluding files of unknown file type", + "class": "StorageStatisticsFast", + "properties": [ + { + "name": "files_size", + "type": "int53", + "description": "Approximate total size of files" + }, + { + "name": "file_count", + "type": "int32", + "description": "Approximate number of files" + }, + { + "name": "database_size", + "type": "int53", + "description": "Size of the database" + }, + { + "name": "language_pack_database_size", + "type": "int53", + "description": "Size of the language pack database" + }, + { + "name": "log_size", + "type": "int53", + "description": "Size of the TDLib internal log" + } + ] + }, + { + "name": "databaseStatistics", + "description": "Contains database statistics", + "class": "DatabaseStatistics", + "properties": [ + { + "name": "statistics", + "type": "string", + "description": "Database statistics in an unspecified human-readable format" + } + ] + }, + { + "name": "networkTypeNone", + "description": "The network is not available", + "class": "NetworkType", + "properties": [] + }, + { + "name": "networkTypeMobile", + "description": "A mobile network", + "class": "NetworkType", + "properties": [] + }, + { + "name": "networkTypeMobileRoaming", + "description": "A mobile roaming network", + "class": "NetworkType", + "properties": [] + }, + { + "name": "networkTypeWiFi", + "description": "A Wi-Fi network", + "class": "NetworkType", + "properties": [] + }, + { + "name": "networkTypeOther", + "description": "A different network type (e.g., Ethernet network)", + "class": "NetworkType", + "properties": [] + }, + { + "name": "networkStatisticsEntryFile", + "description": "Contains information about the total amount of data that was used to send and receive files", + "class": "NetworkStatisticsEntry", + "properties": [ + { + "name": "file_type", + "type": "FileType", + "description": "Type of the file the data is part of" + }, + { + "name": "network_type", + "type": "NetworkType", + "description": "Type of the network the data was sent through. Call setNetworkType to maintain the actual network type" + }, + { + "name": "sent_bytes", + "type": "int53", + "description": "Total number of bytes sent" + }, + { + "name": "received_bytes", + "type": "int53", + "description": "Total number of bytes received" + } + ] + }, + { + "name": "networkStatisticsEntryCall", + "description": "Contains information about the total amount of data that was used for calls", + "class": "NetworkStatisticsEntry", + "properties": [ + { + "name": "network_type", + "type": "NetworkType", + "description": "Type of the network the data was sent through. Call setNetworkType to maintain the actual network type" + }, + { + "name": "sent_bytes", + "type": "int53", + "description": "Total number of bytes sent" + }, + { + "name": "received_bytes", + "type": "int53", + "description": "Total number of bytes received" + }, + { + "name": "duration", + "type": "double", + "description": "Total call duration, in seconds" + } + ] + }, + { + "name": "networkStatistics", + "description": "A full list of available network statistic entries", + "class": "NetworkStatistics", + "properties": [ + { + "name": "since_date", + "type": "int32", + "description": "Point in time (Unix timestamp) from which the statistics are collected" + }, + { + "name": "entries", + "type": "vector\u003cNetworkStatisticsEntry\u003e", + "description": "Network statistics entries" + } + ] + }, + { + "name": "autoDownloadSettings", + "description": "Contains auto-download settings", + "class": "AutoDownloadSettings", + "properties": [ + { + "name": "is_auto_download_enabled", + "type": "Bool", + "description": "True, if the auto-download is enabled" + }, + { + "name": "max_photo_file_size", + "type": "int32", + "description": "The maximum size of a photo file to be auto-downloaded" + }, + { + "name": "max_video_file_size", + "type": "int32", + "description": "The maximum size of a video file to be auto-downloaded" + }, + { + "name": "max_other_file_size", + "type": "int32", + "description": "The maximum size of other file types to be auto-downloaded" + }, + { + "name": "video_upload_bitrate", + "type": "int32", + "description": "The maximum suggested bitrate for uploaded videos" + }, + { + "name": "preload_large_videos", + "type": "Bool", + "description": "True, if the beginning of video files needs to be preloaded for instant playback" + }, + { + "name": "preload_next_audio", + "type": "Bool", + "description": "True, if the next audio track needs to be preloaded while the user is listening to an audio file" + }, + { + "name": "use_less_data_for_calls", + "type": "Bool", + "description": "True, if \"use less data for calls\" option needs to be enabled" + } + ] + }, + { + "name": "autoDownloadSettingsPresets", + "description": "Contains auto-download settings presets for the user", + "class": "AutoDownloadSettingsPresets", + "properties": [ + { + "name": "low", + "type": "autoDownloadSettings", + "description": "Preset with lowest settings; supposed to be used by default when roaming" + }, + { + "name": "medium", + "type": "autoDownloadSettings", + "description": "Preset with medium settings; supposed to be used by default when using mobile data" + }, + { + "name": "high", + "type": "autoDownloadSettings", + "description": "Preset with highest settings; supposed to be used by default when connected on Wi-Fi" + } + ] + }, + { + "name": "connectionStateWaitingForNetwork", + "description": "Currently waiting for the network to become available. Use setNetworkType to change the available network type", + "class": "ConnectionState", + "properties": [] + }, + { + "name": "connectionStateConnectingToProxy", + "description": "Currently establishing a connection with a proxy server", + "class": "ConnectionState", + "properties": [] + }, + { + "name": "connectionStateConnecting", + "description": "Currently establishing a connection to the Telegram servers", + "class": "ConnectionState", + "properties": [] + }, + { + "name": "connectionStateUpdating", + "description": "Downloading data received while the application was offline", + "class": "ConnectionState", + "properties": [] + }, + { + "name": "connectionStateReady", + "description": "There is a working connection to the Telegram servers", + "class": "ConnectionState", + "properties": [] + }, + { + "name": "topChatCategoryUsers", + "description": "A category containing frequently used private chats with non-bot users", + "class": "TopChatCategory", + "properties": [] + }, + { + "name": "topChatCategoryBots", + "description": "A category containing frequently used private chats with bot users", + "class": "TopChatCategory", + "properties": [] + }, + { + "name": "topChatCategoryGroups", + "description": "A category containing frequently used basic groups and supergroups", + "class": "TopChatCategory", + "properties": [] + }, + { + "name": "topChatCategoryChannels", + "description": "A category containing frequently used channels", + "class": "TopChatCategory", + "properties": [] + }, + { + "name": "topChatCategoryInlineBots", + "description": "A category containing frequently used chats with inline bots sorted by their usage in inline mode", + "class": "TopChatCategory", + "properties": [] + }, + { + "name": "topChatCategoryCalls", + "description": "A category containing frequently used chats used for calls", + "class": "TopChatCategory", + "properties": [] + }, + { + "name": "topChatCategoryForwardChats", + "description": "A category containing frequently used chats used to forward messages", + "class": "TopChatCategory", + "properties": [] + }, + { + "name": "tMeUrlTypeUser", + "description": "A URL linking to a user", + "class": "TMeUrlType", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Identifier of the user" + } + ] + }, + { + "name": "tMeUrlTypeSupergroup", + "description": "A URL linking to a public supergroup or channel", + "class": "TMeUrlType", + "properties": [ + { + "name": "supergroup_id", + "type": "int53", + "description": "Identifier of the supergroup or channel" + } + ] + }, + { + "name": "tMeUrlTypeChatInvite", + "description": "A chat invite link", + "class": "TMeUrlType", + "properties": [ + { + "name": "info", + "type": "chatInviteLinkInfo", + "description": "Chat invite link info" + } + ] + }, + { + "name": "tMeUrlTypeStickerSet", + "description": "A URL linking to a sticker set", + "class": "TMeUrlType", + "properties": [ + { + "name": "sticker_set_id", + "type": "int64", + "description": "Identifier of the sticker set" + } + ] + }, + { + "name": "tMeUrl", + "description": "Represents a URL linking to an internal Telegram entity", + "class": "TMeUrl", + "properties": [ + { + "name": "url", + "type": "string", + "description": "URL" + }, + { + "name": "type", + "type": "TMeUrlType", + "description": "Type of the URL" + } + ] + }, + { + "name": "tMeUrls", + "description": "Contains a list of t.me URLs", + "class": "TMeUrls", + "properties": [ + { + "name": "urls", + "type": "vector\u003ctMeUrl\u003e", + "description": "List of URLs" + } + ] + }, + { + "name": "suggestedActionEnableArchiveAndMuteNewChats", + "description": "Suggests the user to enable \"archive_and_mute_new_chats_from_unknown_users\" option", + "class": "SuggestedAction", + "properties": [] + }, + { + "name": "suggestedActionCheckPhoneNumber", + "description": "Suggests the user to check authorization phone number and change the phone number if it is inaccessible", + "class": "SuggestedAction", + "properties": [] + }, + { + "name": "count", + "description": "Contains a counter", + "class": "Count", + "properties": [ + { + "name": "count", + "type": "int32", + "description": "Count" + } + ] + }, + { + "name": "text", + "description": "Contains some text", + "class": "Text", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Text" + } + ] + }, + { + "name": "seconds", + "description": "Contains a value representing a number of seconds", + "class": "Seconds", + "properties": [ + { + "name": "seconds", + "type": "double", + "description": "Number of seconds" + } + ] + }, + { + "name": "deepLinkInfo", + "description": "Contains information about a tg:// deep link", + "class": "DeepLinkInfo", + "properties": [ + { + "name": "text", + "type": "formattedText", + "description": "Text to be shown to the user" + }, + { + "name": "need_update_application", + "type": "Bool", + "description": "True, if user should be asked to update the application" + } + ] + }, + { + "name": "textParseModeMarkdown", + "description": "The text uses Markdown-style formatting", + "class": "TextParseMode", + "properties": [ + { + "name": "version", + "type": "int32", + "description": "Version of the parser: 0 or 1 - Telegram Bot API \"Markdown\" parse mode, 2 - Telegram Bot API \"MarkdownV2\" parse mode" + } + ] + }, + { + "name": "textParseModeHTML", + "description": "The text uses HTML-style formatting. The same as Telegram Bot API \"HTML\" parse mode", + "class": "TextParseMode", + "properties": [] + }, + { + "name": "proxyTypeSocks5", + "description": "A SOCKS5 proxy server", + "class": "ProxyType", + "properties": [ + { + "name": "username", + "type": "string", + "description": "Username for logging in; may be empty" + }, + { + "name": "password", + "type": "string", + "description": "Password for logging in; may be empty" + } + ] + }, + { + "name": "proxyTypeHttp", + "description": "A HTTP transparent proxy server", + "class": "ProxyType", + "properties": [ + { + "name": "username", + "type": "string", + "description": "Username for logging in; may be empty" + }, + { + "name": "password", + "type": "string", + "description": "Password for logging in; may be empty" + }, + { + "name": "http_only", + "type": "Bool", + "description": "Pass true if the proxy supports only HTTP requests and doesn't support transparent TCP connections via HTTP CONNECT method" + } + ] + }, + { + "name": "proxyTypeMtproto", + "description": "An MTProto proxy server", + "class": "ProxyType", + "properties": [ + { + "name": "secret", + "type": "string", + "description": "The proxy's secret in hexadecimal encoding" + } + ] + }, + { + "name": "proxy", + "description": "Contains information about a proxy server", + "class": "Proxy", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Unique identifier of the proxy" + }, + { + "name": "server", + "type": "string", + "description": "Proxy server IP address" + }, + { + "name": "port", + "type": "int32", + "description": "Proxy server port" + }, + { + "name": "last_used_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the proxy was last used; 0 if never" + }, + { + "name": "is_enabled", + "type": "Bool", + "description": "True, if the proxy is enabled now" + }, + { + "name": "type", + "type": "ProxyType", + "description": "Type of the proxy" + } + ] + }, + { + "name": "proxies", + "description": "Represents a list of proxy servers", + "class": "Proxies", + "properties": [ + { + "name": "proxies", + "type": "vector\u003cproxy\u003e", + "description": "List of proxy servers" + } + ] + }, + { + "name": "inputStickerStatic", + "description": "A static sticker in PNG format, which will be converted to WEBP server-side", + "class": "InputSticker", + "properties": [ + { + "name": "sticker", + "type": "InputFile", + "description": "PNG image with the sticker; must be up to 512 KB in size and fit in a 512x512 square" + }, + { + "name": "emojis", + "type": "string", + "description": "Emojis corresponding to the sticker" + }, + { + "name": "mask_position", + "type": "maskPosition", + "description": "For masks, position where the mask should be placed; may be null" + } + ] + }, + { + "name": "inputStickerAnimated", + "description": "An animated sticker in TGS format", + "class": "InputSticker", + "properties": [ + { + "name": "sticker", + "type": "InputFile", + "description": "File with the animated sticker. Only local or uploaded within a week files are supported. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements" + }, + { + "name": "emojis", + "type": "string", + "description": "Emojis corresponding to the sticker" + } + ] + }, + { + "name": "dateRange", + "description": "Represents a date range", + "class": "DateRange", + "properties": [ + { + "name": "start_date", + "type": "int32", + "description": "Point in time (Unix timestamp) at which the date range begins" + }, + { + "name": "end_date", + "type": "int32", + "description": "Point in time (Unix timestamp) at which the date range ends" + } + ] + }, + { + "name": "statisticalValue", + "description": "A value with information about its recent changes", + "class": "StatisticalValue", + "properties": [ + { + "name": "value", + "type": "double", + "description": "The current value" + }, + { + "name": "previous_value", + "type": "double", + "description": "The value for the previous day" + }, + { + "name": "growth_rate_percentage", + "type": "double", + "description": "The growth rate of the value, as a percentage" + } + ] + }, + { + "name": "statisticalGraphData", + "description": "A graph data", + "class": "StatisticalGraph", + "properties": [ + { + "name": "json_data", + "type": "string", + "description": "Graph data in JSON format" + }, + { + "name": "zoom_token", + "type": "string", + "description": "If non-empty, a token which can be used to receive a zoomed in graph" + } + ] + }, + { + "name": "statisticalGraphAsync", + "description": "The graph data to be asynchronously loaded through getStatisticalGraph", + "class": "StatisticalGraph", + "properties": [ + { + "name": "token", + "type": "string", + "description": "The token to use for data loading" + } + ] + }, + { + "name": "statisticalGraphError", + "description": "An error message to be shown to the user instead of the graph", + "class": "StatisticalGraph", + "properties": [ + { + "name": "error_message", + "type": "string", + "description": "The error message" + } + ] + }, + { + "name": "chatStatisticsMessageInteractionInfo", + "description": "Contains statistics about interactions with a message", + "class": "ChatStatisticsMessageInteractionInfo", + "properties": [ + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + }, + { + "name": "view_count", + "type": "int32", + "description": "Number of times the message was viewed" + }, + { + "name": "forward_count", + "type": "int32", + "description": "Number of times the message was forwarded" + } + ] + }, + { + "name": "chatStatisticsMessageSenderInfo", + "description": "Contains statistics about messages sent by a user", + "class": "ChatStatisticsMessageSenderInfo", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "sent_message_count", + "type": "int32", + "description": "Number of sent messages" + }, + { + "name": "average_character_count", + "type": "int32", + "description": "Average number of characters in sent messages" + } + ] + }, + { + "name": "chatStatisticsAdministratorActionsInfo", + "description": "Contains statistics about administrator actions done by a user", + "class": "ChatStatisticsAdministratorActionsInfo", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Administrator user identifier" + }, + { + "name": "deleted_message_count", + "type": "int32", + "description": "Number of messages deleted by the administrator" + }, + { + "name": "banned_user_count", + "type": "int32", + "description": "Number of users banned by the administrator" + }, + { + "name": "restricted_user_count", + "type": "int32", + "description": "Number of users restricted by the administrator" + } + ] + }, + { + "name": "chatStatisticsInviterInfo", + "description": "Contains statistics about number of new members invited by a user", + "class": "ChatStatisticsInviterInfo", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "added_member_count", + "type": "int32", + "description": "Number of new members invited by the user" + } + ] + }, + { + "name": "chatStatisticsSupergroup", + "description": "A detailed statistics about a supergroup chat", + "class": "ChatStatistics", + "properties": [ + { + "name": "period", + "type": "dateRange", + "description": "A period to which the statistics applies" + }, + { + "name": "member_count", + "type": "statisticalValue", + "description": "Number of members in the chat" + }, + { + "name": "message_count", + "type": "statisticalValue", + "description": "Number of messages sent to the chat" + }, + { + "name": "viewer_count", + "type": "statisticalValue", + "description": "Number of users who viewed messages in the chat" + }, + { + "name": "sender_count", + "type": "statisticalValue", + "description": "Number of users who sent messages to the chat" + }, + { + "name": "member_count_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of members in the chat" + }, + { + "name": "join_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of members joined and left the chat" + }, + { + "name": "join_by_source_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of new member joins per source" + }, + { + "name": "language_graph", + "type": "StatisticalGraph", + "description": "A graph containing distribution of active users per language" + }, + { + "name": "message_content_graph", + "type": "StatisticalGraph", + "description": "A graph containing distribution of sent messages by content type" + }, + { + "name": "action_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of different actions in the chat" + }, + { + "name": "day_graph", + "type": "StatisticalGraph", + "description": "A graph containing distribution of message views per hour" + }, + { + "name": "week_graph", + "type": "StatisticalGraph", + "description": "A graph containing distribution of message views per day of week" + }, + { + "name": "top_senders", + "type": "vector\u003cchatStatisticsMessageSenderInfo\u003e", + "description": "List of users sent most messages in the last week" + }, + { + "name": "top_administrators", + "type": "vector\u003cchatStatisticsAdministratorActionsInfo\u003e", + "description": "List of most active administrators in the last week" + }, + { + "name": "top_inviters", + "type": "vector\u003cchatStatisticsInviterInfo\u003e", + "description": "List of most active inviters of new members in the last week" + } + ] + }, + { + "name": "chatStatisticsChannel", + "description": "A detailed statistics about a channel chat", + "class": "ChatStatistics", + "properties": [ + { + "name": "period", + "type": "dateRange", + "description": "A period to which the statistics applies" + }, + { + "name": "member_count", + "type": "statisticalValue", + "description": "Number of members in the chat" + }, + { + "name": "mean_view_count", + "type": "statisticalValue", + "description": "Mean number of times the recently sent messages was viewed" + }, + { + "name": "mean_share_count", + "type": "statisticalValue", + "description": "Mean number of times the recently sent messages was shared" + }, + { + "name": "enabled_notifications_percentage", + "type": "double", + "description": "A percentage of users with enabled notifications for the chat" + }, + { + "name": "member_count_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of members in the chat" + }, + { + "name": "join_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of members joined and left the chat" + }, + { + "name": "mute_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of members muted and unmuted the chat" + }, + { + "name": "view_count_by_hour_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of message views in a given hour in the last two weeks" + }, + { + "name": "view_count_by_source_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of message views per source" + }, + { + "name": "join_by_source_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of new member joins per source" + }, + { + "name": "language_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of users viewed chat messages per language" + }, + { + "name": "message_interaction_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of chat message views and shares" + }, + { + "name": "instant_view_interaction_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of views of associated with the chat instant views" + }, + { + "name": "recent_message_interactions", + "type": "vector\u003cchatStatisticsMessageInteractionInfo\u003e", + "description": "Detailed statistics about number of views and shares of recently sent messages" + } + ] + }, + { + "name": "messageStatistics", + "description": "A detailed statistics about a message", + "class": "MessageStatistics", + "properties": [ + { + "name": "message_interaction_graph", + "type": "StatisticalGraph", + "description": "A graph containing number of message views and shares" + } + ] + }, + { + "name": "updateAuthorizationState", + "description": "The user authorization state has changed", + "class": "Update", + "properties": [ + { + "name": "authorization_state", + "type": "AuthorizationState", + "description": "New authorization state" + } + ] + }, + { + "name": "updateNewMessage", + "description": "A new message was received; can also be an outgoing message", + "class": "Update", + "properties": [ + { + "name": "message", + "type": "message", + "description": "The new message" + } + ] + }, + { + "name": "updateMessageSendAcknowledged", + "description": "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", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "The chat identifier of the sent message" + }, + { + "name": "message_id", + "type": "int53", + "description": "A temporary message identifier" + } + ] + }, + { + "name": "updateMessageSendSucceeded", + "description": "A message has been successfully sent", + "class": "Update", + "properties": [ + { + "name": "message", + "type": "message", + "description": "Information about the sent message. Usually only the message identifier, date, and content are changed, but almost all other fields can also change" + }, + { + "name": "old_message_id", + "type": "int53", + "description": "The previous temporary message identifier" + } + ] + }, + { + "name": "updateMessageSendFailed", + "description": "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", + "class": "Update", + "properties": [ + { + "name": "message", + "type": "message", + "description": "Contains information about the message which failed to send" + }, + { + "name": "old_message_id", + "type": "int53", + "description": "The previous temporary message identifier" + }, + { + "name": "error_code", + "type": "int32", + "description": "An error code" + }, + { + "name": "error_message", + "type": "string", + "description": "Error message" + } + ] + }, + { + "name": "updateMessageContent", + "description": "The message content has changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + }, + { + "name": "new_content", + "type": "MessageContent", + "description": "New message content" + } + ] + }, + { + "name": "updateMessageEdited", + "description": "A message was edited. Changes in the message content will come in a separate updateMessageContent", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + }, + { + "name": "edit_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the message was edited" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "New message reply markup; may be null" + } + ] + }, + { + "name": "updateMessageIsPinned", + "description": "The message pinned state was changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_id", + "type": "int53", + "description": "The message identifier" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is pinned" + } + ] + }, + { + "name": "updateMessageInteractionInfo", + "description": "The information about interactions with a message has changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + }, + { + "name": "interaction_info", + "type": "messageInteractionInfo", + "description": "New information about interactions with the message; may be null" + } + ] + }, + { + "name": "updateMessageContentOpened", + "description": "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", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + } + ] + }, + { + "name": "updateMessageMentionRead", + "description": "A message with an unread mention was read", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + }, + { + "name": "unread_mention_count", + "type": "int32", + "description": "The new number of unread mention messages left in the chat" + } + ] + }, + { + "name": "updateMessageLiveLocationViewed", + "description": "A message with a live location was viewed. When the update is received, the application is supposed to update the live location", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat with the live location message" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message with live location" + } + ] + }, + { + "name": "updateNewChat", + "description": "A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the application. The chat field changes will be reported through separate updates", + "class": "Update", + "properties": [ + { + "name": "chat", + "type": "chat", + "description": "The chat" + } + ] + }, + { + "name": "updateChatTitle", + "description": "The title of a chat was changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "title", + "type": "string", + "description": "The new chat title" + } + ] + }, + { + "name": "updateChatPhoto", + "description": "A chat photo was changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "photo", + "type": "chatPhotoInfo", + "description": "The new chat photo; may be null" + } + ] + }, + { + "name": "updateChatPermissions", + "description": "Chat permissions was changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "permissions", + "type": "chatPermissions", + "description": "The new chat permissions" + } + ] + }, + { + "name": "updateChatLastMessage", + "description": "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", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "last_message", + "type": "message", + "description": "The new last message in the chat; may be null" + }, + { + "name": "positions", + "type": "vector\u003cchatPosition\u003e", + "description": "The new chat positions in the chat lists" + } + ] + }, + { + "name": "updateChatPosition", + "description": "The position of a chat in a chat list has changed. Instead of this update updateChatLastMessage or updateChatDraftMessage might be sent", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "position", + "type": "chatPosition", + "description": "New chat position. If new order is 0, then the chat needs to be removed from the list" + } + ] + }, + { + "name": "updateChatIsMarkedAsUnread", + "description": "A chat was marked as unread or was read", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "is_marked_as_unread", + "type": "Bool", + "description": "New value of is_marked_as_unread" + } + ] + }, + { + "name": "updateChatIsBlocked", + "description": "A chat was blocked or unblocked", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "is_blocked", + "type": "Bool", + "description": "New value of is_blocked" + } + ] + }, + { + "name": "updateChatHasScheduledMessages", + "description": "A chat's has_scheduled_messages field has changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "has_scheduled_messages", + "type": "Bool", + "description": "New value of has_scheduled_messages" + } + ] + }, + { + "name": "updateChatDefaultDisableNotification", + "description": "The value of the default disable_notification parameter, used when a message is sent to the chat, was changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "default_disable_notification", + "type": "Bool", + "description": "The new default_disable_notification value" + } + ] + }, + { + "name": "updateChatReadInbox", + "description": "Incoming messages were read or number of unread messages has been changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "last_read_inbox_message_id", + "type": "int53", + "description": "Identifier of the last read incoming message" + }, + { + "name": "unread_count", + "type": "int32", + "description": "The number of unread messages left in the chat" + } + ] + }, + { + "name": "updateChatReadOutbox", + "description": "Outgoing messages were read", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "last_read_outbox_message_id", + "type": "int53", + "description": "Identifier of last read outgoing message" + } + ] + }, + { + "name": "updateChatUnreadMentionCount", + "description": "The chat unread_mention_count has changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "unread_mention_count", + "type": "int32", + "description": "The number of unread mention messages left in the chat" + } + ] + }, + { + "name": "updateChatNotificationSettings", + "description": "Notification settings for a chat were changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "notification_settings", + "type": "chatNotificationSettings", + "description": "The new notification settings" + } + ] + }, + { + "name": "updateScopeNotificationSettings", + "description": "Notification settings for some type of chats were updated", + "class": "Update", + "properties": [ + { + "name": "scope", + "type": "NotificationSettingsScope", + "description": "Types of chats for which notification settings were updated" + }, + { + "name": "notification_settings", + "type": "scopeNotificationSettings", + "description": "The new notification settings" + } + ] + }, + { + "name": "updateChatActionBar", + "description": "The chat action bar was changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "action_bar", + "type": "ChatActionBar", + "description": "The new value of the action bar; may be null" + } + ] + }, + { + "name": "updateChatReplyMarkup", + "description": "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", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "reply_markup_message_id", + "type": "int53", + "description": "Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat" + } + ] + }, + { + "name": "updateChatDraftMessage", + "description": "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", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "draft_message", + "type": "draftMessage", + "description": "The new draft message; may be null" + }, + { + "name": "positions", + "type": "vector\u003cchatPosition\u003e", + "description": "The new chat positions in the chat lists" + } + ] + }, + { + "name": "updateChatFilters", + "description": "The list of chat filters or a chat filter has changed", + "class": "Update", + "properties": [ + { + "name": "chat_filters", + "type": "vector\u003cchatFilterInfo\u003e", + "description": "The new list of chat filters" + } + ] + }, + { + "name": "updateChatOnlineMemberCount", + "description": "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", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat" + }, + { + "name": "online_member_count", + "type": "int32", + "description": "New number of online members in the chat, or 0 if unknown" + } + ] + }, + { + "name": "updateNotification", + "description": "A notification was changed", + "class": "Update", + "properties": [ + { + "name": "notification_group_id", + "type": "int32", + "description": "Unique notification group identifier" + }, + { + "name": "notification", + "type": "notification", + "description": "Changed notification" + } + ] + }, + { + "name": "updateNotificationGroup", + "description": "A list of active notifications in a notification group has changed", + "class": "Update", + "properties": [ + { + "name": "notification_group_id", + "type": "int32", + "description": "Unique notification group identifier" + }, + { + "name": "type", + "type": "NotificationGroupType", + "description": "New type of the notification group" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of a chat to which all notifications in the group belong" + }, + { + "name": "notification_settings_chat_id", + "type": "int53", + "description": "Chat identifier, which notification settings must be applied to the added notifications" + }, + { + "name": "is_silent", + "type": "Bool", + "description": "True, if the notifications should be shown without sound" + }, + { + "name": "total_count", + "type": "int32", + "description": "Total number of unread notifications in the group, can be bigger than number of active notifications" + }, + { + "name": "added_notifications", + "type": "vector\u003cnotification\u003e", + "description": "List of added group notifications, sorted by notification ID" + }, + { + "name": "removed_notification_ids", + "type": "vector\u003cint32\u003e", + "description": "Identifiers of removed group notifications, sorted by notification ID" + } + ] + }, + { + "name": "updateActiveNotifications", + "description": "Contains active notifications that was shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update", + "class": "Update", + "properties": [ + { + "name": "groups", + "type": "vector\u003cnotificationGroup\u003e", + "description": "Lists of active notification groups" + } + ] + }, + { + "name": "updateHavePendingNotifications", + "description": "Describes whether there are some pending notification updates. Can be used to prevent application from killing, while there are some pending notifications", + "class": "Update", + "properties": [ + { + "name": "have_delayed_notifications", + "type": "Bool", + "description": "True, if there are some delayed notification updates, which will be sent soon" + }, + { + "name": "have_unreceived_notifications", + "type": "Bool", + "description": "True, if there can be some yet unreceived notifications, which are being fetched from the server" + } + ] + }, + { + "name": "updateDeleteMessages", + "description": "Some messages were deleted", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_ids", + "type": "vector\u003cint53\u003e", + "description": "Identifiers of the deleted messages" + }, + { + "name": "is_permanent", + "type": "Bool", + "description": "True, if the messages are permanently deleted by a user (as opposed to just becoming inaccessible)" + }, + { + "name": "from_cache", + "type": "Bool", + "description": "True, if the messages are deleted only from the cache and can possibly be retrieved again in the future" + } + ] + }, + { + "name": "updateUserChatAction", + "description": "User activity in the chat has changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_thread_id", + "type": "int53", + "description": "If not 0, a message thread identifier in which the action was performed" + }, + { + "name": "user_id", + "type": "int32", + "description": "Identifier of a user performing an action" + }, + { + "name": "action", + "type": "ChatAction", + "description": "The action description" + } + ] + }, + { + "name": "updateUserStatus", + "description": "The user went online or offline", + "class": "Update", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "status", + "type": "UserStatus", + "description": "New status of the user" + } + ] + }, + { + "name": "updateUser", + "description": "Some data of a user has changed. This update is guaranteed to come before the user identifier is returned to the application", + "class": "Update", + "properties": [ + { + "name": "user", + "type": "user", + "description": "New data about the user" + } + ] + }, + { + "name": "updateBasicGroup", + "description": "Some data of a basic group has changed. This update is guaranteed to come before the basic group identifier is returned to the application", + "class": "Update", + "properties": [ + { + "name": "basic_group", + "type": "basicGroup", + "description": "New data about the group" + } + ] + }, + { + "name": "updateSupergroup", + "description": "Some data of a supergroup or a channel has changed. This update is guaranteed to come before the supergroup identifier is returned to the application", + "class": "Update", + "properties": [ + { + "name": "supergroup", + "type": "supergroup", + "description": "New data about the supergroup" + } + ] + }, + { + "name": "updateSecretChat", + "description": "Some data of a secret chat has changed. This update is guaranteed to come before the secret chat identifier is returned to the application", + "class": "Update", + "properties": [ + { + "name": "secret_chat", + "type": "secretChat", + "description": "New data about the secret chat" + } + ] + }, + { + "name": "updateUserFullInfo", + "description": "Some data from userFullInfo has been changed", + "class": "Update", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "user_full_info", + "type": "userFullInfo", + "description": "New full information about the user" + } + ] + }, + { + "name": "updateBasicGroupFullInfo", + "description": "Some data from basicGroupFullInfo has been changed", + "class": "Update", + "properties": [ + { + "name": "basic_group_id", + "type": "int32", + "description": "Identifier of a basic group" + }, + { + "name": "basic_group_full_info", + "type": "basicGroupFullInfo", + "description": "New full information about the group" + } + ] + }, + { + "name": "updateSupergroupFullInfo", + "description": "Some data from supergroupFullInfo has been changed", + "class": "Update", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "Identifier of the supergroup or channel" + }, + { + "name": "supergroup_full_info", + "type": "supergroupFullInfo", + "description": "New full information about the supergroup" + } + ] + }, + { + "name": "updateServiceNotification", + "description": "Service notification from the server. Upon receiving this the application must show a popup with the content of the notification", + "class": "Update", + "properties": [ + { + "name": "type", + "type": "string", + "description": "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" + }, + { + "name": "content", + "type": "MessageContent", + "description": "Notification content" + } + ] + }, + { + "name": "updateFile", + "description": "Information about a file was updated", + "class": "Update", + "properties": [ + { + "name": "file", + "type": "file", + "description": "New data about the file" + } + ] + }, + { + "name": "updateFileGenerationStart", + "description": "The file generation process needs to be started by the application", + "class": "Update", + "properties": [ + { + "name": "generation_id", + "type": "int64", + "description": "Unique identifier for the generation process" + }, + { + "name": "original_path", + "type": "string", + "description": "The path to a file from which a new file is generated; may be empty" + }, + { + "name": "destination_path", + "type": "string", + "description": "The path to a file that should be created and where the new file should be generated" + }, + { + "name": "conversion", + "type": "string", + "description": "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 application" + } + ] + }, + { + "name": "updateFileGenerationStop", + "description": "File generation is no longer needed", + "class": "Update", + "properties": [ + { + "name": "generation_id", + "type": "int64", + "description": "Unique identifier for the generation process" + } + ] + }, + { + "name": "updateCall", + "description": "New call was created or information about a call was updated", + "class": "Update", + "properties": [ + { + "name": "call", + "type": "call", + "description": "New data about a call" + } + ] + }, + { + "name": "updateNewCallSignalingData", + "description": "New call signaling data arrived", + "class": "Update", + "properties": [ + { + "name": "call_id", + "type": "int32", + "description": "The call identifier" + }, + { + "name": "data", + "type": "bytes", + "description": "The data" + } + ] + }, + { + "name": "updateUserPrivacySettingRules", + "description": "Some privacy setting rules have been changed", + "class": "Update", + "properties": [ + { + "name": "setting", + "type": "UserPrivacySetting", + "description": "The privacy setting" + }, + { + "name": "rules", + "type": "userPrivacySettingRules", + "description": "New privacy rules" + } + ] + }, + { + "name": "updateUnreadMessageCount", + "description": "Number of unread messages in a chat list has changed. This update is sent only if the message database is used", + "class": "Update", + "properties": [ + { + "name": "chat_list", + "type": "ChatList", + "description": "The chat list with changed number of unread messages" + }, + { + "name": "unread_count", + "type": "int32", + "description": "Total number of unread messages" + }, + { + "name": "unread_unmuted_count", + "type": "int32", + "description": "Total number of unread messages in unmuted chats" + } + ] + }, + { + "name": "updateUnreadChatCount", + "description": "Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if the message database is used", + "class": "Update", + "properties": [ + { + "name": "chat_list", + "type": "ChatList", + "description": "The chat list with changed number of unread messages" + }, + { + "name": "total_count", + "type": "int32", + "description": "Approximate total number of chats in the chat list" + }, + { + "name": "unread_count", + "type": "int32", + "description": "Total number of unread chats" + }, + { + "name": "unread_unmuted_count", + "type": "int32", + "description": "Total number of unread unmuted chats" + }, + { + "name": "marked_as_unread_count", + "type": "int32", + "description": "Total number of chats marked as unread" + }, + { + "name": "marked_as_unread_unmuted_count", + "type": "int32", + "description": "Total number of unmuted chats marked as unread" + } + ] + }, + { + "name": "updateOption", + "description": "An option changed its value", + "class": "Update", + "properties": [ + { + "name": "name", + "type": "string", + "description": "The option name" + }, + { + "name": "value", + "type": "OptionValue", + "description": "The new option value" + } + ] + }, + { + "name": "updateStickerSet", + "description": "A sticker set has changed", + "class": "Update", + "properties": [ + { + "name": "sticker_set", + "type": "stickerSet", + "description": "The sticker set" + } + ] + }, + { + "name": "updateInstalledStickerSets", + "description": "The list of installed sticker sets was updated", + "class": "Update", + "properties": [ + { + "name": "is_masks", + "type": "Bool", + "description": "True, if the list of installed mask sticker sets was updated" + }, + { + "name": "sticker_set_ids", + "type": "vector\u003cint64\u003e", + "description": "The new list of installed ordinary sticker sets" + } + ] + }, + { + "name": "updateTrendingStickerSets", + "description": "The list of trending sticker sets was updated or some of them were viewed", + "class": "Update", + "properties": [ + { + "name": "sticker_sets", + "type": "stickerSets", + "description": "The prefix of the list of trending sticker sets with the newest trending sticker sets" + } + ] + }, + { + "name": "updateRecentStickers", + "description": "The list of recently used stickers was updated", + "class": "Update", + "properties": [ + { + "name": "is_attached", + "type": "Bool", + "description": "True, if the list of stickers attached to photo or video files was updated, otherwise the list of sent stickers is updated" + }, + { + "name": "sticker_ids", + "type": "vector\u003cint32\u003e", + "description": "The new list of file identifiers of recently used stickers" + } + ] + }, + { + "name": "updateFavoriteStickers", + "description": "The list of favorite stickers was updated", + "class": "Update", + "properties": [ + { + "name": "sticker_ids", + "type": "vector\u003cint32\u003e", + "description": "The new list of file identifiers of favorite stickers" + } + ] + }, + { + "name": "updateSavedAnimations", + "description": "The list of saved animations was updated", + "class": "Update", + "properties": [ + { + "name": "animation_ids", + "type": "vector\u003cint32\u003e", + "description": "The new list of file identifiers of saved animations" + } + ] + }, + { + "name": "updateSelectedBackground", + "description": "The selected background has changed", + "class": "Update", + "properties": [ + { + "name": "for_dark_theme", + "type": "Bool", + "description": "True, if background for dark theme has changed" + }, + { + "name": "background", + "type": "background", + "description": "The new selected background; may be null" + } + ] + }, + { + "name": "updateLanguagePackStrings", + "description": "Some language pack strings have been updated", + "class": "Update", + "properties": [ + { + "name": "localization_target", + "type": "string", + "description": "Localization target to which the language pack belongs" + }, + { + "name": "language_pack_id", + "type": "string", + "description": "Identifier of the updated language pack" + }, + { + "name": "strings", + "type": "vector\u003clanguagePackString\u003e", + "description": "List of changed language pack strings" + } + ] + }, + { + "name": "updateConnectionState", + "description": "The connection state has changed. This update must be used only to show a human-readable description of the connection state", + "class": "Update", + "properties": [ + { + "name": "state", + "type": "ConnectionState", + "description": "The new connection state" + } + ] + }, + { + "name": "updateTermsOfService", + "description": "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\"", + "class": "Update", + "properties": [ + { + "name": "terms_of_service_id", + "type": "string", + "description": "Identifier of the terms of service" + }, + { + "name": "terms_of_service", + "type": "termsOfService", + "description": "The new terms of service" + } + ] + }, + { + "name": "updateUsersNearby", + "description": "The list of users nearby has changed. The update is guaranteed to be sent only 60 seconds after a successful searchChatsNearby request", + "class": "Update", + "properties": [ + { + "name": "users_nearby", + "type": "vector\u003cchatNearby\u003e", + "description": "The new list of users nearby" + } + ] + }, + { + "name": "updateDiceEmojis", + "description": "The list of supported dice emojis has changed", + "class": "Update", + "properties": [ + { + "name": "emojis", + "type": "vector\u003cstring\u003e", + "description": "The new list of supported dice emojis" + } + ] + }, + { + "name": "updateAnimationSearchParameters", + "description": "The parameters of animation search through GetOption(\"animation_search_bot_username\") bot has changed", + "class": "Update", + "properties": [ + { + "name": "provider", + "type": "string", + "description": "Name of the animation search provider" + }, + { + "name": "emojis", + "type": "vector\u003cstring\u003e", + "description": "The new list of emojis suggested for searching" + } + ] + }, + { + "name": "updateSuggestedActions", + "description": "The list of suggested to the user actions has changed", + "class": "Update", + "properties": [ + { + "name": "added_actions", + "type": "vector\u003cSuggestedAction\u003e", + "description": "Added suggested actions" + }, + { + "name": "removed_actions", + "type": "vector\u003cSuggestedAction\u003e", + "description": "Removed suggested actions" + } + ] + }, + { + "name": "updateNewInlineQuery", + "description": "A new incoming inline query; for bots only", + "class": "Update", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Unique query identifier" + }, + { + "name": "sender_user_id", + "type": "int32", + "description": "Identifier of the user who sent the query" + }, + { + "name": "user_location", + "type": "location", + "description": "User location; may be null" + }, + { + "name": "query", + "type": "string", + "description": "Text of the query" + }, + { + "name": "offset", + "type": "string", + "description": "Offset of the first entry to return" + } + ] + }, + { + "name": "updateNewChosenInlineResult", + "description": "The user has chosen a result of an inline query; for bots only", + "class": "Update", + "properties": [ + { + "name": "sender_user_id", + "type": "int32", + "description": "Identifier of the user who sent the query" + }, + { + "name": "user_location", + "type": "location", + "description": "User location; may be null" + }, + { + "name": "query", + "type": "string", + "description": "Text of the query" + }, + { + "name": "result_id", + "type": "string", + "description": "Identifier of the chosen result" + }, + { + "name": "inline_message_id", + "type": "string", + "description": "Identifier of the sent inline message, if known" + } + ] + }, + { + "name": "updateNewCallbackQuery", + "description": "A new incoming callback query; for bots only", + "class": "Update", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Unique query identifier" + }, + { + "name": "sender_user_id", + "type": "int32", + "description": "Identifier of the user who sent the query" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat where the query was sent" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message, from which the query originated" + }, + { + "name": "chat_instance", + "type": "int64", + "description": "Identifier that uniquely corresponds to the chat to which the message was sent" + }, + { + "name": "payload", + "type": "CallbackQueryPayload", + "description": "Query payload" + } + ] + }, + { + "name": "updateNewInlineCallbackQuery", + "description": "A new incoming callback query from a message sent via a bot; for bots only", + "class": "Update", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Unique query identifier" + }, + { + "name": "sender_user_id", + "type": "int32", + "description": "Identifier of the user who sent the query" + }, + { + "name": "inline_message_id", + "type": "string", + "description": "Identifier of the inline message, from which the query originated" + }, + { + "name": "chat_instance", + "type": "int64", + "description": "An identifier uniquely corresponding to the chat a message was sent to" + }, + { + "name": "payload", + "type": "CallbackQueryPayload", + "description": "Query payload" + } + ] + }, + { + "name": "updateNewShippingQuery", + "description": "A new incoming shipping query; for bots only. Only for invoices with flexible price", + "class": "Update", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Unique query identifier" + }, + { + "name": "sender_user_id", + "type": "int32", + "description": "Identifier of the user who sent the query" + }, + { + "name": "invoice_payload", + "type": "string", + "description": "Invoice payload" + }, + { + "name": "shipping_address", + "type": "address", + "description": "User shipping address" + } + ] + }, + { + "name": "updateNewPreCheckoutQuery", + "description": "A new incoming pre-checkout query; for bots only. Contains full information about a checkout", + "class": "Update", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Unique query identifier" + }, + { + "name": "sender_user_id", + "type": "int32", + "description": "Identifier of the user who sent the query" + }, + { + "name": "currency", + "type": "string", + "description": "Currency for the product price" + }, + { + "name": "total_amount", + "type": "int53", + "description": "Total price for the product, in the minimal quantity of the currency" + }, + { + "name": "invoice_payload", + "type": "bytes", + "description": "Invoice payload" + }, + { + "name": "shipping_option_id", + "type": "string", + "description": "Identifier of a shipping option chosen by the user; may be empty if not applicable" + }, + { + "name": "order_info", + "type": "orderInfo", + "description": "Information about the order; may be null" + } + ] + }, + { + "name": "updateNewCustomEvent", + "description": "A new incoming event; for bots only", + "class": "Update", + "properties": [ + { + "name": "event", + "type": "string", + "description": "A JSON-serialized event" + } + ] + }, + { + "name": "updateNewCustomQuery", + "description": "A new incoming query; for bots only", + "class": "Update", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "The query identifier" + }, + { + "name": "data", + "type": "string", + "description": "JSON-serialized query data" + }, + { + "name": "timeout", + "type": "int32", + "description": "Query timeout" + } + ] + }, + { + "name": "updatePoll", + "description": "A poll was updated; for bots only", + "class": "Update", + "properties": [ + { + "name": "poll", + "type": "poll", + "description": "New data about the poll" + } + ] + }, + { + "name": "updatePollAnswer", + "description": "A user changed the answer to a poll; for bots only", + "class": "Update", + "properties": [ + { + "name": "poll_id", + "type": "int64", + "description": "Unique poll identifier" + }, + { + "name": "user_id", + "type": "int32", + "description": "The user, who changed the answer to the poll" + }, + { + "name": "option_ids", + "type": "vector\u003cint32\u003e", + "description": "0-based identifiers of answer options, chosen by the user" + } + ] + }, + { + "name": "updates", + "description": "Contains a list of updates", + "class": "Updates", + "properties": [ + { + "name": "updates", + "type": "vector\u003cUpdate\u003e", + "description": "List of updates" + } + ] + }, + { + "name": "logStreamDefault", + "description": "The log is written to stderr or an OS specific log", + "class": "LogStream", + "properties": [] + }, + { + "name": "logStreamFile", + "description": "The log is written to a file", + "class": "LogStream", + "properties": [ + { + "name": "path", + "type": "string", + "description": "Path to the file to where the internal TDLib log will be written" + }, + { + "name": "max_file_size", + "type": "int53", + "description": "The maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated" + }, + { + "name": "redirect_stderr", + "type": "Bool", + "description": "Pass true to additionally redirect stderr to the log file. Ignored on Windows" + } + ] + }, + { + "name": "logStreamEmpty", + "description": "The log is written nowhere", + "class": "LogStream", + "properties": [] + }, + { + "name": "logVerbosityLevel", + "description": "Contains a TDLib internal log verbosity level", + "class": "LogVerbosityLevel", + "properties": [ + { + "name": "verbosity_level", + "type": "int32", + "description": "Log verbosity level" + } + ] + }, + { + "name": "logTags", + "description": "Contains a list of available TDLib internal log tags", + "class": "LogTags", + "properties": [ + { + "name": "tags", + "type": "vector\u003cstring\u003e", + "description": "List of log tags" + } + ] + }, + { + "name": "testInt", + "description": "A simple object containing a number; for testing only", + "class": "TestInt", + "properties": [ + { + "name": "value", + "type": "int32", + "description": "Number" + } + ] + }, + { + "name": "testString", + "description": "A simple object containing a string; for testing only", + "class": "TestString", + "properties": [ + { + "name": "value", + "type": "string", + "description": "String" + } + ] + }, + { + "name": "testBytes", + "description": "A simple object containing a sequence of bytes; for testing only", + "class": "TestBytes", + "properties": [ + { + "name": "value", + "type": "bytes", + "description": "Bytes" + } + ] + }, + { + "name": "testVectorInt", + "description": "A simple object containing a vector of numbers; for testing only", + "class": "TestVectorInt", + "properties": [ + { + "name": "value", + "type": "vector\u003cint32\u003e", + "description": "Vector of numbers" + } + ] + }, + { + "name": "testVectorIntObject", + "description": "A simple object containing a vector of objects that hold a number; for testing only", + "class": "TestVectorIntObject", + "properties": [ + { + "name": "value", + "type": "vector\u003ctestInt\u003e", + "description": "Vector of objects" + } + ] + }, + { + "name": "testVectorString", + "description": "A simple object containing a vector of strings; for testing only", + "class": "TestVectorString", + "properties": [ + { + "name": "value", + "type": "vector\u003cstring\u003e", + "description": "Vector of strings" + } + ] + }, + { + "name": "testVectorStringObject", + "description": "A simple object containing a vector of objects that hold a string; for testing only", + "class": "TestVectorStringObject", + "properties": [ + { + "name": "value", + "type": "vector\u003ctestString\u003e", + "description": "Vector of objects" + } + ] + } + ], + "classes": [ + { + "name": "AuthenticationCodeType", + "description": "Provides information about the method by which an authentication code is delivered to the user" + }, + { + "name": "AuthorizationState", + "description": "Represents the current authorization state of the TDLib client" + }, + { + "name": "InputFile", + "description": "Points to a file" + }, + { + "name": "ThumbnailFormat", + "description": "Describes format of the thumbnail" + }, + { + "name": "MaskPoint", + "description": "Part of the face, relative to which a mask should be placed" + }, + { + "name": "PollType", + "description": "Describes the type of a poll" + }, + { + "name": "UserType", + "description": "Represents the type of a user. The following types are possible: regular users, deleted users and bots" + }, + { + "name": "InputChatPhoto", + "description": "Describes a photo to be set as a user profile or chat photo" + }, + { + "name": "ChatMemberStatus", + "description": "Provides information about the status of a member in a chat" + }, + { + "name": "ChatMembersFilter", + "description": "Specifies the kind of chat members to return in searchChatMembers" + }, + { + "name": "SupergroupMembersFilter", + "description": "Specifies the kind of chat members to return in getSupergroupMembers" + }, + { + "name": "SecretChatState", + "description": "Describes the current secret chat state" + }, + { + "name": "MessageSender", + "description": "Contains information about the sender of a message" + }, + { + "name": "MessageForwardOrigin", + "description": "Contains information about the origin of a forwarded message" + }, + { + "name": "MessageSendingState", + "description": "Contains information about the sending state of the message" + }, + { + "name": "NotificationSettingsScope", + "description": "Describes the types of chats to which notification settings are applied" + }, + { + "name": "ChatType", + "description": "Describes the type of a chat" + }, + { + "name": "ChatList", + "description": "Describes a list of chats" + }, + { + "name": "ChatSource", + "description": "Describes a reason why an external chat is shown in a chat list" + }, + { + "name": "PublicChatType", + "description": "Describes a type of public chats" + }, + { + "name": "ChatActionBar", + "description": "Describes actions which should be possible to do through a chat action bar" + }, + { + "name": "KeyboardButtonType", + "description": "Describes a keyboard button type" + }, + { + "name": "InlineKeyboardButtonType", + "description": "Describes the type of an inline keyboard button" + }, + { + "name": "ReplyMarkup", + "description": "Contains a description of a custom keyboard and actions that can be done with it to quickly reply to bots" + }, + { + "name": "LoginUrlInfo", + "description": "Contains information about an inline button of type inlineKeyboardButtonTypeLoginUrl" + }, + { + "name": "RichText", + "description": "Describes a text object inside an instant-view web page" + }, + { + "name": "PageBlockHorizontalAlignment", + "description": "Describes a horizontal alignment of a table cell content" + }, + { + "name": "PageBlockVerticalAlignment", + "description": "Describes a Vertical alignment of a table cell content" + }, + { + "name": "PageBlock", + "description": "Describes a block of an instant view web page" + }, + { + "name": "InputCredentials", + "description": "Contains information about the payment method chosen by the user" + }, + { + "name": "PassportElementType", + "description": "Contains the type of a Telegram Passport element" + }, + { + "name": "PassportElement", + "description": "Contains information about a Telegram Passport element" + }, + { + "name": "InputPassportElement", + "description": "Contains information about a Telegram Passport element to be saved" + }, + { + "name": "PassportElementErrorSource", + "description": "Contains the description of an error in a Telegram Passport element" + }, + { + "name": "InputPassportElementErrorSource", + "description": "Contains the description of an error in a Telegram Passport element; for bots only" + }, + { + "name": "MessageContent", + "description": "Contains the content of a message" + }, + { + "name": "TextEntityType", + "description": "Represents a part of the text which must be formatted differently" + }, + { + "name": "MessageSchedulingState", + "description": "Contains information about the time when a scheduled message will be sent" + }, + { + "name": "InputMessageContent", + "description": "The content of a message to send" + }, + { + "name": "SearchMessagesFilter", + "description": "Represents a filter for message search results" + }, + { + "name": "ChatAction", + "description": "Describes the different types of activity in a chat" + }, + { + "name": "UserStatus", + "description": "Describes the last time the user was online" + }, + { + "name": "CallDiscardReason", + "description": "Describes the reason why a call was discarded" + }, + { + "name": "CallServerType", + "description": "Describes the type of a call server" + }, + { + "name": "CallState", + "description": "Describes the current call state" + }, + { + "name": "CallProblem", + "description": "Describes the exact type of a problem with a call" + }, + { + "name": "DiceStickers", + "description": "Contains animated stickers which should be used for dice animation rendering" + }, + { + "name": "InputInlineQueryResult", + "description": "Represents a single result of an inline query; for bots only" + }, + { + "name": "InlineQueryResult", + "description": "Represents a single result of an inline query" + }, + { + "name": "CallbackQueryPayload", + "description": "Represents a payload of a callback query" + }, + { + "name": "ChatEventAction", + "description": "Represents a chat event" + }, + { + "name": "LanguagePackStringValue", + "description": "Represents the value of a string in a language pack" + }, + { + "name": "DeviceToken", + "description": "Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org" + }, + { + "name": "BackgroundFill", + "description": "Describes a fill of a background" + }, + { + "name": "BackgroundType", + "description": "Describes the type of a background" + }, + { + "name": "InputBackground", + "description": "Contains information about background to set" + }, + { + "name": "CanTransferOwnershipResult", + "description": "Represents result of checking whether the current session can be used to transfer a chat ownership to another user" + }, + { + "name": "CheckChatUsernameResult", + "description": "Represents result of checking whether a username can be set for a chat" + }, + { + "name": "PushMessageContent", + "description": "Contains content of a push message notification" + }, + { + "name": "NotificationType", + "description": "Contains detailed information about a notification" + }, + { + "name": "NotificationGroupType", + "description": "Describes the type of notifications in a notification group" + }, + { + "name": "OptionValue", + "description": "Represents the value of an option" + }, + { + "name": "JsonValue", + "description": "Represents a JSON value" + }, + { + "name": "UserPrivacySettingRule", + "description": "Represents a single rule for managing privacy settings" + }, + { + "name": "UserPrivacySetting", + "description": "Describes available user privacy settings" + }, + { + "name": "ChatReportReason", + "description": "Describes the reason why a chat is reported" + }, + { + "name": "FileType", + "description": "Represents the type of a file" + }, + { + "name": "NetworkType", + "description": "Represents the type of a network" + }, + { + "name": "NetworkStatisticsEntry", + "description": "Contains statistics about network usage" + }, + { + "name": "ConnectionState", + "description": "Describes the current state of the connection to Telegram servers" + }, + { + "name": "TopChatCategory", + "description": "Represents the categories of chats for which a list of frequently used chats can be retrieved" + }, + { + "name": "TMeUrlType", + "description": "Describes the type of a URL linking to an internal Telegram entity" + }, + { + "name": "SuggestedAction", + "description": "Describes an action suggested to the current user" + }, + { + "name": "TextParseMode", + "description": "Describes the way the text should be parsed for TextEntities" + }, + { + "name": "ProxyType", + "description": "Describes the type of a proxy server" + }, + { + "name": "InputSticker", + "description": "Describes a sticker that needs to be added to a sticker set" + }, + { + "name": "StatisticalGraph", + "description": "Describes a statistical graph" + }, + { + "name": "ChatStatistics", + "description": "Contains a detailed statistics about a chat" + }, + { + "name": "Update", + "description": "Contains notifications about data changes" + }, + { + "name": "LogStream", + "description": "Describes a stream to which TDLib internal log is written" + } + ], + "functions": [ + { + "name": "getAuthorizationState", + "description": "Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization", + "class": "AuthorizationState", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setTdlibParameters", + "description": "Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters", + "class": "Ok", + "properties": [ + { + "name": "parameters", + "type": "tdlibParameters", + "description": "Parameters" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "checkDatabaseEncryptionKey", + "description": "Checks the database encryption key for correctness. Works only when the current authorization state is authorizationStateWaitEncryptionKey", + "class": "Ok", + "properties": [ + { + "name": "encryption_key", + "type": "bytes", + "description": "Encryption key to check or set up" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setAuthenticationPhoneNumber", + "description": "Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword", + "class": "Ok", + "properties": [ + { + "name": "phone_number", + "type": "string", + "description": "The phone number of the user, in international format" + }, + { + "name": "settings", + "type": "phoneNumberAuthenticationSettings", + "description": "Settings for the authentication of the user's phone number" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "resendAuthenticationCode", + "description": "Re-sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode and the next_code_type of the result is not null", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "checkAuthenticationCode", + "description": "Checks the authentication code. Works only when the current authorization state is authorizationStateWaitCode", + "class": "Ok", + "properties": [ + { + "name": "code", + "type": "string", + "description": "The verification code received via SMS, Telegram message, phone call, or flash call" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "requestQrCodeAuthentication", + "description": "Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword", + "class": "Ok", + "properties": [ + { + "name": "other_user_ids", + "type": "vector\u003cint32\u003e", + "description": "List of user identifiers of other users currently using the application" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "registerUser", + "description": "Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration", + "class": "Ok", + "properties": [ + { + "name": "first_name", + "type": "string", + "description": "The first name of the user; 1-64 characters" + }, + { + "name": "last_name", + "type": "string", + "description": "The last name of the user; 0-64 characters" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "checkAuthenticationPassword", + "description": "Checks the authentication password for correctness. Works only when the current authorization state is authorizationStateWaitPassword", + "class": "Ok", + "properties": [ + { + "name": "password", + "type": "string", + "description": "The password to check" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "requestAuthenticationPasswordRecovery", + "description": "Requests to send a password recovery code to an email address that was previously set up. Works only when the current authorization state is authorizationStateWaitPassword", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "recoverAuthenticationPassword", + "description": "Recovers the password with a password recovery code sent to an email address that was previously set up. Works only when the current authorization state is authorizationStateWaitPassword", + "class": "Ok", + "properties": [ + { + "name": "recovery_code", + "type": "string", + "description": "Recovery code to check" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "checkAuthenticationBotToken", + "description": "Checks the authentication token of a bot; to log in as a bot. Works only when the current authorization state is authorizationStateWaitPhoneNumber. Can be used instead of setAuthenticationPhoneNumber and checkAuthenticationCode to log in", + "class": "Ok", + "properties": [ + { + "name": "token", + "type": "string", + "description": "The bot token" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "logOut", + "description": "Closes the TDLib instance after a proper logout. Requires an available network connection. All local data will be destroyed. After the logout completes, updateAuthorizationState with authorizationStateClosed will be sent", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "close", + "description": "Closes the TDLib instance. All databases will be flushed to disk and properly closed. After the close completes, updateAuthorizationState with authorizationStateClosed will be sent. Can be called before initialization", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "destroy", + "description": "Closes the TDLib instance, destroying all local data without a proper logout. The current user session will remain in the list of all active sessions. All local data will be destroyed. After the destruction completes updateAuthorizationState with authorizationStateClosed will be sent. Can be called before authorization", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "confirmQrCodeAuthentication", + "description": "Confirms QR code authentication on another device. Returns created session on success", + "class": "Session", + "properties": [ + { + "name": "link", + "type": "string", + "description": "A link from a QR code. The link must be scanned by the in-app camera" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getCurrentState", + "description": "Returns all updates needed to restore current TDLib state, i.e. all actual UpdateAuthorizationState/UpdateUser/UpdateNewChat and others. This is especially useful if TDLib is run in a separate process. Can be called before initialization", + "class": "Updates", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setDatabaseEncryptionKey", + "description": "Changes the database encryption key. Usually the encryption key is never changed and is stored in some OS keychain", + "class": "Ok", + "properties": [ + { + "name": "new_encryption_key", + "type": "bytes", + "description": "New encryption key" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getPasswordState", + "description": "Returns the current state of 2-step verification", + "class": "PasswordState", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setPassword", + "description": "Changes the password for the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed", + "class": "PasswordState", + "properties": [ + { + "name": "old_password", + "type": "string", + "description": "Previous password of the user" + }, + { + "name": "new_password", + "type": "string", + "description": "New password of the user; may be empty to remove the password" + }, + { + "name": "new_hint", + "type": "string", + "description": "New password hint; may be empty" + }, + { + "name": "set_recovery_email_address", + "type": "Bool", + "description": "Pass true if the recovery email address should be changed" + }, + { + "name": "new_recovery_email_address", + "type": "string", + "description": "New recovery email address; may be empty" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getRecoveryEmailAddress", + "description": "Returns a 2-step verification recovery email address that was previously set up. This method can be used to verify a password provided by the user", + "class": "RecoveryEmailAddress", + "properties": [ + { + "name": "password", + "type": "string", + "description": "The password for the current user" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setRecoveryEmailAddress", + "description": "Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed. If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation", + "class": "PasswordState", + "properties": [ + { + "name": "password", + "type": "string", + "description": "Password of the current user" + }, + { + "name": "new_recovery_email_address", + "type": "string", + "description": "New recovery email address" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "checkRecoveryEmailAddressCode", + "description": "Checks the 2-step verification recovery email address verification code", + "class": "PasswordState", + "properties": [ + { + "name": "code", + "type": "string", + "description": "Verification code" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "resendRecoveryEmailAddressCode", + "description": "Resends the 2-step verification recovery email address verification code", + "class": "PasswordState", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "requestPasswordRecovery", + "description": "Requests to send a password recovery code to an email address that was previously set up", + "class": "EmailAddressAuthenticationCodeInfo", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "recoverPassword", + "description": "Recovers the password using a recovery code sent to an email address that was previously set up", + "class": "PasswordState", + "properties": [ + { + "name": "recovery_code", + "type": "string", + "description": "Recovery code to check" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "createTemporaryPassword", + "description": "Creates a new temporary password for processing payments", + "class": "TemporaryPasswordState", + "properties": [ + { + "name": "password", + "type": "string", + "description": "Persistent user password" + }, + { + "name": "valid_for", + "type": "int32", + "description": "Time during which the temporary password will be valid, in seconds; should be between 60 and 86400" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getTemporaryPasswordState", + "description": "Returns information about the current temporary password", + "class": "TemporaryPasswordState", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getMe", + "description": "Returns the current user", + "class": "User", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getUser", + "description": "Returns information about a user by their identifier. This is an offline request if the current user is not a bot", + "class": "User", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getUserFullInfo", + "description": "Returns full information about a user by their identifier", + "class": "UserFullInfo", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getBasicGroup", + "description": "Returns information about a basic group by its identifier. This is an offline request if the current user is not a bot", + "class": "BasicGroup", + "properties": [ + { + "name": "basic_group_id", + "type": "int32", + "description": "Basic group identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getBasicGroupFullInfo", + "description": "Returns full information about a basic group by its identifier", + "class": "BasicGroupFullInfo", + "properties": [ + { + "name": "basic_group_id", + "type": "int32", + "description": "Basic group identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getSupergroup", + "description": "Returns information about a supergroup or a channel by its identifier. This is an offline request if the current user is not a bot", + "class": "Supergroup", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "Supergroup or channel identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getSupergroupFullInfo", + "description": "Returns full information about a supergroup or a channel by its identifier, cached for up to 1 minute", + "class": "SupergroupFullInfo", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "Supergroup or channel identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getSecretChat", + "description": "Returns information about a secret chat by its identifier. This is an offline request", + "class": "SecretChat", + "properties": [ + { + "name": "secret_chat_id", + "type": "int32", + "description": "Secret chat identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getChat", + "description": "Returns information about a chat by its identifier, this is an offline request if the current user is not a bot", + "class": "Chat", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getMessage", + "description": "Returns information about a message", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat the message belongs to" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message to get" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getMessageLocally", + "description": "Returns information about a message, if it is available locally without sending network request. This is an offline request", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat the message belongs to" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message to get" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getRepliedMessage", + "description": "Returns information about a message that is replied by a given message. Also returns the pinned message, the game message, and the invoice message for messages of the types messagePinMessage, messageGameScore, and messagePaymentSuccessful respectively", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat the message belongs to" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message reply to which to get" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getChatPinnedMessage", + "description": "Returns information about a newest pinned message in the chat", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat the message belongs to" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getCallbackQueryMessage", + "description": "Returns information about a message with the callback button that originated a callback query; for bots only", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat the message belongs to" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + }, + { + "name": "callback_query_id", + "type": "int64", + "description": "Identifier of the callback query" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "getMessages", + "description": "Returns information about messages. If a message is not found, returns null on the corresponding position of the result", + "class": "Messages", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat the messages belong to" + }, + { + "name": "message_ids", + "type": "vector\u003cint53\u003e", + "description": "Identifiers of the messages to get" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getMessageThread", + "description": "Returns information about a message thread. Can be used only if message.can_get_message_thread == true", + "class": "MessageThreadInfo", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getFile", + "description": "Returns information about a file; this is an offline request", + "class": "File", + "properties": [ + { + "name": "file_id", + "type": "int32", + "description": "Identifier of the file to get" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getRemoteFile", + "description": "Returns information about a file by its remote ID; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application", + "class": "File", + "properties": [ + { + "name": "remote_file_id", + "type": "string", + "description": "Remote identifier of the file to get" + }, + { + "name": "file_type", + "type": "FileType", + "description": "File type, if known" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getChats", + "description": "Returns an ordered list of chats in a chat list. Chats are sorted by the pair (chat.position.order, chat.id) in descending order. (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed 64-bit number 9223372036854775807 == 2^63 - 1). For optimal performance the number of returned chats is chosen by the library", + "class": "Chats", + "properties": [ + { + "name": "chat_list", + "type": "ChatList", + "description": "The chat list in which to return chats" + }, + { + "name": "offset_order", + "type": "int64", + "description": "Chat order to return chats from" + }, + { + "name": "offset_chat_id", + "type": "int53", + "description": "Chat identifier to return chats from" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of chats to be returned. It is possible that fewer chats than the limit are returned even if the end of the list is not reached" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchPublicChat", + "description": "Searches a public chat by its username. Currently only private chats, supergroups and channels can be public. Returns the chat if found; otherwise an error is returned", + "class": "Chat", + "properties": [ + { + "name": "username", + "type": "string", + "description": "Username to be resolved" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "searchPublicChats", + "description": "Searches public chats by looking for specified query in their username and title. Currently only private chats, supergroups and channels can be public. Returns a meaningful number of results. Returns nothing if the length of the searched username prefix is less than 5. Excludes private chats with contacts and chats from the chat list from the results", + "class": "Chats", + "properties": [ + { + "name": "query", + "type": "string", + "description": "Query to search for" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchChats", + "description": "Searches for the specified query in the title and username of already known chats, this is an offline request. Returns chats in the order seen in the main chat list", + "class": "Chats", + "properties": [ + { + "name": "query", + "type": "string", + "description": "Query to search for. If the query is empty, returns up to 20 recently found chats" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of chats to be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchChatsOnServer", + "description": "Searches for the specified query in the title and username of already known chats via request to the server. Returns chats in the order seen in the main chat list", + "class": "Chats", + "properties": [ + { + "name": "query", + "type": "string", + "description": "Query to search for" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of chats to be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchChatsNearby", + "description": "Returns a list of users and location-based supergroups nearby. The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby. The request should be sent again every 25 seconds with adjusted location to not miss new chats", + "class": "ChatsNearby", + "properties": [ + { + "name": "location", + "type": "location", + "description": "Current user location" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getTopChats", + "description": "Returns a list of frequently used chats. Supported only if the chat info database is enabled", + "class": "Chats", + "properties": [ + { + "name": "category", + "type": "TopChatCategory", + "description": "Category of chats to be returned" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of chats to be returned; up to 30" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeTopChat", + "description": "Removes a chat from the list of frequently used chats. Supported only if the chat info database is enabled", + "class": "Ok", + "properties": [ + { + "name": "category", + "type": "TopChatCategory", + "description": "Category of frequently used chats" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "addRecentlyFoundChat", + "description": "Adds a chat to the list of recently found chats. The chat is added to the beginning of the list. If the chat is already in the list, it will be removed from the list first", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to add" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeRecentlyFoundChat", + "description": "Removes a chat from the list of recently found chats", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to be removed" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "clearRecentlyFoundChats", + "description": "Clears the list of recently found chats", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "checkChatUsername", + "description": "Checks whether a username can be set for a chat", + "class": "CheckChatUsernameResult", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier; should be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if chat is being created" + }, + { + "name": "username", + "type": "string", + "description": "Username to be checked" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getCreatedPublicChats", + "description": "Returns a list of public chats of the specified type, owned by the user", + "class": "Chats", + "properties": [ + { + "name": "type", + "type": "PublicChatType", + "description": "Type of the public chats to return" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "checkCreatedPublicChatsLimit", + "description": "Checks whether the maximum number of owned public chats has been reached. Returns corresponding error if the limit was reached", + "class": "Ok", + "properties": [ + { + "name": "type", + "type": "PublicChatType", + "description": "Type of the public chats, for which to check the limit" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getSuitableDiscussionChats", + "description": "Returns a list of basic group and supergroup chats, which can be used as a discussion group for a channel. Returned basic group chats must be first upgraded to supergroups before they can be set as a discussion group. To set a returned supergroup as a discussion group, access to its old messages must be enabled using toggleSupergroupIsAllHistoryAvailable first", + "class": "Chats", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getInactiveSupergroupChats", + "description": "Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error", + "class": "Chats", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getGroupsInCommon", + "description": "Returns a list of common group chats with a given user. Chats are sorted by their type and creation date", + "class": "Chats", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "offset_chat_id", + "type": "int53", + "description": "Chat identifier starting from which to return chats; use 0 for the first request" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of chats to be returned; up to 100" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getChatHistory", + "description": "Returns messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library. This is an offline request if only_local is true", + "class": "Messages", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "from_message_id", + "type": "int53", + "description": "Identifier of the message starting from which history must be fetched; use 0 to get results from the last message" + }, + { + "name": "offset", + "type": "int32", + "description": "Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached" + }, + { + "name": "only_local", + "type": "Bool", + "description": "If true, returns only messages that are available locally without sending network requests" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getMessageThreadHistory", + "description": "Returns messages in a message thread of a message. Can be used only if message.can_get_message_thread == true. Message thread of a channel message is in the channel's linked supergroup. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library", + "class": "Messages", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier, which thread history needs to be returned" + }, + { + "name": "from_message_id", + "type": "int53", + "description": "Identifier of the message starting from which history must be fetched; use 0 to get results from the last message" + }, + { + "name": "offset", + "type": "int32", + "description": "Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. Fewer messages may be returned than specified by the limit, even if the end of the message thread history has not been reached" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "deleteChatHistory", + "description": "Deletes all messages in the chat. Use Chat.can_be_deleted_only_for_self and Chat.can_be_deleted_for_all_users fields to find whether and how the method can be applied to the chat", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "remove_from_chat_list", + "type": "Bool", + "description": "Pass true if the chat should be removed from the chat list" + }, + { + "name": "revoke", + "type": "Bool", + "description": "Pass true to try to delete chat history for all users" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchChatMessages", + "description": "Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages should be used instead), or without an enabled message database. For optimal performance the number of returned messages is chosen by the library", + "class": "Messages", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat in which to search messages" + }, + { + "name": "query", + "type": "string", + "description": "Query to search for" + }, + { + "name": "sender", + "type": "MessageSender", + "description": "If not null, only messages sent by the specified sender will be returned. Not supported in secret chats" + }, + { + "name": "from_message_id", + "type": "int53", + "description": "Identifier of the message starting from which history must be fetched; use 0 to get results from the last message" + }, + { + "name": "offset", + "type": "int32", + "description": "Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached" + }, + { + "name": "filter", + "type": "SearchMessagesFilter", + "description": "Filter for message content in the search results" + }, + { + "name": "message_thread_id", + "type": "int53", + "description": "If not 0, only messages in the specified thread will be returned; supergroups only" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchMessages", + "description": "Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). For optimal performance the number of returned messages is chosen by the library", + "class": "Messages", + "properties": [ + { + "name": "chat_list", + "type": "ChatList", + "description": "Chat list in which to search messages; pass null to search in all chats regardless of their chat list" + }, + { + "name": "query", + "type": "string", + "description": "Query to search for" + }, + { + "name": "offset_date", + "type": "int32", + "description": "The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the last message" + }, + { + "name": "offset_chat_id", + "type": "int53", + "description": "The chat identifier of the last found message, or 0 for the first request" + }, + { + "name": "offset_message_id", + "type": "int53", + "description": "The message identifier of the last found message, or 0 for the first request" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached" + }, + { + "name": "filter", + "type": "SearchMessagesFilter", + "description": "Filter for message content in the search results; searchMessagesFilterCall, searchMessagesFilterMissedCall, searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterFailedToSend and searchMessagesFilterPinned are unsupported in this function" + }, + { + "name": "min_date", + "type": "int32", + "description": "If not 0, the minimum date of the messages to return" + }, + { + "name": "max_date", + "type": "int32", + "description": "If not 0, the maximum date of the messages to return" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchSecretMessages", + "description": "Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance the number of returned messages is chosen by the library", + "class": "FoundMessages", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat in which to search. Specify 0 to search in all secret chats" + }, + { + "name": "query", + "type": "string", + "description": "Query to search for. If empty, searchChatMessages should be used instead" + }, + { + "name": "offset", + "type": "string", + "description": "Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached" + }, + { + "name": "filter", + "type": "SearchMessagesFilter", + "description": "A filter for message content in the search results" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchCallMessages", + "description": "Searches for call messages. Returns the results in reverse chronological order (i. e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library", + "class": "Messages", + "properties": [ + { + "name": "from_message_id", + "type": "int53", + "description": "Identifier of the message from which to search; use 0 to get results from the last message" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached" + }, + { + "name": "only_missed", + "type": "Bool", + "description": "If true, returns only messages with missed calls" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchChatRecentLocationMessages", + "description": "Returns information about the recent locations of chat members that were sent to the chat. Returns up to 1 location message per user", + "class": "Messages", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of messages to be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getActiveLiveLocationMessages", + "description": "Returns all active live locations that should be updated by the application. The list is persistent across application restarts only if the message database is used", + "class": "Messages", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getChatMessageByDate", + "description": "Returns the last message sent in a chat no later than the specified date", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "date", + "type": "int32", + "description": "Point in time (Unix timestamp) relative to which to search for messages" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getChatMessageCount", + "description": "Returns approximate number of messages of the specified type in the chat", + "class": "Count", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat in which to count messages" + }, + { + "name": "filter", + "type": "SearchMessagesFilter", + "description": "Filter for message content; searchMessagesFilterEmpty is unsupported in this function" + }, + { + "name": "return_local", + "type": "Bool", + "description": "If true, returns count that is available locally without sending network requests, returning -1 if the number of messages is unknown" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getChatScheduledMessages", + "description": "Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id)", + "class": "Messages", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getMessagePublicForwards", + "description": "Returns forwarded copies of a channel message to different public channels. For optimal performance the number of returned messages is chosen by the library", + "class": "FoundMessages", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier of the message" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + }, + { + "name": "offset", + "type": "string", + "description": "Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of messages to be returned; must be positive and can't be greater than 100. Fewer messages may be returned than specified by the limit, even if the end of the list has not been reached" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeNotification", + "description": "Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user", + "class": "Ok", + "properties": [ + { + "name": "notification_group_id", + "type": "int32", + "description": "Identifier of notification group to which the notification belongs" + }, + { + "name": "notification_id", + "type": "int32", + "description": "Identifier of removed notification" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeNotificationGroup", + "description": "Removes a group of active notifications. Needs to be called only if the notification group is removed by the current user", + "class": "Ok", + "properties": [ + { + "name": "notification_group_id", + "type": "int32", + "description": "Notification group identifier" + }, + { + "name": "max_notification_id", + "type": "int32", + "description": "The maximum identifier of removed notifications" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getMessageLink", + "description": "Returns an HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels. This is an offline request", + "class": "MessageLink", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to which the message belongs" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + }, + { + "name": "for_album", + "type": "Bool", + "description": "Pass true to create a link for the whole media album" + }, + { + "name": "for_comment", + "type": "Bool", + "description": "Pass true to create a link to the message as a channel post comment, or from a message thread" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getMessageEmbeddingCode", + "description": "Returns an HTML code for embedding the message. Available only for messages in supergroups and channels with a username", + "class": "Text", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to which the message belongs" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + }, + { + "name": "for_album", + "type": "Bool", + "description": "Pass true to return an HTML code for embedding of the whole media album" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getMessageLinkInfo", + "description": "Returns information about a public or private message link", + "class": "MessageLinkInfo", + "properties": [ + { + "name": "url", + "type": "string", + "description": "The message link in the format \"https://t.me/c/...\", or \"tg://privatepost?...\", or \"https://t.me/username/...\", or \"tg://resolve?...\"" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "sendMessage", + "description": "Sends a message. Returns the sent message", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Target chat" + }, + { + "name": "message_thread_id", + "type": "int53", + "description": "If not 0, a message thread identifier in which the message will be sent" + }, + { + "name": "reply_to_message_id", + "type": "int53", + "description": "Identifier of the message to reply to or 0" + }, + { + "name": "options", + "type": "messageSendOptions", + "description": "Options to be used to send the message" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "Markup for replying to the message; for bots only" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be sent" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "sendMessageAlbum", + "description": "Sends messages grouped together into an album. Currently only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages", + "class": "Messages", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Target chat" + }, + { + "name": "message_thread_id", + "type": "int53", + "description": "If not 0, a message thread identifier in which the messages will be sent" + }, + { + "name": "reply_to_message_id", + "type": "int53", + "description": "Identifier of a message to reply to or 0" + }, + { + "name": "options", + "type": "messageSendOptions", + "description": "Options to be used to send the messages" + }, + { + "name": "input_message_contents", + "type": "vector\u003cInputMessageContent\u003e", + "description": "Contents of messages to be sent" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "sendBotStartMessage", + "description": "Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message", + "class": "Message", + "properties": [ + { + "name": "bot_user_id", + "type": "int32", + "description": "Identifier of the bot" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the target chat" + }, + { + "name": "parameter", + "type": "string", + "description": "A hidden parameter sent to the bot for deep linking purposes (https://core.telegram.org/bots#deep-linking)" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "sendInlineQueryResultMessage", + "description": "Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Target chat" + }, + { + "name": "message_thread_id", + "type": "int53", + "description": "If not 0, a message thread identifier in which the message will be sent" + }, + { + "name": "reply_to_message_id", + "type": "int53", + "description": "Identifier of a message to reply to or 0" + }, + { + "name": "options", + "type": "messageSendOptions", + "description": "Options to be used to send the message" + }, + { + "name": "query_id", + "type": "int64", + "description": "Identifier of the inline query" + }, + { + "name": "result_id", + "type": "string", + "description": "Identifier of the inline result" + }, + { + "name": "hide_via_bot", + "type": "Bool", + "description": "If true, there will be no mention of a bot, via which the message is sent. Can be used only for bots GetOption(\"animation_search_bot_username\"), GetOption(\"photo_search_bot_username\") and GetOption(\"venue_search_bot_username\")" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "forwardMessages", + "description": "Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message", + "class": "Messages", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to which to forward messages" + }, + { + "name": "from_chat_id", + "type": "int53", + "description": "Identifier of the chat from which to forward messages" + }, + { + "name": "message_ids", + "type": "vector\u003cint53\u003e", + "description": "Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order" + }, + { + "name": "options", + "type": "messageSendOptions", + "description": "Options to be used to send the messages" + }, + { + "name": "send_copy", + "type": "Bool", + "description": "True, if content of the messages needs to be copied without links to the original messages. Always true if the messages are forwarded to a secret chat" + }, + { + "name": "remove_caption", + "type": "Bool", + "description": "True, if media caption of message copies needs to be removed. Ignored if send_copy is false" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "resendMessages", + "description": "Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message", + "class": "Messages", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to send messages" + }, + { + "name": "message_ids", + "type": "vector\u003cint53\u003e", + "description": "Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "sendChatSetTtlMessage", + "description": "Changes the current TTL setting (sets a new self-destruct timer) in a secret chat and sends the corresponding message", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "ttl", + "type": "int32", + "description": "New TTL value, in seconds" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "sendChatScreenshotTakenNotification", + "description": "Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "addLocalMessage", + "description": "Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Target chat" + }, + { + "name": "sender", + "type": "MessageSender", + "description": "The sender sender of the message" + }, + { + "name": "reply_to_message_id", + "type": "int53", + "description": "Identifier of the message to reply to or 0" + }, + { + "name": "disable_notification", + "type": "Bool", + "description": "Pass true to disable notification for the message" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be added" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "deleteMessages", + "description": "Deletes messages", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_ids", + "type": "vector\u003cint53\u003e", + "description": "Identifiers of the messages to be deleted" + }, + { + "name": "revoke", + "type": "Bool", + "description": "Pass true to try to delete messages for all chat members. Always true for supergroups, channels and secret chats" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "deleteChatMessagesFromUser", + "description": "Deletes all messages sent by the specified user to a chat. Supported only for supergroups; requires can_delete_messages administrator privileges", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "editMessageText", + "description": "Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "The chat the message belongs to" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup; for bots only" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "New text content of the message. Should be of type InputMessageText" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "editMessageLiveLocation", + "description": "Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "The chat the message belongs to" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup; for bots only" + }, + { + "name": "location", + "type": "location", + "description": "New location content of the message; may be null. Pass null to stop sharing the live location" + }, + { + "name": "heading", + "type": "int32", + "description": "The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown" + }, + { + "name": "proximity_alert_radius", + "type": "int32", + "description": "The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "editMessageMedia", + "description": "Edits the content of a message with an animation, an audio, a document, a photo or a video. The media in the message can't be replaced if the message was set to self-destruct. Media can't be replaced by self-destructing media. Media in an album can be edited only to contain a photo or a video. Returns the edited message after the edit is completed on the server side", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "The chat the message belongs to" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup; for bots only" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "editMessageCaption", + "description": "Edits the message content caption. Returns the edited message after the edit is completed on the server side", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "The chat the message belongs to" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup; for bots only" + }, + { + "name": "caption", + "type": "formattedText", + "description": "New message content caption; 0-GetOption(\"message_caption_length_max\") characters" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "editMessageReplyMarkup", + "description": "Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "The chat the message belongs to" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "editInlineMessageText", + "description": "Edits the text of an inline text or game message sent via a bot; for bots only", + "class": "Ok", + "properties": [ + { + "name": "inline_message_id", + "type": "string", + "description": "Inline message identifier" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "New text content of the message. Should be of type InputMessageText" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "editInlineMessageLiveLocation", + "description": "Edits the content of a live location in an inline message sent via a bot; for bots only", + "class": "Ok", + "properties": [ + { + "name": "inline_message_id", + "type": "string", + "description": "Inline message identifier" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup" + }, + { + "name": "location", + "type": "location", + "description": "New location content of the message; may be null. Pass null to stop sharing the live location" + }, + { + "name": "heading", + "type": "int32", + "description": "The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown" + }, + { + "name": "proximity_alert_radius", + "type": "int32", + "description": "The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "editInlineMessageMedia", + "description": "Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only", + "class": "Ok", + "properties": [ + { + "name": "inline_message_id", + "type": "string", + "description": "Inline message identifier" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup; for bots only" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "editInlineMessageCaption", + "description": "Edits the caption of an inline message sent via a bot; for bots only", + "class": "Ok", + "properties": [ + { + "name": "inline_message_id", + "type": "string", + "description": "Inline message identifier" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup" + }, + { + "name": "caption", + "type": "formattedText", + "description": "New message content caption; 0-GetOption(\"message_caption_length_max\") characters" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "editInlineMessageReplyMarkup", + "description": "Edits the reply markup of an inline message sent via a bot; for bots only", + "class": "Ok", + "properties": [ + { + "name": "inline_message_id", + "type": "string", + "description": "Inline message identifier" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "editMessageSchedulingState", + "description": "Edits the time when a scheduled message will be sent. Scheduling state of all messages in the same album or forwarded together with the message will be also changed", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "The chat the message belongs to" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + }, + { + "name": "scheduling_state", + "type": "MessageSchedulingState", + "description": "The new message scheduling state. Pass null to send the message immediately" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getTextEntities", + "description": "Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) contained in the text. Can be called synchronously", + "class": "TextEntities", + "properties": [ + { + "name": "text", + "type": "string", + "description": "The text in which to look for entites" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "parseTextEntities", + "description": "Parses Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities contained in the text. Can be called synchronously", + "class": "FormattedText", + "properties": [ + { + "name": "text", + "type": "string", + "description": "The text to parse" + }, + { + "name": "parse_mode", + "type": "TextParseMode", + "description": "Text parse mode" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "parseMarkdown", + "description": "Parses Markdown entities in a human-friendly format, ignoring markup errors. Can be called synchronously", + "class": "FormattedText", + "properties": [ + { + "name": "text", + "type": "formattedText", + "description": "The text to parse. For example, \"__italic__ ~~strikethrough~~ **bold** `code` ```pre``` __[italic__ text_url](telegram.org) __italic**bold italic__bold**\"" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getMarkdownText", + "description": "Replaces text entities with Markdown formatting in a human-friendly format. Entities that can't be represented in Markdown unambiguously are kept as is. Can be called synchronously", + "class": "FormattedText", + "properties": [ + { + "name": "text", + "type": "formattedText", + "description": "The text" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getFileMimeType", + "description": "Returns the MIME type of a file, guessed by its extension. Returns an empty string on failure. Can be called synchronously", + "class": "Text", + "properties": [ + { + "name": "file_name", + "type": "string", + "description": "The name of the file or path to the file" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getFileExtension", + "description": "Returns the extension of a file, guessed by its MIME type. Returns an empty string on failure. Can be called synchronously", + "class": "Text", + "properties": [ + { + "name": "mime_type", + "type": "string", + "description": "The MIME type of the file" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "cleanFileName", + "description": "Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously", + "class": "Text", + "properties": [ + { + "name": "file_name", + "type": "string", + "description": "File name or path to the file" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getLanguagePackString", + "description": "Returns a string stored in the local database from the specified localization target and language pack by its key. Returns a 404 error if the string is not found. Can be called synchronously", + "class": "LanguagePackStringValue", + "properties": [ + { + "name": "language_pack_database_path", + "type": "string", + "description": "Path to the language pack database in which strings are stored" + }, + { + "name": "localization_target", + "type": "string", + "description": "Localization target to which the language pack belongs" + }, + { + "name": "language_pack_id", + "type": "string", + "description": "Language pack identifier" + }, + { + "name": "key", + "type": "string", + "description": "Language pack key of the string to be returned" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getJsonValue", + "description": "Converts a JSON-serialized string to corresponding JsonValue object. Can be called synchronously", + "class": "JsonValue", + "properties": [ + { + "name": "json", + "type": "string", + "description": "The JSON-serialized string" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getJsonString", + "description": "Converts a JsonValue object to corresponding JSON-serialized string. Can be called synchronously", + "class": "Text", + "properties": [ + { + "name": "json_value", + "type": "JsonValue", + "description": "The JsonValue object" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "setPollAnswer", + "description": "Changes the user answer to a poll. A poll in quiz mode can be answered only once", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to which the poll belongs" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message containing the poll" + }, + { + "name": "option_ids", + "type": "vector\u003cint32\u003e", + "description": "0-based identifiers of answer options, chosen by the user. User can choose more than 1 answer option only is the poll allows multiple answers" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getPollVoters", + "description": "Returns users voted for the specified option in a non-anonymous polls. For the optimal performance the number of returned users is chosen by the library", + "class": "Users", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to which the poll belongs" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message containing the poll" + }, + { + "name": "option_id", + "type": "int32", + "description": "0-based identifier of the answer option" + }, + { + "name": "offset", + "type": "int32", + "description": "Number of users to skip in the result; must be non-negative" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of users to be returned; must be positive and can't be greater than 50. Fewer users may be returned than specified by the limit, even if the end of the voter list has not been reached" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "stopPoll", + "description": "Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to which the poll belongs" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message containing the poll" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup; for bots only" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "hideSuggestedAction", + "description": "Hides a suggested action", + "class": "Ok", + "properties": [ + { + "name": "action", + "type": "SuggestedAction", + "description": "Suggested action to hide" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getLoginUrlInfo", + "description": "Returns information about a button of type inlineKeyboardButtonTypeLoginUrl. The method needs to be called when the user presses the button", + "class": "LoginUrlInfo", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier of the message with the button" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier of the message with the button" + }, + { + "name": "button_id", + "type": "int32", + "description": "Button identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getLoginUrl", + "description": "Returns an HTTP URL which can be used to automatically authorize the user on a website after clicking an inline button of type inlineKeyboardButtonTypeLoginUrl. Use the method getLoginUrlInfo to find whether a prior user confirmation is needed. If an error is returned, then the button must be handled as an ordinary URL button", + "class": "HttpUrl", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier of the message with the button" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier of the message with the button" + }, + { + "name": "button_id", + "type": "int32", + "description": "Button identifier" + }, + { + "name": "allow_write_access", + "type": "Bool", + "description": "True, if the user allowed the bot to send them messages" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getInlineQueryResults", + "description": "Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires", + "class": "InlineQueryResults", + "properties": [ + { + "name": "bot_user_id", + "type": "int32", + "description": "The identifier of the target bot" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat where the query was sent" + }, + { + "name": "user_location", + "type": "location", + "description": "Location of the user, only if needed" + }, + { + "name": "query", + "type": "string", + "description": "Text of the query" + }, + { + "name": "offset", + "type": "string", + "description": "Offset of the first entry to return" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "answerInlineQuery", + "description": "Sets the result of an inline query; for bots only", + "class": "Ok", + "properties": [ + { + "name": "inline_query_id", + "type": "int64", + "description": "Identifier of the inline query" + }, + { + "name": "is_personal", + "type": "Bool", + "description": "True, if the result of the query can be cached for the specified user" + }, + { + "name": "results", + "type": "vector\u003cInputInlineQueryResult\u003e", + "description": "The results of the query" + }, + { + "name": "cache_time", + "type": "int32", + "description": "Allowed time to cache the results of the query, in seconds" + }, + { + "name": "next_offset", + "type": "string", + "description": "Offset for the next inline query; pass an empty string if there are no more results" + }, + { + "name": "switch_pm_text", + "type": "string", + "description": "If non-empty, this text should be shown on the button that opens a private chat with the bot and sends a start message to the bot with the parameter switch_pm_parameter" + }, + { + "name": "switch_pm_parameter", + "type": "string", + "description": "The parameter for the bot start message" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "getCallbackQueryAnswer", + "description": "Sends a callback query to a bot and returns an answer. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires", + "class": "CallbackQueryAnswer", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat with the message" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message from which the query originated" + }, + { + "name": "payload", + "type": "CallbackQueryPayload", + "description": "Query payload" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "answerCallbackQuery", + "description": "Sets the result of a callback query; for bots only", + "class": "Ok", + "properties": [ + { + "name": "callback_query_id", + "type": "int64", + "description": "Identifier of the callback query" + }, + { + "name": "text", + "type": "string", + "description": "Text of the answer" + }, + { + "name": "show_alert", + "type": "Bool", + "description": "If true, an alert should be shown to the user instead of a toast notification" + }, + { + "name": "url", + "type": "string", + "description": "URL to be opened" + }, + { + "name": "cache_time", + "type": "int32", + "description": "Time during which the result of the query can be cached, in seconds" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "answerShippingQuery", + "description": "Sets the result of a shipping query; for bots only", + "class": "Ok", + "properties": [ + { + "name": "shipping_query_id", + "type": "int64", + "description": "Identifier of the shipping query" + }, + { + "name": "shipping_options", + "type": "vector\u003cshippingOption\u003e", + "description": "Available shipping options" + }, + { + "name": "error_message", + "type": "string", + "description": "An error message, empty on success" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "answerPreCheckoutQuery", + "description": "Sets the result of a pre-checkout query; for bots only", + "class": "Ok", + "properties": [ + { + "name": "pre_checkout_query_id", + "type": "int64", + "description": "Identifier of the pre-checkout query" + }, + { + "name": "error_message", + "type": "string", + "description": "An error message, empty on success" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "setGameScore", + "description": "Updates the game score of the specified user in the game; for bots only", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "The chat to which the message with the game belongs" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + }, + { + "name": "edit_message", + "type": "Bool", + "description": "True, if the message should be edited" + }, + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "score", + "type": "int32", + "description": "The new score" + }, + { + "name": "force", + "type": "Bool", + "description": "Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "setInlineGameScore", + "description": "Updates the game score of the specified user in a game; for bots only", + "class": "Ok", + "properties": [ + { + "name": "inline_message_id", + "type": "string", + "description": "Inline message identifier" + }, + { + "name": "edit_message", + "type": "Bool", + "description": "True, if the message should be edited" + }, + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "score", + "type": "int32", + "description": "The new score" + }, + { + "name": "force", + "type": "Bool", + "description": "Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "getGameHighScores", + "description": "Returns the high scores for a game and some part of the high score table in the range of the specified user; for bots only", + "class": "GameHighScores", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "The chat that contains the message with the game" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + }, + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "getInlineGameHighScores", + "description": "Returns game high scores and some part of the high score table in the range of the specified user; for bots only", + "class": "GameHighScores", + "properties": [ + { + "name": "inline_message_id", + "type": "string", + "description": "Inline message identifier" + }, + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "deleteChatReplyMarkup", + "description": "Deletes the default reply markup from a chat. Must be called after a one-time keyboard or a ForceReply reply markup has been used. UpdateChatReplyMarkup will be sent if the reply markup will be changed", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_id", + "type": "int53", + "description": "The message identifier of the used keyboard" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "sendChatAction", + "description": "Sends a notification about user activity in a chat", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_thread_id", + "type": "int53", + "description": "If not 0, a message thread identifier in which the action was performed" + }, + { + "name": "action", + "type": "ChatAction", + "description": "The action description" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "openChat", + "description": "Informs TDLib that the chat is opened by the user. Many useful activities depend on the chat being opened or closed (e.g., in supergroups and channels all updates are received only for opened chats)", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "closeChat", + "description": "Informs TDLib that the chat is closed by the user. Many useful activities depend on the chat being opened or closed", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "viewMessages", + "description": "Informs TDLib that messages are being viewed by the user. Many useful activities depend on whether the messages are currently being viewed or not (e.g., marking messages as read, incrementing a view counter, updating a view counter, removing deleted messages in supergroups and channels)", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_thread_id", + "type": "int53", + "description": "If not 0, a message thread identifier in which the messages are being viewed" + }, + { + "name": "message_ids", + "type": "vector\u003cint53\u003e", + "description": "The identifiers of the messages being viewed" + }, + { + "name": "force_read", + "type": "Bool", + "description": "True, if messages in closed chats should be marked as read by the request" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "openMessageContent", + "description": "Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). An updateMessageContentOpened update will be generated if something has changed", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier of the message" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message with the opened content" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "readAllChatMentions", + "description": "Marks all mentions in a chat as read", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "createPrivateChat", + "description": "Returns an existing chat corresponding to a given user", + "class": "Chat", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "force", + "type": "Bool", + "description": "If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "createBasicGroupChat", + "description": "Returns an existing chat corresponding to a known basic group", + "class": "Chat", + "properties": [ + { + "name": "basic_group_id", + "type": "int32", + "description": "Basic group identifier" + }, + { + "name": "force", + "type": "Bool", + "description": "If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "createSupergroupChat", + "description": "Returns an existing chat corresponding to a known supergroup or channel", + "class": "Chat", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "Supergroup or channel identifier" + }, + { + "name": "force", + "type": "Bool", + "description": "If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "createSecretChat", + "description": "Returns an existing chat corresponding to a known secret chat", + "class": "Chat", + "properties": [ + { + "name": "secret_chat_id", + "type": "int32", + "description": "Secret chat identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "createNewBasicGroupChat", + "description": "Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat", + "class": "Chat", + "properties": [ + { + "name": "user_ids", + "type": "vector\u003cint32\u003e", + "description": "Identifiers of users to be added to the basic group" + }, + { + "name": "title", + "type": "string", + "description": "Title of the new basic group; 1-128 characters" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "createNewSupergroupChat", + "description": "Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat", + "class": "Chat", + "properties": [ + { + "name": "title", + "type": "string", + "description": "Title of the new chat; 1-128 characters" + }, + { + "name": "is_channel", + "type": "Bool", + "description": "True, if a channel chat should be created" + }, + { + "name": "description", + "type": "string", + "description": "Chat description; 0-255 characters" + }, + { + "name": "location", + "type": "chatLocation", + "description": "Chat location if a location-based supergroup is being created" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "createNewSecretChat", + "description": "Creates a new secret chat. Returns the newly created chat", + "class": "Chat", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Identifier of the target user" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "upgradeBasicGroupChatToSupergroupChat", + "description": "Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires creator privileges. Deactivates the original basic group", + "class": "Chat", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to upgrade" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getChatListsToAddChat", + "description": "Returns chat lists to which the chat can be added. This is an offline request", + "class": "ChatLists", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "addChatToList", + "description": "Adds a chat to a chat list. A chat can't be simultaneously in Main and Archive chat lists, so it is automatically removed from another one if needed", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "chat_list", + "type": "ChatList", + "description": "The chat list. Use getChatListsToAddChat to get suitable chat lists" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getChatFilter", + "description": "Returns information about a chat filter by its identifier", + "class": "ChatFilter", + "properties": [ + { + "name": "chat_filter_id", + "type": "int32", + "description": "Chat filter identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "createChatFilter", + "description": "Creates new chat filter. Returns information about the created chat filter", + "class": "ChatFilterInfo", + "properties": [ + { + "name": "filter", + "type": "chatFilter", + "description": "Chat filter" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "editChatFilter", + "description": "Edits existing chat filter. Returns information about the edited chat filter", + "class": "ChatFilterInfo", + "properties": [ + { + "name": "chat_filter_id", + "type": "int32", + "description": "Chat filter identifier" + }, + { + "name": "filter", + "type": "chatFilter", + "description": "The edited chat filter" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "deleteChatFilter", + "description": "Deletes existing chat filter", + "class": "Ok", + "properties": [ + { + "name": "chat_filter_id", + "type": "int32", + "description": "Chat filter identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "reorderChatFilters", + "description": "Changes the order of chat filters", + "class": "Ok", + "properties": [ + { + "name": "chat_filter_ids", + "type": "vector\u003cint32\u003e", + "description": "Identifiers of chat filters in the new correct order" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getRecommendedChatFilters", + "description": "Returns recommended chat filters for the current user", + "class": "RecommendedChatFilters", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getChatFilterDefaultIconName", + "description": "Returns default icon name for a filter. Can be called synchronously", + "class": "Text", + "properties": [ + { + "name": "filter", + "type": "chatFilter", + "description": "Chat filter" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "setChatTitle", + "description": "Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info rights", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "title", + "type": "string", + "description": "New title of the chat; 1-128 characters" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setChatPhoto", + "description": "Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info rights", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "photo", + "type": "InputChatPhoto", + "description": "New chat photo. Pass null to delete the chat photo" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setChatPermissions", + "description": "Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "permissions", + "type": "chatPermissions", + "description": "New non-administrator members permissions in the chat" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setChatDraftMessage", + "description": "Changes the draft message in a chat", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_thread_id", + "type": "int53", + "description": "If not 0, a message thread identifier in which the draft was changed" + }, + { + "name": "draft_message", + "type": "draftMessage", + "description": "New draft message; may be null" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setChatNotificationSettings", + "description": "Changes the notification settings of a chat. Notification settings of a chat with the current user (Saved Messages) can't be changed", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "notification_settings", + "type": "chatNotificationSettings", + "description": "New notification settings for the chat. If the chat is muted for more than 1 week, it is considered to be muted forever" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "toggleChatIsMarkedAsUnread", + "description": "Changes the marked as unread state of a chat", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "is_marked_as_unread", + "type": "Bool", + "description": "New value of is_marked_as_unread" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "toggleChatDefaultDisableNotification", + "description": "Changes the value of the default disable_notification parameter, used when a message is sent to a chat", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "default_disable_notification", + "type": "Bool", + "description": "New value of default_disable_notification" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setChatClientData", + "description": "Changes application-specific data associated with a chat", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "client_data", + "type": "string", + "description": "New value of client_data" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setChatDescription", + "description": "Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info rights", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat" + }, + { + "name": "description", + "type": "string", + "description": "New chat description; 0-255 characters" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setChatDiscussionGroup", + "description": "Changes the discussion group of a channel chat; requires can_change_info rights in the channel if it is specified", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages rights in the supergroup)" + }, + { + "name": "discussion_chat_id", + "type": "int53", + "description": "Identifier of a new channel's discussion group. Use 0 to remove the discussion group. Use the method getSuitableDiscussionChats to find all suitable groups. Basic group chats must be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setChatLocation", + "description": "Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "location", + "type": "chatLocation", + "description": "New location for the chat; must be valid and not null" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setChatSlowModeDelay", + "description": "Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members rights", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "slow_mode_delay", + "type": "int32", + "description": "New slow mode delay for the chat; must be one of 0, 10, 30, 60, 300, 900, 3600" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "pinChatMessage", + "description": "Pins a message in a chat; requires can_pin_messages rights or can_edit_messages rights in the channel", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the new pinned message" + }, + { + "name": "disable_notification", + "type": "Bool", + "description": "True, if there should be no notification about the pinned message. Notifications are always disabled in channels and private chats" + }, + { + "name": "only_for_self", + "type": "Bool", + "description": "True, if the message needs to be pinned for one side only; private chats only" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "unpinChatMessage", + "description": "Removes a pinned message from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the removed pinned message" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "unpinAllChatMessages", + "description": "Removes all pinned messages from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "joinChat", + "description": "Adds current user as a new member to a chat. Private and secret chats can't be joined using this method", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "leaveChat", + "description": "Removes current user from chat members. Private and secret chats can't be left using this method", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "addChatMember", + "description": "Adds a new member to a chat. Members can't be added to private or secret chats. Members will not be added until the chat state has been synchronized with the server", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "user_id", + "type": "int32", + "description": "Identifier of the user" + }, + { + "name": "forward_limit", + "type": "int32", + "description": "The number of earlier messages from the chat to be forwarded to the new member; up to 100. Ignored for supergroups and channels" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "addChatMembers", + "description": "Adds multiple new members to a chat. Currently this option is only available for supergroups and channels. This option can't be used to join a chat. Members can't be added to a channel if it has more than 200 members. Members will not be added until the chat state has been synchronized with the server", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "user_ids", + "type": "vector\u003cint32\u003e", + "description": "Identifiers of the users to be added to the chat" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setChatMemberStatus", + "description": "Changes the status of a chat member, needs appropriate privileges. This function is currently not suitable for adding new members to the chat and transferring chat ownership; instead, use addChatMember or transferChatOwnership. The chat member status will not be changed until it has been synchronized with the server", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "status", + "type": "ChatMemberStatus", + "description": "The new status of the member in the chat" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "canTransferOwnership", + "description": "Checks whether the current session can be used to transfer a chat ownership to another user", + "class": "CanTransferOwnershipResult", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "transferChatOwnership", + "description": "Changes the owner of a chat. The current user must be a current owner of the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "user_id", + "type": "int32", + "description": "Identifier of the user to which transfer the ownership. The ownership can't be transferred to a bot or to a deleted user" + }, + { + "name": "password", + "type": "string", + "description": "The password of the current user" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getChatMember", + "description": "Returns information about a single member of a chat", + "class": "ChatMember", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "searchChatMembers", + "description": "Searches for a specified query in the first name, last name and username of the members of a specified chat. Requires administrator rights in channels", + "class": "ChatMembers", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "query", + "type": "string", + "description": "Query to search for" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of users to be returned" + }, + { + "name": "filter", + "type": "ChatMembersFilter", + "description": "The type of users to return. By default, chatMembersFilterMembers" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getChatAdministrators", + "description": "Returns a list of administrators of the chat with their custom titles", + "class": "ChatAdministrators", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "clearAllDraftMessages", + "description": "Clears draft messages in all chats", + "class": "Ok", + "properties": [ + { + "name": "exclude_secret_chats", + "type": "Bool", + "description": "If true, local draft messages in secret chats will not be cleared" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getChatNotificationSettingsExceptions", + "description": "Returns list of chats with non-default notification settings", + "class": "Chats", + "properties": [ + { + "name": "scope", + "type": "NotificationSettingsScope", + "description": "If specified, only chats from the specified scope will be returned" + }, + { + "name": "compare_sound", + "type": "Bool", + "description": "If true, also chats with non-default sound will be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getScopeNotificationSettings", + "description": "Returns the notification settings for chats of a given type", + "class": "ScopeNotificationSettings", + "properties": [ + { + "name": "scope", + "type": "NotificationSettingsScope", + "description": "Types of chats for which to return the notification settings information" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setScopeNotificationSettings", + "description": "Changes notification settings for chats of a given type", + "class": "Ok", + "properties": [ + { + "name": "scope", + "type": "NotificationSettingsScope", + "description": "Types of chats for which to change the notification settings" + }, + { + "name": "notification_settings", + "type": "scopeNotificationSettings", + "description": "The new notification settings for the given scope" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "resetAllNotificationSettings", + "description": "Resets all notification settings to their default values. By default, all chats are unmuted, the sound is set to \"default\" and message previews are shown", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "toggleChatIsPinned", + "description": "Changes the pinned state of a chat. There can be up to GetOption(\"pinned_chat_count_max\")/GetOption(\"pinned_archived_chat_count_max\") pinned non-secret chats and the same number of secret chats in the main/arhive chat list", + "class": "Ok", + "properties": [ + { + "name": "chat_list", + "type": "ChatList", + "description": "Chat list in which to change the pinned state of the chat" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the chat is pinned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setPinnedChats", + "description": "Changes the order of pinned chats", + "class": "Ok", + "properties": [ + { + "name": "chat_list", + "type": "ChatList", + "description": "Chat list in which to change the order of pinned chats" + }, + { + "name": "chat_ids", + "type": "vector\u003cint53\u003e", + "description": "The new list of pinned chats" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "downloadFile", + "description": "Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates", + "class": "File", + "properties": [ + { + "name": "file_id", + "type": "int32", + "description": "Identifier of the file to download" + }, + { + "name": "priority", + "type": "int32", + "description": "Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded first" + }, + { + "name": "offset", + "type": "int32", + "description": "The starting position from which the file should be downloaded" + }, + { + "name": "limit", + "type": "int32", + "description": "Number of bytes which should be downloaded starting from the \"offset\" position before the download will be automatically cancelled; use 0 to download without a limit" + }, + { + "name": "synchronous", + "type": "Bool", + "description": "If false, this request returns file state just after the download has been started. If true, this request returns file state only after the download has succeeded, has failed, has been cancelled or a new downloadFile request with different offset/limit parameters was sent" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getFileDownloadedPrefixSize", + "description": "Returns file downloaded prefix size from a given offset", + "class": "Count", + "properties": [ + { + "name": "file_id", + "type": "int32", + "description": "Identifier of the file" + }, + { + "name": "offset", + "type": "int32", + "description": "Offset from which downloaded prefix size should be calculated" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "cancelDownloadFile", + "description": "Stops the downloading of a file. If a file has already been downloaded, does nothing", + "class": "Ok", + "properties": [ + { + "name": "file_id", + "type": "int32", + "description": "Identifier of a file to stop downloading" + }, + { + "name": "only_if_pending", + "type": "Bool", + "description": "Pass true to stop downloading only if it hasn't been started, i.e. request hasn't been sent to server" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "uploadFile", + "description": "Asynchronously uploads a file to the cloud without sending it in a message. updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message", + "class": "File", + "properties": [ + { + "name": "file", + "type": "InputFile", + "description": "File to upload" + }, + { + "name": "file_type", + "type": "FileType", + "description": "File type" + }, + { + "name": "priority", + "type": "int32", + "description": "Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which uploadFile was called will be uploaded first" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "cancelUploadFile", + "description": "Stops the uploading of a file. Supported only for files uploaded by using uploadFile. For other files the behavior is undefined", + "class": "Ok", + "properties": [ + { + "name": "file_id", + "type": "int32", + "description": "Identifier of the file to stop uploading" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "writeGeneratedFilePart", + "description": "Writes a part of a generated file. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct write to the destination file", + "class": "Ok", + "properties": [ + { + "name": "generation_id", + "type": "int64", + "description": "The identifier of the generation process" + }, + { + "name": "offset", + "type": "int32", + "description": "The offset from which to write the data to the file" + }, + { + "name": "data", + "type": "bytes", + "description": "The data to write" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setFileGenerationProgress", + "description": "Informs TDLib on a file generation progress", + "class": "Ok", + "properties": [ + { + "name": "generation_id", + "type": "int64", + "description": "The identifier of the generation process" + }, + { + "name": "expected_size", + "type": "int32", + "description": "Expected size of the generated file, in bytes; 0 if unknown" + }, + { + "name": "local_prefix_size", + "type": "int32", + "description": "The number of bytes already generated" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "finishFileGeneration", + "description": "Finishes the file generation", + "class": "Ok", + "properties": [ + { + "name": "generation_id", + "type": "int64", + "description": "The identifier of the generation process" + }, + { + "name": "error", + "type": "error", + "description": "If set, means that file generation has failed and should be terminated" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "readFilePart", + "description": "Reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct read from the file", + "class": "FilePart", + "properties": [ + { + "name": "file_id", + "type": "int32", + "description": "Identifier of the file. The file must be located in the TDLib file cache" + }, + { + "name": "offset", + "type": "int32", + "description": "The offset from which to read the file" + }, + { + "name": "count", + "type": "int32", + "description": "Number of bytes to read. An error will be returned if there are not enough bytes available in the file from the specified position. Pass 0 to read all available data from the specified position" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "deleteFile", + "description": "Deletes a file from the TDLib file cache", + "class": "Ok", + "properties": [ + { + "name": "file_id", + "type": "int32", + "description": "Identifier of the file to delete" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "generateChatInviteLink", + "description": "Generates a new invite link for a chat; the previously generated link is revoked. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right", + "class": "ChatInviteLink", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "checkChatInviteLink", + "description": "Checks the validity of an invite link for a chat and returns information about the corresponding chat", + "class": "ChatInviteLinkInfo", + "properties": [ + { + "name": "invite_link", + "type": "string", + "description": "Invite link to be checked; should begin with \"https://t.me/joinchat/\", \"https://telegram.me/joinchat/\", or \"https://telegram.dog/joinchat/\"" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "joinChatByInviteLink", + "description": "Uses an invite link to add the current user to the chat if possible. The new member will not be added until the chat state has been synchronized with the server", + "class": "Chat", + "properties": [ + { + "name": "invite_link", + "type": "string", + "description": "Invite link to import; should begin with \"https://t.me/joinchat/\", \"https://telegram.me/joinchat/\", or \"https://telegram.dog/joinchat/\"" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "createCall", + "description": "Creates a new call", + "class": "CallId", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Identifier of the user to be called" + }, + { + "name": "protocol", + "type": "callProtocol", + "description": "Description of the call protocols supported by the application" + }, + { + "name": "is_video", + "type": "Bool", + "description": "True, if a video call needs to be created" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "acceptCall", + "description": "Accepts an incoming call", + "class": "Ok", + "properties": [ + { + "name": "call_id", + "type": "int32", + "description": "Call identifier" + }, + { + "name": "protocol", + "type": "callProtocol", + "description": "Description of the call protocols supported by the application" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "sendCallSignalingData", + "description": "Sends call signaling data", + "class": "Ok", + "properties": [ + { + "name": "call_id", + "type": "int32", + "description": "Call identifier" + }, + { + "name": "data", + "type": "bytes", + "description": "The data" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "discardCall", + "description": "Discards a call", + "class": "Ok", + "properties": [ + { + "name": "call_id", + "type": "int32", + "description": "Call identifier" + }, + { + "name": "is_disconnected", + "type": "Bool", + "description": "True, if the user was disconnected" + }, + { + "name": "duration", + "type": "int32", + "description": "The call duration, in seconds" + }, + { + "name": "is_video", + "type": "Bool", + "description": "True, if the call was a video call" + }, + { + "name": "connection_id", + "type": "int64", + "description": "Identifier of the connection used during the call" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "sendCallRating", + "description": "Sends a call rating", + "class": "Ok", + "properties": [ + { + "name": "call_id", + "type": "int32", + "description": "Call identifier" + }, + { + "name": "rating", + "type": "int32", + "description": "Call rating; 1-5" + }, + { + "name": "comment", + "type": "string", + "description": "An optional user comment if the rating is less than 5" + }, + { + "name": "problems", + "type": "vector\u003cCallProblem\u003e", + "description": "List of the exact types of problems with the call, specified by the user" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "sendCallDebugInformation", + "description": "Sends debug information for a call", + "class": "Ok", + "properties": [ + { + "name": "call_id", + "type": "int32", + "description": "Call identifier" + }, + { + "name": "debug_information", + "type": "string", + "description": "Debug information in application-specific format" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "toggleMessageSenderIsBlocked", + "description": "Changes the block state of a message sender. Currently, only users and supergroup chats can be blocked", + "class": "Ok", + "properties": [ + { + "name": "sender", + "type": "MessageSender", + "description": "Message Sender" + }, + { + "name": "is_blocked", + "type": "Bool", + "description": "New value of is_blocked" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "blockMessageSenderFromReplies", + "description": "Blocks an original sender of a message in the Replies chat", + "class": "Ok", + "properties": [ + { + "name": "message_id", + "type": "int53", + "description": "The identifier of an incoming message in the Replies chat" + }, + { + "name": "delete_message", + "type": "Bool", + "description": "Pass true if the message must be deleted" + }, + { + "name": "delete_all_messages", + "type": "Bool", + "description": "Pass true if all messages from the same sender must be deleted" + }, + { + "name": "report_spam", + "type": "Bool", + "description": "Pass true if the sender must be reported to the Telegram moderators" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getBlockedMessageSenders", + "description": "Returns users and chats that were blocked by the current user", + "class": "MessageSenders", + "properties": [ + { + "name": "offset", + "type": "int32", + "description": "Number of users and chats to skip in the result; must be non-negative" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of users and chats to return; up to 100" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "addContact", + "description": "Adds a user to the contact list or edits an existing contact by their user identifier", + "class": "Ok", + "properties": [ + { + "name": "contact", + "type": "contact", + "description": "The contact to add or edit; phone number can be empty and needs to be specified only if known, vCard is ignored" + }, + { + "name": "share_phone_number", + "type": "Bool", + "description": "True, if the new contact needs to be allowed to see current user's phone number. A corresponding rule to userPrivacySettingShowPhoneNumber will be added if needed. Use the field UserFullInfo.need_phone_number_privacy_exception to check whether the current user needs to be asked to share their phone number" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "importContacts", + "description": "Adds new contacts or edits existing contacts by their phone numbers; contacts' user identifiers are ignored", + "class": "ImportedContacts", + "properties": [ + { + "name": "contacts", + "type": "vector\u003ccontact\u003e", + "description": "The list of contacts to import or edit; contacts' vCard are ignored and are not imported" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getContacts", + "description": "Returns all user contacts", + "class": "Users", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchContacts", + "description": "Searches for the specified query in the first names, last names and usernames of the known user contacts", + "class": "Users", + "properties": [ + { + "name": "query", + "type": "string", + "description": "Query to search for; may be empty to return all contacts" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of users to be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeContacts", + "description": "Removes users from the contact list", + "class": "Ok", + "properties": [ + { + "name": "user_ids", + "type": "vector\u003cint32\u003e", + "description": "Identifiers of users to be deleted" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getImportedContactCount", + "description": "Returns the total number of imported contacts", + "class": "Count", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "changeImportedContacts", + "description": "Changes imported contacts using the list of current user contacts saved on the device. Imports newly added contacts and, if at least the file database is enabled, deletes recently deleted contacts. Query result depends on the result of the previous query, so only one query is possible at the same time", + "class": "ImportedContacts", + "properties": [ + { + "name": "contacts", + "type": "vector\u003ccontact\u003e", + "description": "The new list of contacts, contact's vCard are ignored and are not imported" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "clearImportedContacts", + "description": "Clears all imported contacts, contact list remains unchanged", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "sharePhoneNumber", + "description": "Shares the phone number of the current user with a mutual contact. Supposed to be called when the user clicks on chatActionBarSharePhoneNumber", + "class": "Ok", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Identifier of the user with whom to share the phone number. The user must be a mutual contact" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getUserProfilePhotos", + "description": "Returns the profile photos of a user. The result of this query may be outdated: some photos might have been deleted already", + "class": "ChatPhotos", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "offset", + "type": "int32", + "description": "The number of photos to skip; must be non-negative" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of photos to be returned; up to 100" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getStickers", + "description": "Returns stickers from the installed sticker sets that correspond to a given emoji. If the emoji is not empty, favorite and recently used stickers may also be returned", + "class": "Stickers", + "properties": [ + { + "name": "emoji", + "type": "string", + "description": "String representation of emoji. If empty, returns all known installed stickers" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of stickers to be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchStickers", + "description": "Searches for stickers from public sticker sets that correspond to a given emoji", + "class": "Stickers", + "properties": [ + { + "name": "emoji", + "type": "string", + "description": "String representation of emoji; must be non-empty" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of stickers to be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getInstalledStickerSets", + "description": "Returns a list of installed sticker sets", + "class": "StickerSets", + "properties": [ + { + "name": "is_masks", + "type": "Bool", + "description": "Pass true to return mask sticker sets; pass false to return ordinary sticker sets" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getArchivedStickerSets", + "description": "Returns a list of archived sticker sets", + "class": "StickerSets", + "properties": [ + { + "name": "is_masks", + "type": "Bool", + "description": "Pass true to return mask stickers sets; pass false to return ordinary sticker sets" + }, + { + "name": "offset_sticker_set_id", + "type": "int64", + "description": "Identifier of the sticker set from which to return the result" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of sticker sets to return" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getTrendingStickerSets", + "description": "Returns a list of trending sticker sets. For the optimal performance the number of returned sticker sets is chosen by the library", + "class": "StickerSets", + "properties": [ + { + "name": "offset", + "type": "int32", + "description": "The offset from which to return the sticker sets; must be non-negative" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of sticker sets to be returned; must be non-negative. Fewer sticker sets may be returned than specified by the limit, even if the end of the list has not been reached" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getAttachedStickerSets", + "description": "Returns a list of sticker sets attached to a file. Currently only photos and videos can have attached sticker sets", + "class": "StickerSets", + "properties": [ + { + "name": "file_id", + "type": "int32", + "description": "File identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getStickerSet", + "description": "Returns information about a sticker set by its identifier", + "class": "StickerSet", + "properties": [ + { + "name": "set_id", + "type": "int64", + "description": "Identifier of the sticker set" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "searchStickerSet", + "description": "Searches for a sticker set by its name", + "class": "StickerSet", + "properties": [ + { + "name": "name", + "type": "string", + "description": "Name of the sticker set" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "searchInstalledStickerSets", + "description": "Searches for installed sticker sets by looking for specified query in their title and name", + "class": "StickerSets", + "properties": [ + { + "name": "is_masks", + "type": "Bool", + "description": "Pass true to return mask sticker sets; pass false to return ordinary sticker sets" + }, + { + "name": "query", + "type": "string", + "description": "Query to search for" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of sticker sets to return" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "searchStickerSets", + "description": "Searches for ordinary sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results", + "class": "StickerSets", + "properties": [ + { + "name": "query", + "type": "string", + "description": "Query to search for" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "changeStickerSet", + "description": "Installs/uninstalls or activates/archives a sticker set", + "class": "Ok", + "properties": [ + { + "name": "set_id", + "type": "int64", + "description": "Identifier of the sticker set" + }, + { + "name": "is_installed", + "type": "Bool", + "description": "The new value of is_installed" + }, + { + "name": "is_archived", + "type": "Bool", + "description": "The new value of is_archived. A sticker set can't be installed and archived simultaneously" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "viewTrendingStickerSets", + "description": "Informs the server that some trending sticker sets have been viewed by the user", + "class": "Ok", + "properties": [ + { + "name": "sticker_set_ids", + "type": "vector\u003cint64\u003e", + "description": "Identifiers of viewed trending sticker sets" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "reorderInstalledStickerSets", + "description": "Changes the order of installed sticker sets", + "class": "Ok", + "properties": [ + { + "name": "is_masks", + "type": "Bool", + "description": "Pass true to change the order of mask sticker sets; pass false to change the order of ordinary sticker sets" + }, + { + "name": "sticker_set_ids", + "type": "vector\u003cint64\u003e", + "description": "Identifiers of installed sticker sets in the new correct order" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getRecentStickers", + "description": "Returns a list of recently used stickers", + "class": "Stickers", + "properties": [ + { + "name": "is_attached", + "type": "Bool", + "description": "Pass true to return stickers and masks that were recently attached to photos or video files; pass false to return recently sent stickers" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "addRecentSticker", + "description": "Manually adds a new sticker to the list of recently used stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list", + "class": "Stickers", + "properties": [ + { + "name": "is_attached", + "type": "Bool", + "description": "Pass true to add the sticker to the list of stickers recently attached to photo or video files; pass false to add the sticker to the list of recently sent stickers" + }, + { + "name": "sticker", + "type": "InputFile", + "description": "Sticker file to add" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeRecentSticker", + "description": "Removes a sticker from the list of recently used stickers", + "class": "Ok", + "properties": [ + { + "name": "is_attached", + "type": "Bool", + "description": "Pass true to remove the sticker from the list of stickers recently attached to photo or video files; pass false to remove the sticker from the list of recently sent stickers" + }, + { + "name": "sticker", + "type": "InputFile", + "description": "Sticker file to delete" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "clearRecentStickers", + "description": "Clears the list of recently used stickers", + "class": "Ok", + "properties": [ + { + "name": "is_attached", + "type": "Bool", + "description": "Pass true to clear the list of stickers recently attached to photo or video files; pass false to clear the list of recently sent stickers" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getFavoriteStickers", + "description": "Returns favorite stickers", + "class": "Stickers", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "addFavoriteSticker", + "description": "Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list", + "class": "Ok", + "properties": [ + { + "name": "sticker", + "type": "InputFile", + "description": "Sticker file to add" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeFavoriteSticker", + "description": "Removes a sticker from the list of favorite stickers", + "class": "Ok", + "properties": [ + { + "name": "sticker", + "type": "InputFile", + "description": "Sticker file to delete from the list" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getStickerEmojis", + "description": "Returns emoji corresponding to a sticker. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object", + "class": "Emojis", + "properties": [ + { + "name": "sticker", + "type": "InputFile", + "description": "Sticker file identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchEmojis", + "description": "Searches for emojis by keywords. Supported only if the file database is enabled", + "class": "Emojis", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Text to search for" + }, + { + "name": "exact_match", + "type": "Bool", + "description": "True, if only emojis, which exactly match text needs to be returned" + }, + { + "name": "input_language_codes", + "type": "vector\u003cstring\u003e", + "description": "List of possible IETF language tags of the user's input language; may be empty if unknown" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getEmojiSuggestionsUrl", + "description": "Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation", + "class": "HttpUrl", + "properties": [ + { + "name": "language_code", + "type": "string", + "description": "Language code for which the emoji replacements will be suggested" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getSavedAnimations", + "description": "Returns saved animations", + "class": "Animations", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "addSavedAnimation", + "description": "Manually adds a new animation to the list of saved animations. The new animation is added to the beginning of the list. If the animation was already in the list, it is removed first. Only non-secret video animations with MIME type \"video/mp4\" can be added to the list", + "class": "Ok", + "properties": [ + { + "name": "animation", + "type": "InputFile", + "description": "The animation file to be added. Only animations known to the server (i.e. successfully sent via a message) can be added to the list" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeSavedAnimation", + "description": "Removes an animation from the list of saved animations", + "class": "Ok", + "properties": [ + { + "name": "animation", + "type": "InputFile", + "description": "Animation file to be removed" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getRecentInlineBots", + "description": "Returns up to 20 recently used inline bots in the order of their last usage", + "class": "Users", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchHashtags", + "description": "Searches for recently used hashtags by their prefix", + "class": "Hashtags", + "properties": [ + { + "name": "prefix", + "type": "string", + "description": "Hashtag prefix to search for" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of hashtags to be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeRecentHashtag", + "description": "Removes a hashtag from the list of recently used hashtags", + "class": "Ok", + "properties": [ + { + "name": "hashtag", + "type": "string", + "description": "Hashtag to delete" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getWebPagePreview", + "description": "Returns a web page preview by the text of the message. Do not call this function too often. Returns a 404 error if the web page has no preview", + "class": "WebPage", + "properties": [ + { + "name": "text", + "type": "formattedText", + "description": "Message text with formatting" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getWebPageInstantView", + "description": "Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page", + "class": "WebPageInstantView", + "properties": [ + { + "name": "url", + "type": "string", + "description": "The web page URL" + }, + { + "name": "force_full", + "type": "Bool", + "description": "If true, the full instant view for the web page will be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setProfilePhoto", + "description": "Changes a profile photo for the current user", + "class": "Ok", + "properties": [ + { + "name": "photo", + "type": "InputChatPhoto", + "description": "Profile photo to set" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "deleteProfilePhoto", + "description": "Deletes a profile photo", + "class": "Ok", + "properties": [ + { + "name": "profile_photo_id", + "type": "int64", + "description": "Identifier of the profile photo to delete" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setName", + "description": "Changes the first and last name of the current user", + "class": "Ok", + "properties": [ + { + "name": "first_name", + "type": "string", + "description": "The new value of the first name for the user; 1-64 characters" + }, + { + "name": "last_name", + "type": "string", + "description": "The new value of the optional last name for the user; 0-64 characters" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setBio", + "description": "Changes the bio of the current user", + "class": "Ok", + "properties": [ + { + "name": "bio", + "type": "string", + "description": "The new value of the user bio; 0-70 characters without line feeds" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setUsername", + "description": "Changes the username of the current user", + "class": "Ok", + "properties": [ + { + "name": "username", + "type": "string", + "description": "The new value of the username. Use an empty string to remove the username" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setLocation", + "description": "Changes the location of the current user. Needs to be called if GetOption(\"is_location_visible\") is true and location changes for more than 1 kilometer", + "class": "Ok", + "properties": [ + { + "name": "location", + "type": "location", + "description": "The new location of the user" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "changePhoneNumber", + "description": "Changes the phone number of the user and sends an authentication code to the user's new phone number. On success, returns information about the sent code", + "class": "AuthenticationCodeInfo", + "properties": [ + { + "name": "phone_number", + "type": "string", + "description": "The new phone number of the user in international format" + }, + { + "name": "settings", + "type": "phoneNumberAuthenticationSettings", + "description": "Settings for the authentication of the user's phone number" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "resendChangePhoneNumberCode", + "description": "Re-sends the authentication code sent to confirm a new phone number for the user. Works only if the previously received authenticationCodeInfo next_code_type was not null", + "class": "AuthenticationCodeInfo", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "checkChangePhoneNumberCode", + "description": "Checks the authentication code sent to confirm a new phone number of the user", + "class": "Ok", + "properties": [ + { + "name": "code", + "type": "string", + "description": "Verification code received by SMS, phone call or flash call" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setCommands", + "description": "Sets the list of commands supported by the bot; for bots only", + "class": "Ok", + "properties": [ + { + "name": "commands", + "type": "vector\u003cbotCommand\u003e", + "description": "List of the bot's commands" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "getActiveSessions", + "description": "Returns all active sessions of the current user", + "class": "Sessions", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "terminateSession", + "description": "Terminates a session of the current user", + "class": "Ok", + "properties": [ + { + "name": "session_id", + "type": "int64", + "description": "Session identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "terminateAllOtherSessions", + "description": "Terminates all other sessions of the current user", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getConnectedWebsites", + "description": "Returns all website where the current user used Telegram to log in", + "class": "ConnectedWebsites", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "disconnectWebsite", + "description": "Disconnects website from the current user's Telegram account", + "class": "Ok", + "properties": [ + { + "name": "website_id", + "type": "int64", + "description": "Website identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "disconnectAllWebsites", + "description": "Disconnects all websites from the current user's Telegram account", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setSupergroupUsername", + "description": "Changes the username of a supergroup or channel, requires owner privileges in the supergroup or channel", + "class": "Ok", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "Identifier of the supergroup or channel" + }, + { + "name": "username", + "type": "string", + "description": "New value of the username. Use an empty string to remove the username" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setSupergroupStickerSet", + "description": "Changes the sticker set of a supergroup; requires can_change_info rights", + "class": "Ok", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "Identifier of the supergroup" + }, + { + "name": "sticker_set_id", + "type": "int64", + "description": "New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "toggleSupergroupSignMessages", + "description": "Toggles sender signatures messages sent in a channel; requires can_change_info rights", + "class": "Ok", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "Identifier of the channel" + }, + { + "name": "sign_messages", + "type": "Bool", + "description": "New value of sign_messages" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "toggleSupergroupIsAllHistoryAvailable", + "description": "Toggles whether the message history of a supergroup is available to new members; requires can_change_info rights", + "class": "Ok", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "The identifier of the supergroup" + }, + { + "name": "is_all_history_available", + "type": "Bool", + "description": "The new value of is_all_history_available" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "reportSupergroupSpam", + "description": "Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup", + "class": "Ok", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "Supergroup identifier" + }, + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "message_ids", + "type": "vector\u003cint53\u003e", + "description": "Identifiers of messages sent in the supergroup by the user. This list must be non-empty" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getSupergroupMembers", + "description": "Returns information about members or banned users in a supergroup or channel. Can be used only if SupergroupFullInfo.can_get_members == true; additionally, administrator privileges may be required for some filters", + "class": "ChatMembers", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "Identifier of the supergroup or channel" + }, + { + "name": "filter", + "type": "SupergroupMembersFilter", + "description": "The type of users to return. By default, supergroupMembersFilterRecent" + }, + { + "name": "offset", + "type": "int32", + "description": "Number of users to skip" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of users be returned; up to 200" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "deleteSupergroup", + "description": "Deletes a supergroup or channel along with all messages in the corresponding chat. This will release the supergroup or channel username and remove all members; requires owner privileges in the supergroup or channel. Chats with more than 1000 members can't be deleted using this method", + "class": "Ok", + "properties": [ + { + "name": "supergroup_id", + "type": "int32", + "description": "Identifier of the supergroup or channel" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "closeSecretChat", + "description": "Closes a secret chat, effectively transferring its state to secretChatStateClosed", + "class": "Ok", + "properties": [ + { + "name": "secret_chat_id", + "type": "int32", + "description": "Secret chat identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getChatEventLog", + "description": "Returns a list of service actions taken by chat members and administrators in the last 48 hours. Available only for supergroups and channels. Requires administrator rights. Returns results in reverse chronological order (i. e., in order of decreasing event_id)", + "class": "ChatEvents", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "query", + "type": "string", + "description": "Search query by which to filter events" + }, + { + "name": "from_event_id", + "type": "int64", + "description": "Identifier of an event from which to return results. Use 0 to get results from the latest events" + }, + { + "name": "limit", + "type": "int32", + "description": "The maximum number of events to return; up to 100" + }, + { + "name": "filters", + "type": "chatEventLogFilters", + "description": "The types of events to return. By default, all types will be returned" + }, + { + "name": "user_ids", + "type": "vector\u003cint32\u003e", + "description": "User identifiers by which to filter events. By default, events relating to all users will be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getPaymentForm", + "description": "Returns an invoice payment form. This method should be called when the user presses inlineKeyboardButtonBuy", + "class": "PaymentForm", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier of the Invoice message" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "validateOrderInfo", + "description": "Validates the order information provided by a user and returns the available shipping options for a flexible invoice", + "class": "ValidatedOrderInfo", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier of the Invoice message" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + }, + { + "name": "order_info", + "type": "orderInfo", + "description": "The order information, provided by the user" + }, + { + "name": "allow_save", + "type": "Bool", + "description": "True, if the order information can be saved" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "sendPaymentForm", + "description": "Sends a filled-out payment form to the bot for final verification", + "class": "PaymentResult", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier of the Invoice message" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + }, + { + "name": "order_info_id", + "type": "string", + "description": "Identifier returned by ValidateOrderInfo, or an empty string" + }, + { + "name": "shipping_option_id", + "type": "string", + "description": "Identifier of a chosen shipping option, if applicable" + }, + { + "name": "credentials", + "type": "InputCredentials", + "description": "The credentials chosen by user for payment" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getPaymentReceipt", + "description": "Returns information about a successful payment", + "class": "PaymentReceipt", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier of the PaymentSuccessful message" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getSavedOrderInfo", + "description": "Returns saved order info, if any", + "class": "OrderInfo", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "deleteSavedOrderInfo", + "description": "Deletes saved order info", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "deleteSavedCredentials", + "description": "Deletes saved credentials for all payment provider bots", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getSupportUser", + "description": "Returns a user that can be contacted to get support", + "class": "User", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getBackgrounds", + "description": "Returns backgrounds installed by the user", + "class": "Backgrounds", + "properties": [ + { + "name": "for_dark_theme", + "type": "Bool", + "description": "True, if the backgrounds must be ordered for dark theme" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getBackgroundUrl", + "description": "Constructs a persistent HTTP URL for a background", + "class": "HttpUrl", + "properties": [ + { + "name": "name", + "type": "string", + "description": "Background name" + }, + { + "name": "type", + "type": "BackgroundType", + "description": "Background type" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "searchBackground", + "description": "Searches for a background by its name", + "class": "Background", + "properties": [ + { + "name": "name", + "type": "string", + "description": "The name of the background" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setBackground", + "description": "Changes the background selected by the user; adds background to the list of installed backgrounds", + "class": "Background", + "properties": [ + { + "name": "background", + "type": "InputBackground", + "description": "The input background to use, null for filled backgrounds" + }, + { + "name": "type", + "type": "BackgroundType", + "description": "Background type; null for default background. The method will return error 404 if type is null" + }, + { + "name": "for_dark_theme", + "type": "Bool", + "description": "True, if the background is chosen for dark theme" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeBackground", + "description": "Removes background from the list of installed backgrounds", + "class": "Ok", + "properties": [ + { + "name": "background_id", + "type": "int64", + "description": "The background identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "resetBackgrounds", + "description": "Resets list of installed backgrounds to its default value", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getLocalizationTargetInfo", + "description": "Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization", + "class": "LocalizationTargetInfo", + "properties": [ + { + "name": "only_local", + "type": "Bool", + "description": "If true, returns only locally available information without sending network requests" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getLanguagePackInfo", + "description": "Returns information about a language pack. Returned language pack identifier may be different from a provided one. Can be called before authorization", + "class": "LanguagePackInfo", + "properties": [ + { + "name": "language_pack_id", + "type": "string", + "description": "Language pack identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getLanguagePackStrings", + "description": "Returns strings from a language pack in the current localization target by their keys. Can be called before authorization", + "class": "LanguagePackStrings", + "properties": [ + { + "name": "language_pack_id", + "type": "string", + "description": "Language pack identifier of the strings to be returned" + }, + { + "name": "keys", + "type": "vector\u003cstring\u003e", + "description": "Language pack keys of the strings to be returned; leave empty to request all available strings" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "synchronizeLanguagePack", + "description": "Fetches the latest versions of all strings from a language pack in the current localization target from the server. This method shouldn't be called explicitly for the current used/base language packs. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "language_pack_id", + "type": "string", + "description": "Language pack identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "addCustomServerLanguagePack", + "description": "Adds a custom server language pack to the list of installed language packs in current localization target. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "language_pack_id", + "type": "string", + "description": "Identifier of a language pack to be added; may be different from a name that is used in an \"https://t.me/setlanguage/\" link" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setCustomLanguagePack", + "description": "Adds or changes a custom local language pack to the current localization target", + "class": "Ok", + "properties": [ + { + "name": "info", + "type": "languagePackInfo", + "description": "Information about the language pack. Language pack ID must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization" + }, + { + "name": "strings", + "type": "vector\u003clanguagePackString\u003e", + "description": "Strings of the new language pack" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "editCustomLanguagePackInfo", + "description": "Edits information about a custom local language pack in the current localization target. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "info", + "type": "languagePackInfo", + "description": "New information about the custom local language pack" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setCustomLanguagePackString", + "description": "Adds, edits or deletes a string in a custom local language pack. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "language_pack_id", + "type": "string", + "description": "Identifier of a previously added custom local language pack in the current localization target" + }, + { + "name": "new_string", + "type": "languagePackString", + "description": "New language pack string" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "deleteLanguagePack", + "description": "Deletes all information about a language pack in the current localization target. The language pack which is currently in use (including base language pack) or is being synchronized can't be deleted. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "language_pack_id", + "type": "string", + "description": "Identifier of the language pack to delete" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "registerDevice", + "description": "Registers the currently used device for receiving push notifications. Returns a globally unique identifier of the push notification subscription", + "class": "PushReceiverId", + "properties": [ + { + "name": "device_token", + "type": "DeviceToken", + "description": "Device token" + }, + { + "name": "other_user_ids", + "type": "vector\u003cint32\u003e", + "description": "List of user identifiers of other users currently using the application" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "processPushNotification", + "description": "Handles a push notification. Returns error with code 406 if the push notification is not supported and connection to the server is required to fetch new data. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "payload", + "type": "string", + "description": "JSON-encoded push notification payload with all fields sent by the server, and \"google.sent_time\" and \"google.notification.sound\" fields added" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getPushReceiverId", + "description": "Returns a globally unique push notification subscription identifier for identification of an account, which has received a push notification. Can be called synchronously", + "class": "PushReceiverId", + "properties": [ + { + "name": "payload", + "type": "string", + "description": "JSON-encoded push notification payload" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getRecentlyVisitedTMeUrls", + "description": "Returns t.me URLs recently visited by a newly registered user", + "class": "TMeUrls", + "properties": [ + { + "name": "referrer", + "type": "string", + "description": "Google Play referrer to identify the user" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setUserPrivacySettingRules", + "description": "Changes user privacy settings", + "class": "Ok", + "properties": [ + { + "name": "setting", + "type": "UserPrivacySetting", + "description": "The privacy setting" + }, + { + "name": "rules", + "type": "userPrivacySettingRules", + "description": "The new privacy rules" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getUserPrivacySettingRules", + "description": "Returns the current privacy settings", + "class": "UserPrivacySettingRules", + "properties": [ + { + "name": "setting", + "type": "UserPrivacySetting", + "description": "The privacy setting" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getOption", + "description": "Returns the value of an option by its name. (Check the list of available options on https://core.telegram.org/tdlib/options.) Can be called before authorization", + "class": "OptionValue", + "properties": [ + { + "name": "name", + "type": "string", + "description": "The name of the option" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setOption", + "description": "Sets the value of an option. (Check the list of available options on https://core.telegram.org/tdlib/options.) Only writable options can be set. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "name", + "type": "string", + "description": "The name of the option" + }, + { + "name": "value", + "type": "OptionValue", + "description": "The new value of the option" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setAccountTtl", + "description": "Changes the period of inactivity after which the account of the current user will automatically be deleted", + "class": "Ok", + "properties": [ + { + "name": "ttl", + "type": "accountTtl", + "description": "New account TTL" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getAccountTtl", + "description": "Returns the period of inactivity after which the account of the current user will automatically be deleted", + "class": "AccountTtl", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "deleteAccount", + "description": "Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account. Can be called before authorization when the current authorization state is authorizationStateWaitPassword", + "class": "Ok", + "properties": [ + { + "name": "reason", + "type": "string", + "description": "The reason why the account was deleted; optional" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeChatActionBar", + "description": "Removes a chat action bar without any other action", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "reportChat", + "description": "Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if this is a private chats with a bot, a private chat with a user sharing their location, a supergroup, or a channel, since other chats can't be checked by moderators", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "reason", + "type": "ChatReportReason", + "description": "The reason for reporting the chat" + }, + { + "name": "message_ids", + "type": "vector\u003cint53\u003e", + "description": "Identifiers of reported messages, if any" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getChatStatisticsUrl", + "description": "Returns an HTTP URL with the chat statistics. Currently this method of getting the statistics are disabled and can be deleted in the future", + "class": "HttpUrl", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "parameters", + "type": "string", + "description": "Parameters from \"tg://statsrefresh?params=******\" link" + }, + { + "name": "is_dark", + "type": "Bool", + "description": "Pass true if a URL with the dark theme must be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getChatStatistics", + "description": "Returns detailed statistics about a chat. Currently this method can be used only for supergroups and channels. Can be used only if SupergroupFullInfo.can_get_statistics == true", + "class": "ChatStatistics", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "is_dark", + "type": "Bool", + "description": "Pass true if a dark theme is used by the application" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getMessageStatistics", + "description": "Returns detailed statistics about a message. Can be used only if Message.can_get_statistics == true", + "class": "MessageStatistics", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier" + }, + { + "name": "is_dark", + "type": "Bool", + "description": "Pass true if a dark theme is used by the application" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getStatisticalGraph", + "description": "Loads an asynchronous or a zoomed in statistical graph", + "class": "StatisticalGraph", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "token", + "type": "string", + "description": "The token for graph loading" + }, + { + "name": "x", + "type": "int53", + "description": "X-value for zoomed in graph or 0 otherwise" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getStorageStatistics", + "description": "Returns storage usage statistics. Can be called before authorization", + "class": "StorageStatistics", + "properties": [ + { + "name": "chat_limit", + "type": "int32", + "description": "The maximum number of chats with the largest storage usage for which separate statistics should be returned. All other chats will be grouped in entries with chat_id == 0. If the chat info database is not used, the chat_limit is ignored and is always set to 0" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getStorageStatisticsFast", + "description": "Quickly returns approximate storage usage statistics. Can be called before authorization", + "class": "StorageStatisticsFast", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getDatabaseStatistics", + "description": "Returns database statistics", + "class": "DatabaseStatistics", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "optimizeStorage", + "description": "Optimizes storage usage, i.e. deletes some files and returns new storage usage statistics. Secret thumbnails can't be deleted", + "class": "StorageStatistics", + "properties": [ + { + "name": "size", + "type": "int53", + "description": "Limit on the total size of files after deletion. Pass -1 to use the default limit" + }, + { + "name": "ttl", + "type": "int32", + "description": "Limit on the time that has passed since the last time a file was accessed (or creation time for some filesystems). Pass -1 to use the default limit" + }, + { + "name": "count", + "type": "int32", + "description": "Limit on the total count of files after deletion. Pass -1 to use the default limit" + }, + { + "name": "immunity_delay", + "type": "int32", + "description": "The amount of time after the creation of a file during which it can't be deleted, in seconds. Pass -1 to use the default value" + }, + { + "name": "file_types", + "type": "vector\u003cFileType\u003e", + "description": "If not empty, only files with the given type(s) are considered. By default, all types except thumbnails, profile photos, stickers and wallpapers are deleted" + }, + { + "name": "chat_ids", + "type": "vector\u003cint53\u003e", + "description": "If not empty, only files from the given chats are considered. Use 0 as chat identifier to delete files not belonging to any chat (e.g., profile photos)" + }, + { + "name": "exclude_chat_ids", + "type": "vector\u003cint53\u003e", + "description": "If not empty, files from the given chats are excluded. Use 0 as chat identifier to exclude all files not belonging to any chat (e.g., profile photos)" + }, + { + "name": "return_deleted_file_statistics", + "type": "Bool", + "description": "Pass true if statistics about the files that were deleted must be returned instead of the whole storage usage statistics. Affects only returned statistics" + }, + { + "name": "chat_limit", + "type": "int32", + "description": "Same as in getStorageStatistics. Affects only returned statistics" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setNetworkType", + "description": "Sets the current network type. Can be called before authorization. Calling this method forces all network connections to reopen, mitigating the delay in switching between different networks, so it should be called whenever the network is changed, even if the network type remains the same. Network type is used to check whether the library can use the network at all and also for collecting detailed network data usage statistics", + "class": "Ok", + "properties": [ + { + "name": "type", + "type": "NetworkType", + "description": "The new network type. By default, networkTypeOther" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getNetworkStatistics", + "description": "Returns network data usage statistics. Can be called before authorization", + "class": "NetworkStatistics", + "properties": [ + { + "name": "only_current", + "type": "Bool", + "description": "If true, returns only data for the current library launch" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "addNetworkStatistics", + "description": "Adds the specified data to data usage statistics. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "entry", + "type": "NetworkStatisticsEntry", + "description": "The network statistics entry with the data to be added to statistics" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "resetNetworkStatistics", + "description": "Resets all network data usage statistics to zero. Can be called before authorization", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getAutoDownloadSettingsPresets", + "description": "Returns auto-download settings presets for the current user", + "class": "AutoDownloadSettingsPresets", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setAutoDownloadSettings", + "description": "Sets auto-download settings", + "class": "Ok", + "properties": [ + { + "name": "settings", + "type": "autoDownloadSettings", + "description": "New user auto-download settings" + }, + { + "name": "type", + "type": "NetworkType", + "description": "Type of the network for which the new settings are applied" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getBankCardInfo", + "description": "Returns information about a bank card", + "class": "BankCardInfo", + "properties": [ + { + "name": "bank_card_number", + "type": "string", + "description": "The bank card number" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getPassportElement", + "description": "Returns one of the available Telegram Passport elements", + "class": "PassportElement", + "properties": [ + { + "name": "type", + "type": "PassportElementType", + "description": "Telegram Passport element type" + }, + { + "name": "password", + "type": "string", + "description": "Password of the current user" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getAllPassportElements", + "description": "Returns all available Telegram Passport elements", + "class": "PassportElements", + "properties": [ + { + "name": "password", + "type": "string", + "description": "Password of the current user" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setPassportElement", + "description": "Adds an element to the user's Telegram Passport. May return an error with a message \"PHONE_VERIFICATION_NEEDED\" or \"EMAIL_VERIFICATION_NEEDED\" if the chosen phone number or the chosen email address must be verified first", + "class": "PassportElement", + "properties": [ + { + "name": "element", + "type": "InputPassportElement", + "description": "Input Telegram Passport element" + }, + { + "name": "password", + "type": "string", + "description": "Password of the current user" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "deletePassportElement", + "description": "Deletes a Telegram Passport element", + "class": "Ok", + "properties": [ + { + "name": "type", + "type": "PassportElementType", + "description": "Element type" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setPassportElementErrors", + "description": "Informs the user that some of the elements in their Telegram Passport contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed", + "class": "Ok", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "errors", + "type": "vector\u003cinputPassportElementError\u003e", + "description": "The errors" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "getPreferredCountryLanguage", + "description": "Returns an IETF language tag of the language preferred in the country, which should be used to fill native fields in Telegram Passport personal details. Returns a 404 error if unknown", + "class": "Text", + "properties": [ + { + "name": "country_code", + "type": "string", + "description": "A two-letter ISO 3166-1 alpha-2 country code" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "sendPhoneNumberVerificationCode", + "description": "Sends a code to verify a phone number to be added to a user's Telegram Passport", + "class": "AuthenticationCodeInfo", + "properties": [ + { + "name": "phone_number", + "type": "string", + "description": "The phone number of the user, in international format" + }, + { + "name": "settings", + "type": "phoneNumberAuthenticationSettings", + "description": "Settings for the authentication of the user's phone number" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "resendPhoneNumberVerificationCode", + "description": "Re-sends the code to verify a phone number to be added to a user's Telegram Passport", + "class": "AuthenticationCodeInfo", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "checkPhoneNumberVerificationCode", + "description": "Checks the phone number verification code for Telegram Passport", + "class": "Ok", + "properties": [ + { + "name": "code", + "type": "string", + "description": "Verification code" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "sendEmailAddressVerificationCode", + "description": "Sends a code to verify an email address to be added to a user's Telegram Passport", + "class": "EmailAddressAuthenticationCodeInfo", + "properties": [ + { + "name": "email_address", + "type": "string", + "description": "Email address" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "resendEmailAddressVerificationCode", + "description": "Re-sends the code to verify an email address to be added to a user's Telegram Passport", + "class": "EmailAddressAuthenticationCodeInfo", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "checkEmailAddressVerificationCode", + "description": "Checks the email address verification code for Telegram Passport", + "class": "Ok", + "properties": [ + { + "name": "code", + "type": "string", + "description": "Verification code" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getPassportAuthorizationForm", + "description": "Returns a Telegram Passport authorization form for sharing data with a service", + "class": "PassportAuthorizationForm", + "properties": [ + { + "name": "bot_user_id", + "type": "int32", + "description": "User identifier of the service's bot" + }, + { + "name": "scope", + "type": "string", + "description": "Telegram Passport element types requested by the service" + }, + { + "name": "public_key", + "type": "string", + "description": "Service's public_key" + }, + { + "name": "nonce", + "type": "string", + "description": "Authorization form nonce provided by the service" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getPassportAuthorizationFormAvailableElements", + "description": "Returns already available Telegram Passport elements suitable for completing a Telegram Passport authorization form. Result can be received only once for each authorization form", + "class": "PassportElementsWithErrors", + "properties": [ + { + "name": "autorization_form_id", + "type": "int32", + "description": "Authorization form identifier" + }, + { + "name": "password", + "type": "string", + "description": "Password of the current user" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "sendPassportAuthorizationForm", + "description": "Sends a Telegram Passport authorization form, effectively sharing data with the service. This method must be called after getPassportAuthorizationFormAvailableElements if some previously available elements are going to be reused", + "class": "Ok", + "properties": [ + { + "name": "autorization_form_id", + "type": "int32", + "description": "Authorization form identifier" + }, + { + "name": "types", + "type": "vector\u003cPassportElementType\u003e", + "description": "Types of Telegram Passport elements chosen by user to complete the authorization form" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "sendPhoneNumberConfirmationCode", + "description": "Sends phone number confirmation code. Should be called when user presses \"https://t.me/confirmphone?phone=*******\u0026hash=**********\" or \"tg://confirmphone?phone=*******\u0026hash=**********\" link", + "class": "AuthenticationCodeInfo", + "properties": [ + { + "name": "hash", + "type": "string", + "description": "Value of the \"hash\" parameter from the link" + }, + { + "name": "phone_number", + "type": "string", + "description": "Value of the \"phone\" parameter from the link" + }, + { + "name": "settings", + "type": "phoneNumberAuthenticationSettings", + "description": "Settings for the authentication of the user's phone number" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "resendPhoneNumberConfirmationCode", + "description": "Resends phone number confirmation code", + "class": "AuthenticationCodeInfo", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "checkPhoneNumberConfirmationCode", + "description": "Checks phone number confirmation code", + "class": "Ok", + "properties": [ + { + "name": "code", + "type": "string", + "description": "The phone number confirmation code" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "setBotUpdatesStatus", + "description": "Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only", + "class": "Ok", + "properties": [ + { + "name": "pending_update_count", + "type": "int32", + "description": "The number of pending updates" + }, + { + "name": "error_message", + "type": "string", + "description": "The last error message" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "uploadStickerFile", + "description": "Uploads a PNG image with a sticker; for bots only; returns the uploaded file", + "class": "File", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Sticker file owner" + }, + { + "name": "png_sticker", + "type": "InputFile", + "description": "PNG image with the sticker; must be up to 512 KB in size and fit in 512x512 square" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "createNewStickerSet", + "description": "Creates a new sticker set; for bots only. Returns the newly created sticker set", + "class": "StickerSet", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Sticker set owner" + }, + { + "name": "title", + "type": "string", + "description": "Sticker set title; 1-64 characters" + }, + { + "name": "name", + "type": "string", + "description": "Sticker set name. Can contain only English letters, digits and underscores. Must end with *\"_by_\u003cbot username\u003e\"* (*\u003cbot_username\u003e* is case insensitive); 1-64 characters" + }, + { + "name": "is_masks", + "type": "Bool", + "description": "True, if stickers are masks. Animated stickers can't be masks" + }, + { + "name": "stickers", + "type": "vector\u003cInputSticker\u003e", + "description": "List of stickers to be added to the set; must be non-empty. All stickers must be of the same type" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "addStickerToSet", + "description": "Adds a new sticker to a set; for bots only. Returns the sticker set", + "class": "StickerSet", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Sticker set owner" + }, + { + "name": "name", + "type": "string", + "description": "Sticker set name" + }, + { + "name": "sticker", + "type": "InputSticker", + "description": "Sticker to add to the set" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "setStickerSetThumbnail", + "description": "Sets a sticker set thumbnail; for bots only. Returns the sticker set", + "class": "StickerSet", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "Sticker set owner" + }, + { + "name": "name", + "type": "string", + "description": "Sticker set name" + }, + { + "name": "thumbnail", + "type": "InputFile", + "description": "Thumbnail to set in PNG or TGS format. Animated thumbnail must be set for animated sticker sets and only for them. Pass a zero InputFileId to delete the thumbnail" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "setStickerPositionInSet", + "description": "Changes the position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot", + "class": "Ok", + "properties": [ + { + "name": "sticker", + "type": "InputFile", + "description": "Sticker" + }, + { + "name": "position", + "type": "int32", + "description": "New position of the sticker in the set, zero-based" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "removeStickerFromSet", + "description": "Removes a sticker from the set to which it belongs; for bots only. The sticker set must have been created by the bot", + "class": "Ok", + "properties": [ + { + "name": "sticker", + "type": "InputFile", + "description": "Sticker" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "getMapThumbnailFile", + "description": "Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded", + "class": "File", + "properties": [ + { + "name": "location", + "type": "location", + "description": "Location of the map center" + }, + { + "name": "zoom", + "type": "int32", + "description": "Map zoom level; 13-20" + }, + { + "name": "width", + "type": "int32", + "description": "Map width in pixels before applying scale; 16-1024" + }, + { + "name": "height", + "type": "int32", + "description": "Map height in pixels before applying scale; 16-1024" + }, + { + "name": "scale", + "type": "int32", + "description": "Map scale; 1-3" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of a chat, in which the thumbnail will be shown. Use 0 if unknown" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "acceptTermsOfService", + "description": "Accepts Telegram terms of services", + "class": "Ok", + "properties": [ + { + "name": "terms_of_service_id", + "type": "string", + "description": "Terms of service identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "sendCustomRequest", + "description": "Sends a custom request; for bots only", + "class": "CustomRequestResult", + "properties": [ + { + "name": "method", + "type": "string", + "description": "The method name" + }, + { + "name": "parameters", + "type": "string", + "description": "JSON-serialized method parameters" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "answerCustomQuery", + "description": "Answers a custom query; for bots only", + "class": "Ok", + "properties": [ + { + "name": "custom_query_id", + "type": "int64", + "description": "Identifier of a custom query" + }, + { + "name": "data", + "type": "string", + "description": "JSON-serialized answer to the query" + } + ], + "is_synchronous": false, + "type": 3 + }, + { + "name": "setAlarm", + "description": "Succeeds after a specified amount of time has passed. Can be called before initialization", + "class": "Ok", + "properties": [ + { + "name": "seconds", + "type": "double", + "description": "Number of seconds before the function returns" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getCountries", + "description": "Returns information about existing countries. Can be called before authorization", + "class": "Countries", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getCountryCode", + "description": "Uses current user IP address to find their country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization", + "class": "Text", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getPhoneNumberInfo", + "description": "Returns information about a phone number by its prefix. Can be called before authorization", + "class": "PhoneNumberInfo", + "properties": [ + { + "name": "phone_number_prefix", + "type": "string", + "description": "The phone number prefix" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getInviteText", + "description": "Returns the default text for invitation messages to be used as a placeholder when the current user invites friends to Telegram", + "class": "Text", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getDeepLinkInfo", + "description": "Returns information about a tg:// deep link. Use \"tg://need_update_for_some_feature\" or \"tg:some_unsupported_feature\" for testing. Returns a 404 error for unknown links. Can be called before authorization", + "class": "DeepLinkInfo", + "properties": [ + { + "name": "link", + "type": "string", + "description": "The link" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getApplicationConfig", + "description": "Returns application config, provided by the server. Can be called before authorization", + "class": "JsonValue", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "saveApplicationLogEvent", + "description": "Saves application log event on the server. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "type", + "type": "string", + "description": "Event type" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Optional chat identifier, associated with the event" + }, + { + "name": "data", + "type": "JsonValue", + "description": "The log event data" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "addProxy", + "description": "Adds a proxy server for network requests. Can be called before authorization", + "class": "Proxy", + "properties": [ + { + "name": "server", + "type": "string", + "description": "Proxy server IP address" + }, + { + "name": "port", + "type": "int32", + "description": "Proxy server port" + }, + { + "name": "enable", + "type": "Bool", + "description": "True, if the proxy should be enabled" + }, + { + "name": "type", + "type": "ProxyType", + "description": "Proxy type" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "editProxy", + "description": "Edits an existing proxy server for network requests. Can be called before authorization", + "class": "Proxy", + "properties": [ + { + "name": "proxy_id", + "type": "int32", + "description": "Proxy identifier" + }, + { + "name": "server", + "type": "string", + "description": "Proxy server IP address" + }, + { + "name": "port", + "type": "int32", + "description": "Proxy server port" + }, + { + "name": "enable", + "type": "Bool", + "description": "True, if the proxy should be enabled" + }, + { + "name": "type", + "type": "ProxyType", + "description": "Proxy type" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "enableProxy", + "description": "Enables a proxy. Only one proxy can be enabled at a time. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "proxy_id", + "type": "int32", + "description": "Proxy identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "disableProxy", + "description": "Disables the currently enabled proxy. Can be called before authorization", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "removeProxy", + "description": "Removes a proxy server. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "proxy_id", + "type": "int32", + "description": "Proxy identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getProxies", + "description": "Returns list of proxies that are currently set up. Can be called before authorization", + "class": "Proxies", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getProxyLink", + "description": "Returns an HTTPS link, which can be used to add a proxy. Available only for SOCKS5 and MTProto proxies. Can be called before authorization", + "class": "Text", + "properties": [ + { + "name": "proxy_id", + "type": "int32", + "description": "Proxy identifier" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "pingProxy", + "description": "Computes time needed to receive a response from a Telegram server through a proxy. Can be called before authorization", + "class": "Seconds", + "properties": [ + { + "name": "proxy_id", + "type": "int32", + "description": "Proxy identifier. Use 0 to ping a Telegram server without a proxy" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "setLogStream", + "description": "Sets new log stream for internal logging of TDLib. Can be called synchronously", + "class": "Ok", + "properties": [ + { + "name": "log_stream", + "type": "LogStream", + "description": "New log stream" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getLogStream", + "description": "Returns information about currently used log stream for internal logging of TDLib. Can be called synchronously", + "class": "LogStream", + "properties": [], + "is_synchronous": true, + "type": 1 + }, + { + "name": "setLogVerbosityLevel", + "description": "Sets the verbosity level of the internal logging of TDLib. Can be called synchronously", + "class": "Ok", + "properties": [ + { + "name": "new_verbosity_level", + "type": "int32", + "description": "New value of the verbosity level for logging. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug, value greater than 5 and up to 1023 can be used to enable even more logging" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getLogVerbosityLevel", + "description": "Returns current verbosity level of the internal logging of TDLib. Can be called synchronously", + "class": "LogVerbosityLevel", + "properties": [], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getLogTags", + "description": "Returns list of available TDLib internal log tags, for example, [\"actor\", \"binlog\", \"connections\", \"notifications\", \"proxy\"]. Can be called synchronously", + "class": "LogTags", + "properties": [], + "is_synchronous": true, + "type": 1 + }, + { + "name": "setLogTagVerbosityLevel", + "description": "Sets the verbosity level for a specified TDLib internal log tag. Can be called synchronously", + "class": "Ok", + "properties": [ + { + "name": "tag", + "type": "string", + "description": "Logging tag to change verbosity level" + }, + { + "name": "new_verbosity_level", + "type": "int32", + "description": "New verbosity level; 1-1024" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getLogTagVerbosityLevel", + "description": "Returns current verbosity level for a specified TDLib internal log tag. Can be called synchronously", + "class": "LogVerbosityLevel", + "properties": [ + { + "name": "tag", + "type": "string", + "description": "Logging tag to change verbosity level" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "addLogMessage", + "description": "Adds a message to TDLib internal log. Can be called synchronously", + "class": "Ok", + "properties": [ + { + "name": "verbosity_level", + "type": "int32", + "description": "The minimum verbosity level needed for the message to be logged, 0-1023" + }, + { + "name": "text", + "type": "string", + "description": "Text of a message to log" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "testCallEmpty", + "description": "Does nothing; for testing only. This is an offline method. Can be called before authorization", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "testCallString", + "description": "Returns the received string; for testing only. This is an offline method. Can be called before authorization", + "class": "TestString", + "properties": [ + { + "name": "x", + "type": "string", + "description": "String to return" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "testCallBytes", + "description": "Returns the received bytes; for testing only. This is an offline method. Can be called before authorization", + "class": "TestBytes", + "properties": [ + { + "name": "x", + "type": "bytes", + "description": "Bytes to return" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "testCallVectorInt", + "description": "Returns the received vector of numbers; for testing only. This is an offline method. Can be called before authorization", + "class": "TestVectorInt", + "properties": [ + { + "name": "x", + "type": "vector\u003cint32\u003e", + "description": "Vector of numbers to return" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "testCallVectorIntObject", + "description": "Returns the received vector of objects containing a number; for testing only. This is an offline method. Can be called before authorization", + "class": "TestVectorIntObject", + "properties": [ + { + "name": "x", + "type": "vector\u003ctestInt\u003e", + "description": "Vector of objects to return" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "testCallVectorString", + "description": "Returns the received vector of strings; for testing only. This is an offline method. Can be called before authorization", + "class": "TestVectorString", + "properties": [ + { + "name": "x", + "type": "vector\u003cstring\u003e", + "description": "Vector of strings to return" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "testCallVectorStringObject", + "description": "Returns the received vector of objects containing a string; for testing only. This is an offline method. Can be called before authorization", + "class": "TestVectorStringObject", + "properties": [ + { + "name": "x", + "type": "vector\u003ctestString\u003e", + "description": "Vector of objects to return" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "testSquareInt", + "description": "Returns the squared received number; for testing only. This is an offline method. Can be called before authorization", + "class": "TestInt", + "properties": [ + { + "name": "x", + "type": "int32", + "description": "Number to square" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "testNetwork", + "description": "Sends a simple network request to the Telegram servers; for testing only. Can be called before authorization", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "testProxy", + "description": "Sends a simple network request to the Telegram servers via proxy; for testing only. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "server", + "type": "string", + "description": "Proxy server IP address" + }, + { + "name": "port", + "type": "int32", + "description": "Proxy server port" + }, + { + "name": "type", + "type": "ProxyType", + "description": "Proxy type" + }, + { + "name": "dc_id", + "type": "int32", + "description": "Identifier of a datacenter, with which to test connection" + }, + { + "name": "timeout", + "type": "double", + "description": "The maximum overall timeout for the request" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "testGetDifference", + "description": "Forces an updates.getDifference call to the Telegram servers; for testing only", + "class": "Ok", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "testUseUpdate", + "description": "Does nothing and ensures that the Update object is used; for testing only. This is an offline method. Can be called before authorization", + "class": "Update", + "properties": [], + "is_synchronous": false, + "type": 1 + }, + { + "name": "testReturnError", + "description": "Returns the specified error and ensures that the Error object is used; for testing only. Can be called synchronously", + "class": "Error", + "properties": [ + { + "name": "error", + "type": "error", + "description": "The error to be returned" + } + ], + "is_synchronous": true, + "type": 1 + } + ] +} \ No newline at end of file diff --git a/data/td_api.tl b/data/td_api.tl new file mode 100644 index 0000000..0b02922 --- /dev/null +++ b/data/td_api.tl @@ -0,0 +1,4910 @@ +double ? = Double; +string ? = String; + +int32 = Int32; +int53 = Int53; +int64 = Int64; +bytes = Bytes; + +boolFalse = Bool; +boolTrue = Bool; + +vector {t:Type} # [ t ] = Vector t; + + +//@description An object of this type can be returned on every function call, in case of an error +//@code 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 +//@message Error message; subject to future changes +error code:int32 message:string = Error; + + +//@description An object of this type is returned on a successful function call for certain functions +ok = Ok; + + +//@description Contains parameters for TDLib initialization +//@use_test_dc If set to true, the Telegram test environment will be used instead of the production environment +//@database_directory The path to the directory for the persistent database; if empty, the current working directory will be used +//@files_directory The path to the directory for storing files; if empty, database_directory will be used +//@use_file_database If set to true, information about downloaded and uploaded files will be saved between application restarts +//@use_chat_info_database If set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. Implies use_file_database +//@use_message_database If set to true, the library will maintain a cache of chats and messages. Implies use_chat_info_database +//@use_secret_chats If set to true, support for secret chats will be enabled +//@api_id Application identifier for Telegram API access, which can be obtained at https://my.telegram.org +//@api_hash Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org +//@system_language_code IETF language tag of the user's operating system language; must be non-empty +//@device_model Model of the device the application is being run on; must be non-empty +//@system_version Version of the operating system the application is being run on. If empty, the version is automatically detected by TDLib +//@application_version Application version; must be non-empty +//@enable_storage_optimizer If set to true, old files will automatically be deleted +//@ignore_file_names 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 +tdlibParameters use_test_dc:Bool database_directory:string files_directory:string use_file_database:Bool use_chat_info_database:Bool use_message_database:Bool use_secret_chats:Bool api_id:int32 api_hash:string system_language_code:string device_model:string system_version:string application_version:string enable_storage_optimizer:Bool ignore_file_names:Bool = TdlibParameters; + + +//@class AuthenticationCodeType @description Provides information about the method by which an authentication code is delivered to the user + +//@description An authentication code is delivered via a private Telegram message, which can be viewed from another active session @length Length of the code +authenticationCodeTypeTelegramMessage length:int32 = AuthenticationCodeType; + +//@description An authentication code is delivered via an SMS message to the specified phone number @length Length of the code +authenticationCodeTypeSms length:int32 = AuthenticationCodeType; + +//@description An authentication code is delivered via a phone call to the specified phone number @length Length of the code +authenticationCodeTypeCall length:int32 = AuthenticationCodeType; + +//@description 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 @pattern Pattern of the phone number from which the call will be made +authenticationCodeTypeFlashCall pattern:string = AuthenticationCodeType; + + +//@description Information about the authentication code that was sent @phone_number A phone number that is being authenticated @type Describes the way the code was sent to the user @next_type Describes the way the next code will be sent to the user; may be null @timeout Timeout before the code should be re-sent, in seconds +authenticationCodeInfo phone_number:string type:AuthenticationCodeType next_type:AuthenticationCodeType timeout:int32 = AuthenticationCodeInfo; + +//@description Information about the email address authentication code that was sent @email_address_pattern Pattern of the email address to which an authentication code was sent @length Length of the code; 0 if unknown +emailAddressAuthenticationCodeInfo email_address_pattern:string length:int32 = EmailAddressAuthenticationCodeInfo; + + +//@description Represents a part of the text that needs to be formatted in some unusual way @offset Offset of the entity, in UTF-16 code units @length Length of the entity, in UTF-16 code units @type Type of the entity +textEntity offset:int32 length:int32 type:TextEntityType = TextEntity; + +//@description Contains a list of text entities @entities List of text entities +textEntities entities:vector = TextEntities; + +//@description A text with some entities @text The text @entities Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. +//-Pre, Code and PreCode entities can't contain other entities. Bold, Italic, Underline and Strikethrough entities can contain and to be contained in all other entities. All other entities can't contain each other +formattedText text:string entities:vector = FormattedText; + + +//@description Contains Telegram terms of service @text Text of the terms of service @min_user_age The minimum age of a user to be able to accept the terms; 0 if any @show_popup True, if a blocking popup with terms of service must be shown to the user +termsOfService text:formattedText min_user_age:int32 show_popup:Bool = TermsOfService; + + +//@class AuthorizationState @description Represents the current authorization state of the TDLib client + +//@description TDLib needs TdlibParameters for initialization +authorizationStateWaitTdlibParameters = AuthorizationState; + +//@description TDLib needs an encryption key to decrypt the local database @is_encrypted True, if the database is currently encrypted +authorizationStateWaitEncryptionKey is_encrypted:Bool = AuthorizationState; + +//@description TDLib needs the user's phone number to authorize. Call `setAuthenticationPhoneNumber` to provide the phone number, or use `requestQrCodeAuthentication`, or `checkAuthenticationBotToken` for other authentication options +authorizationStateWaitPhoneNumber = AuthorizationState; + +//@description TDLib needs the user's authentication code to authorize @code_info Information about the authorization code that was sent +authorizationStateWaitCode code_info:authenticationCodeInfo = AuthorizationState; + +//@description The user needs to confirm authorization on another logged in device by scanning a QR code with the provided link @link A tg:// URL for the QR code. The link will be updated frequently +authorizationStateWaitOtherDeviceConfirmation link:string = AuthorizationState; + +//@description The user is unregistered and need to accept terms of service and enter their first name and last name to finish registration @terms_of_service Telegram terms of service +authorizationStateWaitRegistration terms_of_service:termsOfService = AuthorizationState; + +//@description The user has been authorized, but needs to enter a password to start using the application @password_hint Hint for the password; may be empty @has_recovery_email_address True, if a recovery email address has been set up +//@recovery_email_address_pattern Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent +authorizationStateWaitPassword password_hint:string has_recovery_email_address:Bool recovery_email_address_pattern:string = AuthorizationState; + +//@description The user has been successfully authorized. TDLib is now ready to answer queries +authorizationStateReady = AuthorizationState; + +//@description The user is currently logging out +authorizationStateLoggingOut = AuthorizationState; + +//@description 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 +authorizationStateClosing = AuthorizationState; + +//@description 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 +authorizationStateClosed = AuthorizationState; + + +//@description Represents the current state of 2-step verification @has_password True, if a 2-step verification password is set @password_hint Hint for the password; may be empty +//@has_recovery_email_address True, if a recovery email is set @has_passport_data True, if some Telegram Passport elements were saved +//@recovery_email_address_code_info Information about the recovery email address to which the confirmation email was sent; may be null +passwordState has_password:Bool password_hint:string has_recovery_email_address:Bool has_passport_data:Bool recovery_email_address_code_info:emailAddressAuthenticationCodeInfo = PasswordState; + +//@description Contains information about the current recovery email address @recovery_email_address Recovery email address +recoveryEmailAddress recovery_email_address:string = RecoveryEmailAddress; + + +//@description Returns information about the availability of a temporary password, which can be used for payments @has_password True, if a temporary password is available @valid_for Time left before the temporary password expires, in seconds +temporaryPasswordState has_password:Bool valid_for:int32 = TemporaryPasswordState; + + +//@description Represents a local file +//@path Local path to the locally available file part; may be empty +//@can_be_downloaded True, if it is possible to try to download or generate the file +//@can_be_deleted True, if the file can be deleted +//@is_downloading_active True, if the file is currently being downloaded (or a local copy is being generated by some other means) +//@is_downloading_completed True, if the local copy is fully available +//@download_offset Download will be started from this offset. downloaded_prefix_size is calculated from this offset +//@downloaded_prefix_size 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 +//@downloaded_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 +localFile path:string can_be_downloaded:Bool can_be_deleted:Bool is_downloading_active:Bool is_downloading_completed:Bool download_offset:int32 downloaded_prefix_size:int32 downloaded_size:int32 = LocalFile; + +//@description Represents a remote file +//@id Remote file identifier; may be empty. Can be used by the current user across application restarts or even from other devices. Uniquely identifies a file, but a file can have a lot of different valid identifiers. +//-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 application with the HTTP URL in the original_path and "#url#" as the conversion string. Application should generate the file by downloading it to the specified location +//@unique_id Unique file identifier; may be empty if unknown. The unique file identifier which is the same for the same file even for different users and is persistent over time +//@is_uploading_active True, if the file is currently being uploaded (or a remote copy is being generated by some other means) +//@is_uploading_completed True, if a remote copy is fully available +//@uploaded_size Size of the remote available part of the file; 0 if unknown +remoteFile id:string unique_id:string is_uploading_active:Bool is_uploading_completed:Bool uploaded_size:int32 = RemoteFile; + +//@description Represents a file +//@id Unique file identifier +//@size File size; 0 if unknown +//@expected_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 +//@local Information about the local copy of the file +//@remote Information about the remote copy of the file +file id:int32 size:int32 expected_size:int32 local:localFile remote:remoteFile = File; + + +//@class InputFile @description Points to a file + +//@description A file defined by its unique ID @id Unique file identifier +inputFileId id:int32 = InputFile; + +//@description A file defined by its remote ID. The remote ID is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. +//-For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application +//@id Remote file identifier +inputFileRemote id:string = InputFile; + +//@description A file defined by a local path @path Local path to the file +inputFileLocal path:string = InputFile; + +//@description A file generated by the application @original_path Local path to a file from which the file is generated; may be empty if there is no such file +//@conversion String specifying the conversion applied to the original file; should be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage +//@expected_size Expected size of the generated file; 0 if unknown +inputFileGenerated original_path:string conversion:string expected_size:int32 = InputFile; + + +//@description Describes an image in JPEG format @type Image type (see https://core.telegram.org/constructor/photoSize) +//@photo Information about the image file @width Image width @height Image height +//@progressive_sizes Sizes of progressive JPEG file prefixes, which can be used to preliminarily show the image +photoSize type:string photo:file width:int32 height:int32 progressive_sizes:vector = PhotoSize; + +//@description Thumbnail image of a very poor quality and low resolution @width Thumbnail width, usually doesn't exceed 40 @height Thumbnail height, usually doesn't exceed 40 @data The thumbnail in JPEG format +minithumbnail width:int32 height:int32 data:bytes = Minithumbnail; + + +//@class ThumbnailFormat @description Describes format of the thumbnail + +//@description The thumbnail is in JPEG format +thumbnailFormatJpeg = ThumbnailFormat; + +//@description The thumbnail is in PNG format. It will be used only for background patterns +thumbnailFormatPng = ThumbnailFormat; + +//@description The thumbnail is in WEBP format. It will be used only for some stickers +thumbnailFormatWebp = ThumbnailFormat; + +//@description The thumbnail is in static GIF format. It will be used only for some bot inline results +thumbnailFormatGif = ThumbnailFormat; + +//@description The thumbnail is in TGS format. It will be used only for animated sticker sets +thumbnailFormatTgs = ThumbnailFormat; + +//@description The thumbnail is in MPEG4 format. It will be used only for some animations and videos +thumbnailFormatMpeg4 = ThumbnailFormat; + + +//@description Represents a thumbnail @format Thumbnail format @width Thumbnail width @height Thumbnail height @file The thumbnail +thumbnail format:ThumbnailFormat width:int32 height:int32 file:file = Thumbnail; + + +//@class MaskPoint @description Part of the face, relative to which a mask should be placed + +//@description A mask should be placed relatively to the forehead +maskPointForehead = MaskPoint; + +//@description A mask should be placed relatively to the eyes +maskPointEyes = MaskPoint; + +//@description A mask should be placed relatively to the mouth +maskPointMouth = MaskPoint; + +//@description A mask should be placed relatively to the chin +maskPointChin = MaskPoint; + +//@description Position on a photo where a mask should be placed @point Part of the face, relative to which the mask should be placed +//@x_shift 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) +//@y_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) +//@scale Mask scaling coefficient. (For example, 2.0 means a doubled size) +maskPosition point:MaskPoint x_shift:double y_shift:double scale:double = MaskPosition; + + +//@description Describes one answer option of a poll @text Option text, 1-100 characters @voter_count Number of voters for this option, available only for closed or voted polls @vote_percentage The percentage of votes for this option, 0-100 +//@is_chosen True, if the option was chosen by the user @is_being_chosen True, if the option is being chosen by a pending setPollAnswer request +pollOption text:string voter_count:int32 vote_percentage:int32 is_chosen:Bool is_being_chosen:Bool = PollOption; + + +//@class PollType @description Describes the type of a poll + +//@description A regular poll @allow_multiple_answers True, if multiple answer options can be chosen simultaneously +pollTypeRegular allow_multiple_answers:Bool = PollType; + +//@description A poll in quiz mode, which has exactly one correct answer option and can be answered only once +//@correct_option_id 0-based identifier of the correct answer option; -1 for a yet unanswered poll +//@explanation Text that is shown when the user chooses an incorrect answer or taps on the lamp icon, 0-200 characters with at most 2 line feeds; empty for a yet unanswered poll +pollTypeQuiz correct_option_id:int32 explanation:formattedText = PollType; + + +//@description Describes an animation file. The animation must be encoded in GIF or MPEG4 format @duration Duration of the animation, in seconds; as defined by the sender @width Width of the animation @height Height of the animation +//@file_name Original name of the file; as defined by the sender @mime_type MIME type of the file, usually "image/gif" or "video/mp4" +//@has_stickers True, if stickers were added to the animation. The list of corresponding sticker set can be received using getAttachedStickerSets +//@minithumbnail Animation minithumbnail; may be null @thumbnail Animation thumbnail in JPEG or MPEG4 format; may be null @animation File containing the animation +animation duration:int32 width:int32 height:int32 file_name:string mime_type:string has_stickers:Bool minithumbnail:minithumbnail thumbnail:thumbnail animation:file = Animation; + +//@description Describes an audio file. Audio is usually in MP3 or M4A format @duration Duration of the audio, in seconds; as defined by the sender @title Title of the audio; as defined by the sender @performer Performer of the audio; as defined by the sender +//@file_name Original name of the file; as defined by the sender @mime_type The MIME type of the file; as defined by the sender @album_cover_minithumbnail The minithumbnail of the album cover; may be null +//@album_cover_thumbnail The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail should be extracted from the downloaded file; may be null @audio File containing the audio +audio duration:int32 title:string performer:string file_name:string mime_type:string album_cover_minithumbnail:minithumbnail album_cover_thumbnail:thumbnail audio:file = Audio; + +//@description Describes a document of any type @file_name Original name of the file; as defined by the sender @mime_type MIME type of the file; as defined by the sender +//@minithumbnail Document minithumbnail; may be null @thumbnail Document thumbnail in JPEG or PNG format (PNG will be used only for background patterns); as defined by the sender; may be null @document File containing the document +document file_name:string mime_type:string minithumbnail:minithumbnail thumbnail:thumbnail document:file = Document; + +//@description Describes a photo @has_stickers True, if stickers were added to the photo. The list of corresponding sticker sets can be received using getAttachedStickerSets +//@minithumbnail Photo minithumbnail; may be null @sizes Available variants of the photo, in different sizes +photo has_stickers:Bool minithumbnail:minithumbnail sizes:vector = Photo; + +//@description Describes a sticker @set_id The identifier of the sticker set to which the sticker belongs; 0 if none @width Sticker width; as defined by the sender @height Sticker height; as defined by the sender +//@emoji Emoji corresponding to the sticker @is_animated True, if the sticker is an animated sticker in TGS format @is_mask True, if the sticker is a mask @mask_position Position where the mask should be placed; may be null +//@thumbnail Sticker thumbnail in WEBP or JPEG format; may be null @sticker File containing the sticker +sticker set_id:int64 width:int32 height:int32 emoji:string is_animated:Bool is_mask:Bool mask_position:maskPosition thumbnail:thumbnail sticker:file = Sticker; + +//@description Describes a video file @duration Duration of the video, in seconds; as defined by the sender @width Video width; as defined by the sender @height Video height; as defined by the sender +//@file_name Original name of the file; as defined by the sender @mime_type MIME type of the file; as defined by the sender +//@has_stickers True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets +//@supports_streaming True, if the video should be tried to be streamed @minithumbnail Video minithumbnail; may be null +//@thumbnail Video thumbnail in JPEG or MPEG4 format; as defined by the sender; may be null @video File containing the video +video duration:int32 width:int32 height:int32 file_name:string mime_type:string has_stickers:Bool supports_streaming:Bool minithumbnail:minithumbnail thumbnail:thumbnail video:file = Video; + +//@description Describes a video note. The video must be equal in width and height, cropped to a circle, and stored in MPEG4 format @duration Duration of the video, in seconds; as defined by the sender +//@length Video width and height; as defined by the sender @minithumbnail Video minithumbnail; may be null +//@thumbnail Video thumbnail in JPEG format; as defined by the sender; may be null @video File containing the video +videoNote duration:int32 length:int32 minithumbnail:minithumbnail thumbnail:thumbnail video:file = VideoNote; + +//@description 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 @duration Duration of the voice note, in seconds; as defined by the sender +//@waveform A waveform representation of the voice note in 5-bit format @mime_type MIME type of the file; as defined by the sender @voice File containing the voice note +voiceNote duration:int32 waveform:bytes mime_type:string voice:file = VoiceNote; + +//@description Describes a user contact @phone_number Phone number of the user @first_name First name of the user; 1-255 characters in length @last_name Last name of the user @vcard Additional data about the user in a form of vCard; 0-2048 bytes in length @user_id Identifier of the user, if known; otherwise 0 +contact phone_number:string first_name:string last_name:string vcard:string user_id:int32 = Contact; + +//@description Describes a location on planet Earth @latitude Latitude of the location in degrees; as defined by the sender @longitude Longitude of the location, in degrees; as defined by the sender +//@horizontal_accuracy The estimated horizontal accuracy of the location, in meters; as defined by the sender. 0 if unknown +location latitude:double longitude:double horizontal_accuracy:double = Location; + +//@description Describes a venue @location Venue location; as defined by the sender @title Venue name; as defined by the sender @address Venue address; as defined by the sender @provider Provider of the venue database; as defined by the sender. Currently only "foursquare" and "gplaces" (Google Places) need to be supported +//@id Identifier of the venue in the provider database; as defined by the sender @type Type of the venue in the provider database; as defined by the sender +venue location:location title:string address:string provider:string id:string type:string = Venue; + +//@description Describes a game @id Game ID @short_name Game short name. To share a game use the URL https://t.me/{bot_username}?game={game_short_name} @title Game title @text Game text, usually containing scoreboards for a game +//@param_description Game description @photo Game photo @animation Game animation; may be null +game id:int64 short_name:string title:string text:formattedText description:string photo:photo animation:animation = Game; + +//@description Describes a poll @id Unique poll identifier @question Poll question, 1-300 characters @options List of poll answer options +//@total_voter_count Total number of voters, participating in the poll @recent_voter_user_ids User identifiers of recent voters, if the poll is non-anonymous +//@is_anonymous True, if the poll is anonymous @type Type of the poll +//@open_period Amount of time the poll will be active after creation, in seconds @close_date Point in time (Unix timestamp) when the poll will be automatically closed @is_closed True, if the poll is closed +poll id:int64 question:string options:vector total_voter_count:int32 recent_voter_user_ids:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = Poll; + + +//@description Describes a user profile photo @id Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of user profile photos +//@small A small (160x160) user profile photo. The file can be downloaded only before the photo is changed +//@big A big (640x640) user profile photo. The file can be downloaded only before the photo is changed +//@has_animation True, if the photo has animated variant +profilePhoto id:int64 small:file big:file has_animation:Bool = ProfilePhoto; + +//@description Contains basic information about the photo of a chat +//@small A small (160x160) chat photo variant in JPEG format. The file can be downloaded only before the photo is changed +//@big A big (640x640) chat photo variant in JPEG format. The file can be downloaded only before the photo is changed +//@has_animation True, if the photo has animated variant +chatPhotoInfo small:file big:file has_animation:Bool = ChatPhotoInfo; + + +//@class UserType @description Represents the type of a user. The following types are possible: regular users, deleted users and bots + +//@description A regular user +userTypeRegular = UserType; + +//@description A deleted user or deleted bot. No information on the user besides the user identifier is available. It is not possible to perform any active actions on this type of user +userTypeDeleted = UserType; + +//@description A bot (see https://core.telegram.org/bots) @can_join_groups True, if the bot can be invited to basic group and supergroup chats +//@can_read_all_group_messages 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 +//@is_inline True, if the bot supports inline queries @inline_query_placeholder Placeholder for inline queries (displayed on the application input field) @need_location True, if the location of the user should be sent with every inline query to this bot +userTypeBot can_join_groups:Bool can_read_all_group_messages:Bool is_inline:Bool inline_query_placeholder:string need_location:Bool = UserType; + +//@description No information on the user besides the user identifier 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 +userTypeUnknown = UserType; + + +//@description Represents a command supported by a bot @command Text of the bot command @param_description Description of the bot command +botCommand command:string description:string = BotCommand; + +//@description Provides information about a bot and its supported commands @param_description Long description shown on the user info page @commands A list of commands supported by the bot +botInfo description:string commands:vector = BotInfo; + + +//@description Represents a location to which a chat is connected @location The location @address Location address; 1-64 characters, as defined by the chat owner +chatLocation location:location address:string = ChatLocation; + + +//@description Animated variant of a chat photo in MPEG4 format +//@length Animation width and height +//@file Information about the animation file +//@main_frame_timestamp Timestamp of the frame, used as a static chat photo +animatedChatPhoto length:int32 file:file main_frame_timestamp:double = AnimatedChatPhoto; + + +//@description Describes a chat or user profile photo +//@id Unique photo identifier +//@added_date Point in time (Unix timestamp) when the photo has been added +//@minithumbnail Photo minithumbnail; may be null +//@sizes Available variants of the photo in JPEG format, in different size +//@animation Animated variant of the photo in MPEG4 format; may be null +chatPhoto id:int64 added_date:int32 minithumbnail:minithumbnail sizes:vector animation:animatedChatPhoto = ChatPhoto; + +//@description Contains a list of chat or user profile photos @total_count Total number of photos @photos List of photos +chatPhotos total_count:int32 photos:vector = ChatPhotos; + + +//@class InputChatPhoto @description Describes a photo to be set as a user profile or chat photo + +//@description A previously used profile photo of the current user @chat_photo_id Identifier of the profile photo to reuse +inputChatPhotoPrevious chat_photo_id:int64 = InputChatPhoto; + +//@description A static photo in JPEG format @photo Photo to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed +inputChatPhotoStatic photo:InputFile = InputChatPhoto; + +//@description An animation in MPEG4 format; must be square, at most 10 seconds long, have width between 160 and 800 and be at most 2MB in size +//@animation Animation to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed +//@main_frame_timestamp Timestamp of the frame, which will be used as static chat photo +inputChatPhotoAnimation animation:InputFile main_frame_timestamp:double = InputChatPhoto; + + +//@description Represents a user +//@id User identifier +//@first_name First name of the user +//@last_name Last name of the user +//@username Username of the user +//@phone_number Phone number of the user +//@status Current online status of the user +//@profile_photo Profile photo of the user; may be null +//@is_contact The user is a contact of the current user +//@is_mutual_contact The user is a contact of the current user and the current user is a contact of the user +//@is_verified True, if the user is verified +//@is_support True, if the user is Telegram support account +//@restriction_reason If non-empty, it contains a human-readable description of the reason why access to this user must be restricted +//@is_scam True, if many users reported this user as a scam +//@have_access 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 +//@type Type of the user +//@language_code IETF language tag of the user's language; only available to bots +user id:int32 first_name:string last_name:string username:string phone_number:string status:UserStatus profile_photo:profilePhoto is_contact:Bool is_mutual_contact:Bool is_verified:Bool is_support:Bool restriction_reason:string is_scam:Bool have_access:Bool type:UserType language_code:string = User; + +//@description Contains full information about a user +//@photo User profile photo; may be null +//@is_blocked True, if the user is blocked by the current user +//@can_be_called True, if the user can be called +//@supports_video_calls True, if a video call can be created with the user +//@has_private_calls True, if the user can't be called due to their privacy settings +//@need_phone_number_privacy_exception True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used +//@bio A short user bio @share_text For bots, the text that is included with the link when users share the bot +//@group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user +//@bot_info If the user is a bot, information about the bot; may be null +userFullInfo photo:chatPhoto is_blocked:Bool can_be_called:Bool supports_video_calls:Bool has_private_calls:Bool need_phone_number_privacy_exception:Bool bio:string share_text:string group_in_common_count:int32 bot_info:botInfo = UserFullInfo; + +//@description Represents a list of users @total_count Approximate total count of users found @user_ids A list of user identifiers +users total_count:int32 user_ids:vector = Users; + + +//@description Contains information about a chat administrator @user_id User identifier of the administrator @custom_title Custom title of the administrator @is_owner True, if the user is the owner of the chat +chatAdministrator user_id:int32 custom_title:string is_owner:Bool = ChatAdministrator; + +//@description Represents a list of chat administrators @administrators A list of chat administrators +chatAdministrators administrators:vector = ChatAdministrators; + + +//@description Describes actions that a user is allowed to take in a chat +//@can_send_messages True, if the user can send text messages, contacts, locations, and venues +//@can_send_media_messages True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions +//@can_send_polls True, if the user can send polls. Implies can_send_messages permissions +//@can_send_other_messages True, if the user can send animations, games, stickers, and dice and use inline bots. Implies can_send_messages permissions +//@can_add_web_page_previews True, if the user may add a web page preview to their messages. Implies can_send_messages permissions +//@can_change_info True, if the user can change the chat title, photo, and other settings +//@can_invite_users True, if the user can invite new users to the chat +//@can_pin_messages True, if the user can pin messages +chatPermissions can_send_messages:Bool can_send_media_messages:Bool can_send_polls:Bool can_send_other_messages:Bool can_add_web_page_previews:Bool can_change_info:Bool can_invite_users:Bool can_pin_messages:Bool = ChatPermissions; + + +//@class ChatMemberStatus @description Provides information about the status of a member in a chat + +//@description The user is the owner of a chat and has all the administrator privileges +//@custom_title A custom title of the owner; 0-16 characters without emojis; applicable to supergroups only +//@is_anonymous True, if the creator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only +//@is_member True, if the user is a member of the chat +chatMemberStatusCreator custom_title:string is_anonymous:Bool is_member:Bool = ChatMemberStatus; + +//@description 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 +//@custom_title A custom title of the administrator; 0-16 characters without emojis; applicable to supergroups only +//@can_be_edited True, if the current user can edit the administrator privileges for the called user +//@can_change_info True, if the administrator can change the chat title, photo, and other settings +//@can_post_messages True, if the administrator can create channel posts; applicable to channels only +//@can_edit_messages True, if the administrator can edit messages of other users and pin messages; applicable to channels only +//@can_delete_messages True, if the administrator can delete messages of other users +//@can_invite_users True, if the administrator can invite new users to the chat +//@can_restrict_members True, if the administrator can restrict, ban, or unban chat members +//@can_pin_messages True, if the administrator can pin messages; applicable to groups only +//@can_promote_members 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 them +//@is_anonymous True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only +chatMemberStatusAdministrator custom_title:string can_be_edited:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_promote_members:Bool is_anonymous:Bool = ChatMemberStatus; + +//@description The user is a member of a chat, without any additional privileges or restrictions +chatMemberStatusMember = ChatMemberStatus; + +//@description The user is under certain restrictions in the chat. Not supported in basic groups and channels +//@is_member True, if the user is a member of the chat +//@restricted_until_date 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 +//@permissions User permissions in the chat +chatMemberStatusRestricted is_member:Bool restricted_until_date:int32 permissions:chatPermissions = ChatMemberStatus; + +//@description The user is not a chat member +chatMemberStatusLeft = ChatMemberStatus; + +//@description 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 +//@banned_until_date 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 +chatMemberStatusBanned banned_until_date:int32 = ChatMemberStatus; + + +//@description A user with information about joining/leaving a chat @user_id User identifier of the chat member +//@inviter_user_id Identifier of a user that invited/promoted/banned this member in the chat; 0 if unknown +//@joined_chat_date Point in time (Unix timestamp) when the user joined the chat +//@status Status of the member in the chat +//@bot_info 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 the chat member +chatMember user_id:int32 inviter_user_id:int32 joined_chat_date:int32 status:ChatMemberStatus bot_info:botInfo = ChatMember; + +//@description Contains a list of chat members @total_count Approximate total count of chat members found @members A list of chat members +chatMembers total_count:int32 members:vector = ChatMembers; + + +//@class ChatMembersFilter @description Specifies the kind of chat members to return in searchChatMembers + +//@description Returns contacts of the user +chatMembersFilterContacts = ChatMembersFilter; + +//@description Returns the owner and administrators +chatMembersFilterAdministrators = ChatMembersFilter; + +//@description Returns all chat members, including restricted chat members +chatMembersFilterMembers = ChatMembersFilter; + +//@description Returns users which can be mentioned in the chat @message_thread_id If non-zero, the identifier of the current message thread +chatMembersFilterMention message_thread_id:int53 = ChatMembersFilter; + +//@description Returns users under certain restrictions in the chat; can be used only by administrators in a supergroup +chatMembersFilterRestricted = ChatMembersFilter; + +//@description Returns users banned from the chat; can be used only by administrators in a supergroup or in a channel +chatMembersFilterBanned = ChatMembersFilter; + +//@description Returns bot members of the chat +chatMembersFilterBots = ChatMembersFilter; + + +//@class SupergroupMembersFilter @description Specifies the kind of chat members to return in getSupergroupMembers + +//@description Returns recently active users in reverse chronological order +supergroupMembersFilterRecent = SupergroupMembersFilter; + +//@description Returns contacts of the user, which are members of the supergroup or channel @query Query to search for +supergroupMembersFilterContacts query:string = SupergroupMembersFilter; + +//@description Returns the owner and administrators +supergroupMembersFilterAdministrators = SupergroupMembersFilter; + +//@description Used to search for supergroup or channel members via a (string) query @query Query to search for +supergroupMembersFilterSearch query:string = SupergroupMembersFilter; + +//@description Returns restricted supergroup members; can be used only by administrators @query Query to search for +supergroupMembersFilterRestricted query:string = SupergroupMembersFilter; + +//@description Returns users banned from the supergroup or channel; can be used only by administrators @query Query to search for +supergroupMembersFilterBanned query:string = SupergroupMembersFilter; + +//@description Returns users which can be mentioned in the supergroup @query Query to search for @message_thread_id If non-zero, the identifier of the current message thread +supergroupMembersFilterMention query:string message_thread_id:int53 = SupergroupMembersFilter; + +//@description Returns bot members of the supergroup or channel +supergroupMembersFilterBots = SupergroupMembersFilter; + + +//@description Represents a basic group of 0-200 users (must be upgraded to a supergroup to accommodate more than 200 users) +//@id Group identifier +//@member_count Number of members in the group +//@status Status of the current user in the group +//@is_active True, if the group is active +//@upgraded_to_supergroup_id Identifier of the supergroup to which this group was upgraded; 0 if none +basicGroup id:int32 member_count:int32 status:ChatMemberStatus is_active:Bool upgraded_to_supergroup_id:int32 = BasicGroup; + +//@description Contains full information about a basic group +//@photo Chat photo; may be null +//@param_description Group description +//@creator_user_id User identifier of the creator of the group; 0 if unknown +//@members Group members +//@invite_link Invite link for this group; available only after it has been generated at least once and only for the group creator +basicGroupFullInfo photo:chatPhoto description:string creator_user_id:int32 members:vector invite_link:string = BasicGroupFullInfo; + + +//@description 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 +//@id Supergroup or channel identifier +//@username Username of the supergroup or channel; empty for private supergroups or channels +//@date 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 +//@status Status of the current user in the supergroup or channel; custom title will be always empty +//@member_count Number of members in the supergroup or channel; 0 if unknown. Currently it is guaranteed to be known only if the supergroup or channel was received through searchPublicChats, searchChatsNearby, getInactiveSupergroupChats, getSuitableDiscussionChats, getGroupsInCommon, or getUserPrivacySettingRules +//@has_linked_chat True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel +//@has_location True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup +//@sign_messages True, if messages sent to the channel should contain information about the sender. This field is only applicable to channels +//@is_slow_mode_enabled True, if the slow mode is enabled in the supergroup +//@is_channel True, if the supergroup is a channel +//@is_verified True, if the supergroup or channel is verified +//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted +//@is_scam True, if many users reported this supergroup as a scam +supergroup id:int32 username:string date:int32 status:ChatMemberStatus member_count:int32 has_linked_chat:Bool has_location:Bool sign_messages:Bool is_slow_mode_enabled:Bool is_channel:Bool is_verified:Bool restriction_reason:string is_scam:Bool = Supergroup; + +//@description Contains full information about a supergroup or channel +//@photo Chat photo; may be null +//@param_description Supergroup or channel description +//@member_count Number of members in the supergroup or channel; 0 if unknown +//@administrator_count Number of privileged users in the supergroup or channel; 0 if unknown +//@restricted_count Number of restricted users in the supergroup; 0 if unknown +//@banned_count Number of users banned from chat; 0 if unknown +//@linked_chat_id Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown +//@slow_mode_delay Delay between consecutive sent messages for non-administrator supergroup members, in seconds +//@slow_mode_delay_expires_in Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero +//@can_get_members True, if members of the chat can be retrieved +//@can_set_username True, if the chat username can be changed +//@can_set_sticker_set True, if the supergroup sticker set can be changed +//@can_set_location True, if the supergroup location can be changed +//@can_get_statistics True, if the supergroup or channel statistics are available +//@is_all_history_available True, if new chat members will have access to old messages. In public or discussion groups and both public and private channels, old messages are always available, so this option affects only private supergroups without a linked chat. The value of this field is only available for chat administrators +//@sticker_set_id Identifier of the supergroup sticker set; 0 if none +//@location Location to which the supergroup is connected; may be null +//@invite_link Invite link for this chat +//@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none +//@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none +supergroupFullInfo photo:chatPhoto description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 linked_chat_id:int53 slow_mode_delay:int32 slow_mode_delay_expires_in:double can_get_members:Bool can_set_username:Bool can_set_sticker_set:Bool can_set_location:Bool can_get_statistics:Bool is_all_history_available:Bool sticker_set_id:int64 location:chatLocation invite_link:string upgraded_from_basic_group_id:int32 upgraded_from_max_message_id:int53 = SupergroupFullInfo; + + +//@class SecretChatState @description Describes the current secret chat state + +//@description The secret chat is not yet created; waiting for the other user to get online +secretChatStatePending = SecretChatState; + +//@description The secret chat is ready to use +secretChatStateReady = SecretChatState; + +//@description The secret chat is closed +secretChatStateClosed = SecretChatState; + + +//@description Represents a secret chat +//@id Secret chat identifier +//@user_id Identifier of the chat partner +//@state State of the secret chat +//@is_outbound True, if the chat was created by the current user; otherwise false +//@ttl Current message Time To Live setting (self-destruct timer) for the chat, in seconds +//@key_hash Hash of the currently used key for comparison with the hash of the chat partner's key. This is a string of 36 little-endian bytes, which must be split into groups of 2 bits, each denoting a pixel of one of 4 colors FFFFFF, D5E6F3, 2D5775, and 2F99C9. +//-The pixels must be used to make a 12x12 square image filled from left to right, top to bottom. Alternatively, the first 32 bytes of the hash can be converted to the hexadecimal format and printed as 32 2-digit hex numbers +//@layer Secret chat layer; determines features supported by the chat partner's application. Video notes are supported if the layer >= 66; nested text entities and underline and strikethrough entities are supported if the layer >= 101 +secretChat id:int32 user_id:int32 state:SecretChatState is_outbound:Bool ttl:int32 key_hash:bytes layer:int32 = SecretChat; + + +//@class MessageSender @description Contains information about the sender of a message + +//@description The message was sent by a known user @user_id Identifier of the user that sent the message +messageSenderUser user_id:int32 = MessageSender; + +//@description The message was sent on behalf of a chat @chat_id Identifier of the chat that sent the message +messageSenderChat chat_id:int53 = MessageSender; + + +//@description Represents a list of message senders @total_count Approximate total count of messages senders found @senders List of message senders +messageSenders total_count:int32 senders:vector = MessageSenders; + + +//@class MessageForwardOrigin @description Contains information about the origin of a forwarded message + +//@description The message was originally sent by a known user @sender_user_id Identifier of the user that originally sent the message +messageForwardOriginUser sender_user_id:int32 = MessageForwardOrigin; + +//@description The message was originally sent by an anonymous chat administrator on behalf of the chat +//@sender_chat_id Identifier of the chat that originally sent the message +//@author_signature Original message author signature +messageForwardOriginChat sender_chat_id:int53 author_signature:string = MessageForwardOrigin; + +//@description The message was originally sent by a user, which is hidden by their privacy settings @sender_name Name of the sender +messageForwardOriginHiddenUser sender_name:string = MessageForwardOrigin; + +//@description The message was originally a post in a channel +//@chat_id Identifier of the chat from which the message was originally forwarded +//@message_id Message identifier of the original message +//@author_signature Original post author signature +messageForwardOriginChannel chat_id:int53 message_id:int53 author_signature:string = MessageForwardOrigin; + + +//@description Contains information about a forwarded message +//@origin Origin of a forwarded message +//@date Point in time (Unix timestamp) when the message was originally sent +//@public_service_announcement_type The type of a public service announcement for the forwarded message +//@from_chat_id For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the chat from which the message was forwarded last time; 0 if unknown +//@from_message_id For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the original message from which the new message was forwarded last time; 0 if unknown +messageForwardInfo origin:MessageForwardOrigin date:int32 public_service_announcement_type:string from_chat_id:int53 from_message_id:int53 = MessageForwardInfo; + +//@description Contains information about replies to a message +//@reply_count Number of times the message was directly or indirectly replied +//@recent_repliers Recent repliers to the message; available in channels with a discussion supergroup +//@last_read_inbox_message_id Identifier of the last read incoming reply to the message +//@last_read_outbox_message_id Identifier of the last read outgoing reply to the message +//@last_message_id Identifier of the last reply to the message +messageReplyInfo reply_count:int32 recent_repliers:vector last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 last_message_id:int53 = MessageReplyInfo; + +//@description Contains information about interactions with a message +//@view_count Number of times the message was viewed +//@forward_count Number of times the message was forwarded +//@reply_info Contains information about direct or indirect replies to the message; may be null. Currently, available only in channels with a discussion supergroup and discussion supergroups for messages, which are not replies itself +messageInteractionInfo view_count:int32 forward_count:int32 reply_info:messageReplyInfo = MessageInteractionInfo; + + +//@class MessageSendingState @description Contains information about the sending state of the message + +//@description The message is being sent now, but has not yet been delivered to the server +messageSendingStatePending = MessageSendingState; + +//@description The message failed to be sent @error_code An error code; 0 if unknown @error_message Error message +//@can_retry True, if the message can be re-sent @retry_after Time left before the message can be re-sent, in seconds. No update is sent when this field changes +messageSendingStateFailed error_code:int32 error_message:string can_retry:Bool retry_after:double = MessageSendingState; + + +//@description Describes a message +//@id Message identifier; unique for the chat to which the message belongs +//@sender The sender of the message +//@chat_id Chat identifier +//@sending_state Information about the sending state of the message; may be null +//@scheduling_state Information about the scheduling state of the message; may be null +//@is_outgoing True, if the message is outgoing +//@is_pinned True, if the message is pinned +//@can_be_edited 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 application +//@can_be_forwarded True, if the message can be forwarded +//@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it +//@can_be_deleted_for_all_users True, if the message can be deleted for all users +//@can_get_statistics True, if the message statistics are available +//@can_get_message_thread True, if the message thread info is available +//@is_channel_post True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts +//@contains_unread_mention True, if the message contains an unread mention for the current user +//@date Point in time (Unix timestamp) when the message was sent +//@edit_date Point in time (Unix timestamp) when the message was last edited +//@forward_info Information about the initial message sender; may be null +//@interaction_info Information about interactions with the message; may be null +//@reply_in_chat_id If non-zero, the identifier of the chat to which the replied message belongs; Currently, only messages in the Replies chat can have different reply_in_chat_id and chat_id +//@reply_to_message_id If non-zero, the identifier of the message this message is replying to; can be the identifier of a deleted message +//@message_thread_id If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs +//@ttl 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_expires_in Time left before the message expires, in seconds +//@via_bot_user_id If non-zero, the user identifier of the bot through which this message was sent +//@author_signature For channel posts and anonymous group messages, optional author signature +//@media_album_id Unique identifier of an album this message belongs to. Only photos and videos can be grouped together in albums +//@restriction_reason If non-empty, contains a human-readable description of the reason why access to this message must be restricted +//@content Content of the message +//@reply_markup Reply markup for the message; may be null +message id:int53 sender:MessageSender chat_id:int53 sending_state:MessageSendingState scheduling_state:MessageSchedulingState is_outgoing:Bool is_pinned:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_get_statistics:Bool can_get_message_thread:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo interaction_info:messageInteractionInfo reply_in_chat_id:int53 reply_to_message_id:int53 message_thread_id:int53 ttl:int32 ttl_expires_in:double via_bot_user_id:int32 author_signature:string media_album_id:int64 restriction_reason:string content:MessageContent reply_markup:ReplyMarkup = Message; + +//@description Contains a list of messages @total_count Approximate total count of messages found @messages List of messages; messages may be null +messages total_count:int32 messages:vector = Messages; + +//@description Contains a list of messages found by a search @total_count Approximate total count of messages found; -1 if unknown @messages List of messages @next_offset The offset for the next request. If empty, there are no more results +foundMessages total_count:int32 messages:vector next_offset:string = FoundMessages; + + +//@class NotificationSettingsScope @description Describes the types of chats to which notification settings are applied + +//@description Notification settings applied to all private and secret chats when the corresponding chat setting has a default value +notificationSettingsScopePrivateChats = NotificationSettingsScope; + +//@description Notification settings applied to all basic groups and supergroups when the corresponding chat setting has a default value +notificationSettingsScopeGroupChats = NotificationSettingsScope; + +//@description Notification settings applied to all channels when the corresponding chat setting has a default value +notificationSettingsScopeChannelChats = NotificationSettingsScope; + + +//@description Contains information about notification settings for a chat +//@use_default_mute_for If true, mute_for is ignored and the value for the relevant type of chat is used instead @mute_for Time left before notifications will be unmuted, in seconds +//@use_default_sound If true, sound is ignored and the value for the relevant type of chat is used instead @sound The name of an audio file to be used for notification sounds; only applies to iOS applications +//@use_default_show_preview If true, show_preview is ignored and the value for the relevant type of chat is used instead @show_preview True, if message content should be displayed in notifications +//@use_default_disable_pinned_message_notifications If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat is used instead @disable_pinned_message_notifications If true, notifications for incoming pinned messages will be created as for an ordinary unread message +//@use_default_disable_mention_notifications If true, disable_mention_notifications is ignored and the value for the relevant type of chat is used instead @disable_mention_notifications If true, notifications for messages with mentions will be created as for an ordinary unread message +chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound:string use_default_show_preview:Bool show_preview:Bool use_default_disable_pinned_message_notifications:Bool disable_pinned_message_notifications:Bool use_default_disable_mention_notifications:Bool disable_mention_notifications:Bool = ChatNotificationSettings; + +//@description Contains information about notification settings for several chats +//@mute_for Time left before notifications will be unmuted, in seconds +//@sound The name of an audio file to be used for notification sounds; only applies to iOS applications +//@show_preview True, if message content should be displayed in notifications +//@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message +//@disable_mention_notifications True, if notifications for messages with mentions will be created as for an ordinary unread message +scopeNotificationSettings mute_for:int32 sound:string show_preview:Bool disable_pinned_message_notifications:Bool disable_mention_notifications:Bool = ScopeNotificationSettings; + + +//@description Contains information about a message draft +//@reply_to_message_id Identifier of the message to reply to; 0 if none +//@date Point in time (Unix timestamp) when the draft was created +//@input_message_text Content of the message draft; this should always be of type inputMessageText +draftMessage reply_to_message_id:int53 date:int32 input_message_text:InputMessageContent = DraftMessage; + + +//@class ChatType @description Describes the type of a chat + +//@description An ordinary chat with a user @user_id User identifier +chatTypePrivate user_id:int32 = ChatType; + +//@description A basic group (i.e., a chat with 0-200 other users) @basic_group_id Basic group identifier +chatTypeBasicGroup basic_group_id:int32 = ChatType; + +//@description A supergroup (i.e. a chat with up to GetOption("supergroup_max_size") other users), or channel (with unlimited members) @supergroup_id Supergroup or channel identifier @is_channel True, if the supergroup is a channel +chatTypeSupergroup supergroup_id:int32 is_channel:Bool = ChatType; + +//@description A secret chat with a user @secret_chat_id Secret chat identifier @user_id User identifier of the secret chat peer +chatTypeSecret secret_chat_id:int32 user_id:int32 = ChatType; + + +//@description Represents a filter of user chats +//@title The title of the filter; 1-12 characters without line feeds +//@icon_name The icon name for short filter representation. If non-empty, must be one of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work". +//-If empty, use getChatFilterDefaultIconName to get default icon name for the filter +//@pinned_chat_ids The chat identifiers of pinned chats in the filtered chat list +//@included_chat_ids The chat identifiers of always included chats in the filtered chat list +//@excluded_chat_ids The chat identifiers of always excluded chats in the filtered chat list +//@exclude_muted True, if muted chats need to be excluded +//@exclude_read True, if read chats need to be excluded +//@exclude_archived True, if archived chats need to be excluded +//@include_contacts True, if contacts need to be included +//@include_non_contacts True, if non-contact users need to be included +//@include_bots True, if bots need to be included +//@include_groups True, if basic groups and supergroups need to be included +//@include_channels True, if channels need to be included +chatFilter title:string icon_name:string pinned_chat_ids:vector included_chat_ids:vector excluded_chat_ids:vector exclude_muted:Bool exclude_read:Bool exclude_archived:Bool include_contacts:Bool include_non_contacts:Bool include_bots:Bool include_groups:Bool include_channels:Bool = ChatFilter; + +//@description Contains basic information about a chat filter +//@id Unique chat filter identifier +//@title The title of the filter; 1-12 characters without line feeds +//@icon_name The icon name for short filter representation. One of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work" +chatFilterInfo id:int32 title:string icon_name:string = ChatFilterInfo; + +//@description Describes a recommended chat filter @filter The chat filter @param_description Chat filter description +recommendedChatFilter filter:chatFilter description:string = RecommendedChatFilter; + +//@description Contains a list of recommended chat filters @chat_filters List of recommended chat filters +recommendedChatFilters chat_filters:vector = RecommendedChatFilters; + + +//@class ChatList @description Describes a list of chats + +//@description A main list of chats +chatListMain = ChatList; + +//@description A list of chats usually located at the top of the main chat list. Unmuted chats are automatically moved from the Archive to the Main chat list when a new message arrives +chatListArchive = ChatList; + +//@description A list of chats belonging to a chat filter @chat_filter_id Chat filter identifier +chatListFilter chat_filter_id:int32 = ChatList; + +//@description Contains a list of chat lists @chat_lists List of chat lists +chatLists chat_lists:vector = ChatLists; + + +//@class ChatSource @description Describes a reason why an external chat is shown in a chat list + +//@description The chat is sponsored by the user's MTProxy server +chatSourceMtprotoProxy = ChatSource; + +//@description The chat contains a public service announcement @type The type of the announcement @text The text of the announcement +chatSourcePublicServiceAnnouncement type:string text:string = ChatSource; + + +//@description Describes a position of a chat in a chat list +//@list The chat list +//@order A parameter used to determine order of the chat in the chat list. Chats must be sorted by the pair (order, chat.id) in descending order +//@is_pinned True, if the chat is pinned in the chat list +//@source Source of the chat in the chat list; may be null +chatPosition list:ChatList order:int64 is_pinned:Bool source:ChatSource = ChatPosition; + + +//@description A chat. (Can be a private chat, basic group, supergroup, or secret chat) +//@id Chat unique identifier +//@type Type of the chat +//@title Chat title +//@photo Chat photo; may be null +//@permissions Actions that non-administrator chat members are allowed to take in the chat +//@last_message Last message in the chat; may be null +//@positions Positions of the chat in chat lists +//@is_marked_as_unread True, if the chat is marked as unread +//@is_blocked True, if the chat is blocked by the current user and private messages from the chat can't be received +//@has_scheduled_messages True, if the chat has scheduled messages +//@can_be_deleted_only_for_self True, if the chat messages can be deleted only for the current user while other users will continue to see the messages +//@can_be_deleted_for_all_users True, if the chat messages can be deleted for all users +//@can_be_reported True, if the chat can be reported to Telegram moderators through reportChat +//@default_disable_notification Default value of the disable_notification parameter, used when a message is sent to the chat +//@unread_count Number of unread messages in the chat +//@last_read_inbox_message_id Identifier of the last read incoming message +//@last_read_outbox_message_id Identifier of the last read outgoing message +//@unread_mention_count Number of unread messages with a mention/reply in the chat +//@notification_settings Notification settings for this chat +//@action_bar Describes actions which should be possible to do through a chat action bar; may be null +//@reply_markup_message_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 +//@draft_message A draft of a message in the chat; may be null +//@client_data Contains application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used +chat id:int53 type:ChatType title:string photo:chatPhotoInfo permissions:chatPermissions last_message:message positions:vector is_marked_as_unread:Bool is_blocked:Bool has_scheduled_messages:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings action_bar:ChatActionBar reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; + +//@description Represents a list of chats @total_count Approximate total count of chats found @chat_ids List of chat identifiers +chats total_count:int32 chat_ids:vector = Chats; + + +//@description Describes a chat located nearby @chat_id Chat identifier @distance Distance to the chat location, in meters +chatNearby chat_id:int53 distance:int32 = ChatNearby; + +//@description Represents a list of chats located nearby @users_nearby List of users nearby @supergroups_nearby List of location-based supergroups nearby +chatsNearby users_nearby:vector supergroups_nearby:vector = ChatsNearby; + + +//@description Contains a chat invite link @invite_link Chat invite link +chatInviteLink invite_link:string = ChatInviteLink; + +//@description Contains information about a chat invite link +//@chat_id Chat identifier of the invite link; 0 if the user has no access to the chat before joining +//@accessible_for If non-zero, the amount of time for which read access to the chat will remain available, in seconds +//@type Contains information about the type of the chat +//@title Title of the chat +//@photo Chat photo; may be null +//@member_count Number of members in the chat +//@member_user_ids User identifiers of some chat members that may be known to the current user +//@is_public True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup +chatInviteLinkInfo chat_id:int53 accessible_for:int32 type:ChatType title:string photo:chatPhotoInfo member_count:int32 member_user_ids:vector is_public:Bool = ChatInviteLinkInfo; + + +//@class PublicChatType @description Describes a type of public chats + +//@description The chat is public, because it has username +publicChatTypeHasUsername = PublicChatType; + +//@description The chat is public, because it is a location-based supergroup +publicChatTypeIsLocationBased = PublicChatType; + + +//@class ChatActionBar @description Describes actions which should be possible to do through a chat action bar + +//@description The chat can be reported as spam using the method reportChat with the reason chatReportReasonSpam +//@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings +chatActionBarReportSpam can_unarchive:Bool = ChatActionBar; + +//@description The chat is a location-based supergroup, which can be reported as having unrelated location using the method reportChat with the reason chatReportReasonUnrelatedLocation +chatActionBarReportUnrelatedLocation = ChatActionBar; + +//@description The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method blockUser, or the other user can be added to the contact list using the method addContact +//@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings +//@distance If non-negative, the current user was found by the peer through searchChatsNearby and this is the distance between the users +chatActionBarReportAddBlock can_unarchive:Bool distance:int32 = ChatActionBar; + +//@description The chat is a private or secret chat and the other user can be added to the contact list using the method addContact +chatActionBarAddContact = ChatActionBar; + +//@description The chat is a private or secret chat with a mutual contact and the user's phone number can be shared with the other user using the method sharePhoneNumber +chatActionBarSharePhoneNumber = ChatActionBar; + + +//@class KeyboardButtonType @description Describes a keyboard button type + +//@description A simple button, with text that should be sent when the button is pressed +keyboardButtonTypeText = KeyboardButtonType; + +//@description A button that sends the user's phone number when pressed; available only in private chats +keyboardButtonTypeRequestPhoneNumber = KeyboardButtonType; + +//@description A button that sends the user's location when pressed; available only in private chats +keyboardButtonTypeRequestLocation = KeyboardButtonType; + +//@description A button that allows the user to create and send a poll when pressed; available only in private chats @force_regular If true, only regular polls must be allowed to create @force_quiz If true, only polls in quiz mode must be allowed to create +keyboardButtonTypeRequestPoll force_regular:Bool force_quiz:Bool = KeyboardButtonType; + + +//@description Represents a single button in a bot keyboard @text Text of the button @type Type of the button +keyboardButton text:string type:KeyboardButtonType = KeyboardButton; + + +//@class InlineKeyboardButtonType @description Describes the type of an inline keyboard button + +//@description A button that opens a specified URL @url HTTP or tg:// URL to open +inlineKeyboardButtonTypeUrl url:string = InlineKeyboardButtonType; + +//@description A button that opens a specified URL and automatically logs in in current user if they allowed to do that @url An HTTP URL to open @id Unique button identifier @forward_text If non-empty, new text of the button in forwarded messages +inlineKeyboardButtonTypeLoginUrl url:string id:int32 forward_text:string = InlineKeyboardButtonType; + +//@description A button that sends a callback query to a bot @data Data to be sent to the bot via a callback query +inlineKeyboardButtonTypeCallback data:bytes = InlineKeyboardButtonType; + +//@description A button that asks for password of the current user and then sends a callback query to a bot @data Data to be sent to the bot via a callback query +inlineKeyboardButtonTypeCallbackWithPassword data:bytes = InlineKeyboardButtonType; + +//@description A button with a game that sends a 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 +inlineKeyboardButtonTypeCallbackGame = InlineKeyboardButtonType; + +//@description A button that forces an inline query to the bot to be inserted in the input field @query Inline query to be sent to the bot @in_current_chat True, if the inline query should be sent from the current chat +inlineKeyboardButtonTypeSwitchInline query:string in_current_chat:Bool = InlineKeyboardButtonType; + +//@description 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 +inlineKeyboardButtonTypeBuy = InlineKeyboardButtonType; + + +//@description Represents a single button in an inline keyboard @text Text of the button @type Type of the button +inlineKeyboardButton text:string type:InlineKeyboardButtonType = InlineKeyboardButton; + + +//@class ReplyMarkup @description Contains a description of a custom keyboard and actions that can be done with it to quickly reply to bots + +//@description Instructs application 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 +//@is_personal True, if the keyboard is removed only for the mentioned users or the target user of a reply +replyMarkupRemoveKeyboard is_personal:Bool = ReplyMarkup; + +//@description Instructs application to force a reply to this message +//@is_personal 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 +replyMarkupForceReply is_personal:Bool = ReplyMarkup; + +//@description Contains a custom keyboard layout to quickly reply to bots +//@rows A list of rows of bot keyboard buttons +//@resize_keyboard True, if the application needs to resize the keyboard vertically +//@one_time True, if the application needs to hide the keyboard after use +//@is_personal 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 +replyMarkupShowKeyboard rows:vector> resize_keyboard:Bool one_time:Bool is_personal:Bool = ReplyMarkup; + +//@description Contains an inline keyboard layout +//@rows A list of rows of inline keyboard buttons +replyMarkupInlineKeyboard rows:vector> = ReplyMarkup; + + +//@class LoginUrlInfo @description Contains information about an inline button of type inlineKeyboardButtonTypeLoginUrl + +//@description An HTTP url needs to be open @url The URL to open @skip_confirm True, if there is no need to show an ordinary open URL confirm +loginUrlInfoOpen url:string skip_confirm:Bool = LoginUrlInfo; + +//@description An authorization confirmation dialog needs to be shown to the user @url An HTTP URL to be opened @domain A domain of the URL +//@bot_user_id User identifier of a bot linked with the website @request_write_access True, if the user needs to be requested to give the permission to the bot to send them messages +loginUrlInfoRequestConfirmation url:string domain:string bot_user_id:int32 request_write_access:Bool = LoginUrlInfo; + + +//@description Contains information about a message thread +//@chat_id Identifier of the chat to which the message thread belongs +//@message_thread_id Message thread identifier, unique within the chat +//@reply_info Contains information about the message thread +//@messages The messages from which the thread starts. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) +//@draft_message A draft of a message in the message thread; may be null +messageThreadInfo chat_id:int53 message_thread_id:int53 reply_info:messageReplyInfo messages:vector draft_message:draftMessage = MessageThreadInfo; + + +//@class RichText @description Describes a text object inside an instant-view web page + +//@description A plain text @text Text +richTextPlain text:string = RichText; + +//@description A bold rich text @text Text +richTextBold text:RichText = RichText; + +//@description An italicized rich text @text Text +richTextItalic text:RichText = RichText; + +//@description An underlined rich text @text Text +richTextUnderline text:RichText = RichText; + +//@description A strikethrough rich text @text Text +richTextStrikethrough text:RichText = RichText; + +//@description A fixed-width rich text @text Text +richTextFixed text:RichText = RichText; + +//@description A rich text URL link @text Text @url URL @is_cached True, if the URL has cached instant view server-side +richTextUrl text:RichText url:string is_cached:Bool = RichText; + +//@description A rich text email link @text Text @email_address Email address +richTextEmailAddress text:RichText email_address:string = RichText; + +//@description A subscript rich text @text Text +richTextSubscript text:RichText = RichText; + +//@description A superscript rich text @text Text +richTextSuperscript text:RichText = RichText; + +//@description A marked rich text @text Text +richTextMarked text:RichText = RichText; + +//@description A rich text phone number @text Text @phone_number Phone number +richTextPhoneNumber text:RichText phone_number:string = RichText; + +//@description A small image inside the text @document The image represented as a document. The image can be in GIF, JPEG or PNG format +//@width Width of a bounding box in which the image should be shown; 0 if unknown +//@height Height of a bounding box in which the image should be shown; 0 if unknown +richTextIcon document:document width:int32 height:int32 = RichText; + +//@description A reference to a richTexts object on the same web page @text The text @anchor_name The name of a richTextAnchor object, which is the first element of the target richTexts object @url An HTTP URL, opening the reference +richTextReference text:RichText anchor_name:string url:string = RichText; + +//@description An anchor @name Anchor name +richTextAnchor name:string = RichText; + +//@description A link to an anchor on the same web page @text The link text @anchor_name The anchor name. If the name is empty, the link should bring back to top @url An HTTP URL, opening the anchor +richTextAnchorLink text:RichText anchor_name:string url:string = RichText; + +//@description A concatenation of rich texts @texts Texts +richTexts texts:vector = RichText; + + +//@description Contains a caption of an instant view web page block, consisting of a text and a trailing credit @text Content of the caption @credit Block credit (like HTML tag ) +pageBlockCaption text:RichText credit:RichText = PageBlockCaption; + +//@description Describes an item of a list page block @label Item label @page_blocks Item blocks +pageBlockListItem label:string page_blocks:vector = PageBlockListItem; + +//@class PageBlockHorizontalAlignment @description Describes a horizontal alignment of a table cell content + +//@description The content should be left-aligned +pageBlockHorizontalAlignmentLeft = PageBlockHorizontalAlignment; + +//@description The content should be center-aligned +pageBlockHorizontalAlignmentCenter = PageBlockHorizontalAlignment; + +//@description The content should be right-aligned +pageBlockHorizontalAlignmentRight = PageBlockHorizontalAlignment; + +//@class PageBlockVerticalAlignment @description Describes a Vertical alignment of a table cell content + +//@description The content should be top-aligned +pageBlockVerticalAlignmentTop = PageBlockVerticalAlignment; + +//@description The content should be middle-aligned +pageBlockVerticalAlignmentMiddle = PageBlockVerticalAlignment; + +//@description The content should be bottom-aligned +pageBlockVerticalAlignmentBottom = PageBlockVerticalAlignment; + +//@description Represents a cell of a table @text Cell text; may be null. If the text is null, then the cell should be invisible @is_header True, if it is a header cell +//@colspan The number of columns the cell should span @rowspan The number of rows the cell should span +//@align Horizontal cell content alignment @valign Vertical cell content alignment +pageBlockTableCell text:RichText is_header:Bool colspan:int32 rowspan:int32 align:PageBlockHorizontalAlignment valign:PageBlockVerticalAlignment = PageBlockTableCell; + +//@description Contains information about a related article @url Related article URL @title Article title; may be empty @param_description Article description; may be empty +//@photo Article photo; may be null @author Article author; may be empty @publish_date Point in time (Unix timestamp) when the article was published; 0 if unknown +pageBlockRelatedArticle url:string title:string description:string photo:photo author:string publish_date:int32 = PageBlockRelatedArticle; + + +//@class PageBlock @description Describes a block of an instant view web page + +//@description The title of a page @title Title +pageBlockTitle title:RichText = PageBlock; + +//@description The subtitle of a page @subtitle Subtitle +pageBlockSubtitle subtitle:RichText = PageBlock; + +//@description The author and publishing date of a page @author Author @publish_date Point in time (Unix timestamp) when the article was published; 0 if unknown +pageBlockAuthorDate author:RichText publish_date:int32 = PageBlock; + +//@description A header @header Header +pageBlockHeader header:RichText = PageBlock; + +//@description A subheader @subheader Subheader +pageBlockSubheader subheader:RichText = PageBlock; + +//@description A kicker @kicker Kicker +pageBlockKicker kicker:RichText = PageBlock; + +//@description A text paragraph @text Paragraph text +pageBlockParagraph text:RichText = PageBlock; + +//@description A preformatted text paragraph @text Paragraph text @language Programming language for which the text should be formatted +pageBlockPreformatted text:RichText language:string = PageBlock; + +//@description The footer of a page @footer Footer +pageBlockFooter footer:RichText = PageBlock; + +//@description An empty block separating a page +pageBlockDivider = PageBlock; + +//@description An invisible anchor on a page, which can be used in a URL to open the page from the specified anchor @name Name of the anchor +pageBlockAnchor name:string = PageBlock; + +//@description A list of data blocks @items The items of the list +pageBlockList items:vector = PageBlock; + +//@description A block quote @text Quote text @credit Quote credit +pageBlockBlockQuote text:RichText credit:RichText = PageBlock; + +//@description A pull quote @text Quote text @credit Quote credit +pageBlockPullQuote text:RichText credit:RichText = PageBlock; + +//@description An animation @animation Animation file; may be null @caption Animation caption @need_autoplay True, if the animation should be played automatically +pageBlockAnimation animation:animation caption:pageBlockCaption need_autoplay:Bool = PageBlock; + +//@description An audio file @audio Audio file; may be null @caption Audio file caption +pageBlockAudio audio:audio caption:pageBlockCaption = PageBlock; + +//@description A photo @photo Photo file; may be null @caption Photo caption @url URL that needs to be opened when the photo is clicked +pageBlockPhoto photo:photo caption:pageBlockCaption url:string = PageBlock; + +//@description A video @video Video file; may be null @caption Video caption @need_autoplay True, if the video should be played automatically @is_looped True, if the video should be looped +pageBlockVideo video:video caption:pageBlockCaption need_autoplay:Bool is_looped:Bool = PageBlock; + +//@description A voice note @voice_note Voice note; may be null @caption Voice note caption +pageBlockVoiceNote voice_note:voiceNote caption:pageBlockCaption = PageBlock; + +//@description A page cover @cover Cover +pageBlockCover cover:PageBlock = PageBlock; + +//@description An embedded web page @url Web page URL, if available @html HTML-markup of the embedded page @poster_photo Poster photo, if available; may be null @width Block width; 0 if unknown @height Block height; 0 if unknown @caption Block caption @is_full_width True, if the block should be full width @allow_scrolling True, if scrolling should be allowed +pageBlockEmbedded url:string html:string poster_photo:photo width:int32 height:int32 caption:pageBlockCaption is_full_width:Bool allow_scrolling:Bool = PageBlock; + +//@description An embedded post @url Web page URL @author Post author @author_photo Post author photo; may be null @date Point in time (Unix timestamp) when the post was created; 0 if unknown @page_blocks Post content @caption Post caption +pageBlockEmbeddedPost url:string author:string author_photo:photo date:int32 page_blocks:vector caption:pageBlockCaption = PageBlock; + +//@description A collage @page_blocks Collage item contents @caption Block caption +pageBlockCollage page_blocks:vector caption:pageBlockCaption = PageBlock; + +//@description A slideshow @page_blocks Slideshow item contents @caption Block caption +pageBlockSlideshow page_blocks:vector caption:pageBlockCaption = PageBlock; + +//@description A link to a chat @title Chat title @photo Chat photo; may be null @username Chat username, by which all other information about the chat should be resolved +pageBlockChatLink title:string photo:chatPhotoInfo username:string = PageBlock; + +//@description A table @caption Table caption @cells Table cells @is_bordered True, if the table is bordered @is_striped True, if the table is striped +pageBlockTable caption:RichText cells:vector> is_bordered:Bool is_striped:Bool = PageBlock; + +//@description A collapsible block @header Always visible heading for the block @page_blocks Block contents @is_open True, if the block is open by default +pageBlockDetails header:RichText page_blocks:vector is_open:Bool = PageBlock; + +//@description Related articles @header Block header @articles List of related articles +pageBlockRelatedArticles header:RichText articles:vector = PageBlock; + +//@description A map @location Location of the map center @zoom Map zoom level @width Map width @height Map height @caption Block caption +pageBlockMap location:location zoom:int32 width:int32 height:int32 caption:pageBlockCaption = PageBlock; + + +//@description Describes an instant view page for a web page +//@page_blocks Content of the web page +//@view_count Number of the instant view views; 0 if unknown +//@version Version of the instant view, currently can be 1 or 2 +//@is_rtl True, if the instant view must be shown from right to left +//@is_full True, if the instant view contains the full page. A network request might be needed to get the full web page instant view +webPageInstantView page_blocks:vector view_count:int32 version:int32 is_rtl:Bool is_full:Bool = WebPageInstantView; + + +//@description Describes a web page preview +//@url Original URL of the link +//@display_url URL to display +//@type Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else +//@site_name Short name of the site (e.g., Google Docs, App Store) +//@title Title of the content +//@param_description Description of the content +//@photo Image representing the content; may be null +//@embed_url URL to show in the embedded preview +//@embed_type MIME type of the embedded preview, (e.g., text/html or video/mp4) +//@embed_width Width of the embedded preview +//@embed_height Height of the embedded preview +//@duration Duration of the content, in seconds +//@author Author of the content +//@animation Preview of the content as an animation, if available; may be null +//@audio Preview of the content as an audio file, if available; may be null +//@document Preview of the content as a document, if available (currently only available for small PDF files and ZIP archives); may be null +//@sticker Preview of the content as a sticker for small WEBP files, if available; may be null +//@video Preview of the content as a video, if available; may be null +//@video_note Preview of the content as a video note, if available; may be null +//@voice_note Preview of the content as a voice note, if available; may be null +//@instant_view_version Version of instant view, available for the web page (currently can be 1 or 2), 0 if none +webPage url:string display_url:string type:string site_name:string title:string description:formattedText photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote instant_view_version:int32 = WebPage; + + +//@description Contains information about a country +//@country_code A two-letter ISO 3166-1 alpha-2 country code +//@name Native name of the country +//@english_name English name of the country +//@is_hidden True, if the country should be hidden from the list of all countries +//@calling_codes List of country calling codes +countryInfo country_code:string name:string english_name:string is_hidden:Bool calling_codes:vector = CountryInfo; + +//@description Contains information about countries @countries The list of countries +countries countries:vector = Countries; + +//@description Contains information about a phone number +//@country Information about the country to which the phone number belongs; may be null +//@country_calling_code The part of the phone number denoting country calling code or its part +//@formatted_phone_number The phone number without country calling code formatted accordingly to local rules +phoneNumberInfo country:countryInfo country_calling_code:string formatted_phone_number:string = PhoneNumberInfo; + + +//@description Describes an action associated with a bank card number @text Action text @url The URL to be opened +bankCardActionOpenUrl text:string url:string = BankCardActionOpenUrl; + +//@description Information about a bank card @title Title of the bank card description @actions Actions that can be done with the bank card number +bankCardInfo title:string actions:vector = BankCardInfo; + + +//@description Describes an address @country_code A two-letter ISO 3166-1 alpha-2 country code @state State, if applicable @city City @street_line1 First line of the address @street_line2 Second line of the address @postal_code Address postal code +address country_code:string state:string city:string street_line1:string street_line2:string postal_code:string = Address; + + +//@description Portion of the price of a product (e.g., "delivery cost", "tax amount") @label Label for this portion of the product price @amount Currency amount in minimal quantity of the currency +labeledPricePart label:string amount:int53 = LabeledPricePart; + +//@description Product invoice @currency ISO 4217 currency code @price_parts A list of objects used to calculate the total price of the product @is_test True, if the payment is a test payment +//@need_name True, if the user's name is needed for payment @need_phone_number True, if the user's phone number is needed for payment @need_email_address True, if the user's email address is needed for payment +//@need_shipping_address True, if the user's shipping address is needed for payment @send_phone_number_to_provider True, if the user's phone number will be sent to the provider +//@send_email_address_to_provider True, if the user's email address will be sent to the provider @is_flexible True, if the total price depends on the shipping method +invoice currency:string price_parts:vector is_test:Bool need_name:Bool need_phone_number:Bool need_email_address:Bool need_shipping_address:Bool send_phone_number_to_provider:Bool send_email_address_to_provider:Bool is_flexible:Bool = Invoice; + +//@description Order information @name Name of the user @phone_number Phone number of the user @email_address Email address of the user @shipping_address Shipping address for this order; may be null +orderInfo name:string phone_number:string email_address:string shipping_address:address = OrderInfo; + +//@description One shipping option @id Shipping option identifier @title Option title @price_parts A list of objects used to calculate the total shipping costs +shippingOption id:string title:string price_parts:vector = ShippingOption; + +//@description Contains information about saved card credentials @id Unique identifier of the saved credentials @title Title of the saved credentials +savedCredentials id:string title:string = SavedCredentials; + +//@class InputCredentials @description Contains information about the payment method chosen by the user + +//@description Applies if a user chooses some previously saved payment credentials. To use their previously saved credentials, the user must have a valid temporary password @saved_credentials_id Identifier of the saved credentials +inputCredentialsSaved saved_credentials_id:string = InputCredentials; + +//@description Applies if a user enters new credentials on a payment provider website @data Contains JSON-encoded data with a credential identifier from the payment provider @allow_save True, if the credential identifier can be saved on the server side +inputCredentialsNew data:string allow_save:Bool = InputCredentials; + +//@description Applies if a user enters new credentials using Android Pay @data JSON-encoded data with the credential identifier +inputCredentialsAndroidPay data:string = InputCredentials; + +//@description Applies if a user enters new credentials using Apple Pay @data JSON-encoded data with the credential identifier +inputCredentialsApplePay data:string = InputCredentials; + +//@description Stripe payment provider @publishable_key Stripe API publishable key @need_country True, if the user country must be provided @need_postal_code True, if the user ZIP/postal code must be provided @need_cardholder_name True, if the cardholder name must be provided +paymentsProviderStripe publishable_key:string need_country:Bool need_postal_code:Bool need_cardholder_name:Bool = PaymentsProviderStripe; + +//@description Contains information about an invoice payment form @invoice Full information of the invoice @url Payment form URL @payments_provider Contains information about the payment provider, if available, to support it natively without the need for opening the URL; may be null +//@saved_order_info Saved server-side order information; may be null @saved_credentials Contains information about saved card credentials; may be null @can_save_credentials True, if the user can choose to save credentials @need_password True, if the user will be able to save credentials protected by a password they set up +paymentForm invoice:invoice url:string payments_provider:paymentsProviderStripe saved_order_info:orderInfo saved_credentials:savedCredentials can_save_credentials:Bool need_password:Bool = PaymentForm; + +//@description Contains a temporary identifier of validated order information, which is stored for one hour. Also contains the available shipping options @order_info_id Temporary identifier of the order information @shipping_options Available shipping options +validatedOrderInfo order_info_id:string shipping_options:vector = ValidatedOrderInfo; + +//@description Contains the result of a payment request @success True, if the payment request was successful; otherwise the verification_url will be not empty @verification_url URL for additional payment credentials verification +paymentResult success:Bool verification_url:string = PaymentResult; + +//@description Contains information about a successful payment @date Point in time (Unix timestamp) when the payment was made @payments_provider_user_id User identifier of the payment provider bot @invoice Contains information about the invoice +//@order_info Contains order information; may be null @shipping_option Chosen shipping option; may be null @credentials_title Title of the saved credentials +paymentReceipt date:int32 payments_provider_user_id:int32 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string = PaymentReceipt; + + +//@description File with the date it was uploaded @file The file @date Point in time (Unix timestamp) when the file was uploaded +datedFile file:file date:int32 = DatedFile; + + +//@class PassportElementType @description Contains the type of a Telegram Passport element + +//@description A Telegram Passport element containing the user's personal details +passportElementTypePersonalDetails = PassportElementType; + +//@description A Telegram Passport element containing the user's passport +passportElementTypePassport = PassportElementType; + +//@description A Telegram Passport element containing the user's driver license +passportElementTypeDriverLicense = PassportElementType; + +//@description A Telegram Passport element containing the user's identity card +passportElementTypeIdentityCard = PassportElementType; + +//@description A Telegram Passport element containing the user's internal passport +passportElementTypeInternalPassport = PassportElementType; + +//@description A Telegram Passport element containing the user's address +passportElementTypeAddress = PassportElementType; + +//@description A Telegram Passport element containing the user's utility bill +passportElementTypeUtilityBill = PassportElementType; + +//@description A Telegram Passport element containing the user's bank statement +passportElementTypeBankStatement = PassportElementType; + +//@description A Telegram Passport element containing the user's rental agreement +passportElementTypeRentalAgreement = PassportElementType; + +//@description A Telegram Passport element containing the registration page of the user's passport +passportElementTypePassportRegistration = PassportElementType; + +//@description A Telegram Passport element containing the user's temporary registration +passportElementTypeTemporaryRegistration = PassportElementType; + +//@description A Telegram Passport element containing the user's phone number +passportElementTypePhoneNumber = PassportElementType; + +//@description A Telegram Passport element containing the user's email address +passportElementTypeEmailAddress = PassportElementType; + + +//@description Represents a date according to the Gregorian calendar @day Day of the month, 1-31 @month Month, 1-12 @year Year, 1-9999 +date day:int32 month:int32 year:int32 = Date; + +//@description Contains the user's personal details +//@first_name First name of the user written in English; 1-255 characters @middle_name Middle name of the user written in English; 0-255 characters @last_name Last name of the user written in English; 1-255 characters +//@native_first_name Native first name of the user; 1-255 characters @native_middle_name Native middle name of the user; 0-255 characters @native_last_name Native last name of the user; 1-255 characters +//@birthdate Birthdate of the user @gender Gender of the user, "male" or "female" @country_code A two-letter ISO 3166-1 alpha-2 country code of the user's country @residence_country_code A two-letter ISO 3166-1 alpha-2 country code of the user's residence country +personalDetails first_name:string middle_name:string last_name:string native_first_name:string native_middle_name:string native_last_name:string birthdate:date gender:string country_code:string residence_country_code:string = PersonalDetails; + +//@description An identity document @number Document number; 1-24 characters @expiry_date Document expiry date; may be null @front_side Front side of the document +//@reverse_side Reverse side of the document; only for driver license and identity card @selfie Selfie with the document; may be null @translation List of files containing a certified English translation of the document +identityDocument number:string expiry_date:date front_side:datedFile reverse_side:datedFile selfie:datedFile translation:vector = IdentityDocument; + +//@description An identity document to be saved to Telegram Passport @number Document number; 1-24 characters @expiry_date Document expiry date, if available @front_side Front side of the document +//@reverse_side Reverse side of the document; only for driver license and identity card @selfie Selfie with the document, if available @translation List of files containing a certified English translation of the document +inputIdentityDocument number:string expiry_date:date front_side:InputFile reverse_side:InputFile selfie:InputFile translation:vector = InputIdentityDocument; + +//@description A personal document, containing some information about a user @files List of files containing the pages of the document @translation List of files containing a certified English translation of the document +personalDocument files:vector translation:vector = PersonalDocument; + +//@description A personal document to be saved to Telegram Passport @files List of files containing the pages of the document @translation List of files containing a certified English translation of the document +inputPersonalDocument files:vector translation:vector = InputPersonalDocument; + + +//@class PassportElement @description Contains information about a Telegram Passport element + +//@description A Telegram Passport element containing the user's personal details @personal_details Personal details of the user +passportElementPersonalDetails personal_details:personalDetails = PassportElement; + +//@description A Telegram Passport element containing the user's passport @passport Passport +passportElementPassport passport:identityDocument = PassportElement; + +//@description A Telegram Passport element containing the user's driver license @driver_license Driver license +passportElementDriverLicense driver_license:identityDocument = PassportElement; + +//@description A Telegram Passport element containing the user's identity card @identity_card Identity card +passportElementIdentityCard identity_card:identityDocument = PassportElement; + +//@description A Telegram Passport element containing the user's internal passport @internal_passport Internal passport +passportElementInternalPassport internal_passport:identityDocument = PassportElement; + +//@description A Telegram Passport element containing the user's address @address Address +passportElementAddress address:address = PassportElement; + +//@description A Telegram Passport element containing the user's utility bill @utility_bill Utility bill +passportElementUtilityBill utility_bill:personalDocument = PassportElement; + +//@description A Telegram Passport element containing the user's bank statement @bank_statement Bank statement +passportElementBankStatement bank_statement:personalDocument = PassportElement; + +//@description A Telegram Passport element containing the user's rental agreement @rental_agreement Rental agreement +passportElementRentalAgreement rental_agreement:personalDocument = PassportElement; + +//@description A Telegram Passport element containing the user's passport registration pages @passport_registration Passport registration pages +passportElementPassportRegistration passport_registration:personalDocument = PassportElement; + +//@description A Telegram Passport element containing the user's temporary registration @temporary_registration Temporary registration +passportElementTemporaryRegistration temporary_registration:personalDocument = PassportElement; + +//@description A Telegram Passport element containing the user's phone number @phone_number Phone number +passportElementPhoneNumber phone_number:string = PassportElement; + +//@description A Telegram Passport element containing the user's email address @email_address Email address +passportElementEmailAddress email_address:string = PassportElement; + + +//@class InputPassportElement @description Contains information about a Telegram Passport element to be saved + +//@description A Telegram Passport element to be saved containing the user's personal details @personal_details Personal details of the user +inputPassportElementPersonalDetails personal_details:personalDetails = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's passport @passport The passport to be saved +inputPassportElementPassport passport:inputIdentityDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's driver license @driver_license The driver license to be saved +inputPassportElementDriverLicense driver_license:inputIdentityDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's identity card @identity_card The identity card to be saved +inputPassportElementIdentityCard identity_card:inputIdentityDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's internal passport @internal_passport The internal passport to be saved +inputPassportElementInternalPassport internal_passport:inputIdentityDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's address @address The address to be saved +inputPassportElementAddress address:address = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's utility bill @utility_bill The utility bill to be saved +inputPassportElementUtilityBill utility_bill:inputPersonalDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's bank statement @bank_statement The bank statement to be saved +inputPassportElementBankStatement bank_statement:inputPersonalDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's rental agreement @rental_agreement The rental agreement to be saved +inputPassportElementRentalAgreement rental_agreement:inputPersonalDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's passport registration @passport_registration The passport registration page to be saved +inputPassportElementPassportRegistration passport_registration:inputPersonalDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's temporary registration @temporary_registration The temporary registration document to be saved +inputPassportElementTemporaryRegistration temporary_registration:inputPersonalDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's phone number @phone_number The phone number to be saved +inputPassportElementPhoneNumber phone_number:string = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's email address @email_address The email address to be saved +inputPassportElementEmailAddress email_address:string = InputPassportElement; + + +//@description Contains information about saved Telegram Passport elements @elements Telegram Passport elements +passportElements elements:vector = PassportElements; + + +//@class PassportElementErrorSource @description Contains the description of an error in a Telegram Passport element + +//@description The element contains an error in an unspecified place. The error will be considered resolved when new data is added +passportElementErrorSourceUnspecified = PassportElementErrorSource; + +//@description One of the data fields contains an error. The error will be considered resolved when the value of the field changes @field_name Field name +passportElementErrorSourceDataField field_name:string = PassportElementErrorSource; + +//@description The front side of the document contains an error. The error will be considered resolved when the file with the front side changes +passportElementErrorSourceFrontSide = PassportElementErrorSource; + +//@description The reverse side of the document contains an error. The error will be considered resolved when the file with the reverse side changes +passportElementErrorSourceReverseSide = PassportElementErrorSource; + +//@description The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes +passportElementErrorSourceSelfie = PassportElementErrorSource; + +//@description One of files with the translation of the document contains an error. The error will be considered resolved when the file changes @file_index Index of a file with the error +passportElementErrorSourceTranslationFile file_index:int32 = PassportElementErrorSource; + +//@description The translation of the document contains an error. The error will be considered resolved when the list of translation files changes +passportElementErrorSourceTranslationFiles = PassportElementErrorSource; + +//@description The file contains an error. The error will be considered resolved when the file changes @file_index Index of a file with the error +passportElementErrorSourceFile file_index:int32 = PassportElementErrorSource; + +//@description The list of attached files contains an error. The error will be considered resolved when the list of files changes +passportElementErrorSourceFiles = PassportElementErrorSource; + + +//@description Contains the description of an error in a Telegram Passport element @type Type of the Telegram Passport element which has the error @message Error message @source Error source +passportElementError type:PassportElementType message:string source:PassportElementErrorSource = PassportElementError; + + +//@description Contains information about a Telegram Passport element that was requested by a service @type Type of the element @is_selfie_required True, if a selfie is required with the identity document +//@is_translation_required True, if a certified English translation is required with the document @is_native_name_required True, if personal details must include the user's name in the language of their country of residence +passportSuitableElement type:PassportElementType is_selfie_required:Bool is_translation_required:Bool is_native_name_required:Bool = PassportSuitableElement; + +//@description Contains a description of the required Telegram Passport element that was requested by a service @suitable_elements List of Telegram Passport elements any of which is enough to provide +passportRequiredElement suitable_elements:vector = PassportRequiredElement; + +//@description Contains information about a Telegram Passport authorization form that was requested @id Unique identifier of the authorization form +//@required_elements Information about the Telegram Passport elements that must be provided to complete the form +//@privacy_policy_url URL for the privacy policy of the service; may be empty +passportAuthorizationForm id:int32 required_elements:vector privacy_policy_url:string = PassportAuthorizationForm; + +//@description Contains information about a Telegram Passport elements and corresponding errors @elements Telegram Passport elements @errors Errors in the elements that are already available +passportElementsWithErrors elements:vector errors:vector = PassportElementsWithErrors; + + +//@description Contains encrypted Telegram Passport data credentials @data The encrypted credentials @hash The decrypted data hash @secret Secret for data decryption, encrypted with the service's public key +encryptedCredentials data:bytes hash:bytes secret:bytes = EncryptedCredentials; + + +//@description Contains information about an encrypted Telegram Passport element; for bots only @type Type of Telegram Passport element @data Encrypted JSON-encoded data about the user @front_side The front side of an identity document @reverse_side The reverse side of an identity document; may be null @selfie Selfie with the document; may be null @translation List of files containing a certified English translation of the document @files List of attached files @value Unencrypted data, phone number or email address @hash Hash of the entire element +encryptedPassportElement type:PassportElementType data:bytes front_side:datedFile reverse_side:datedFile selfie:datedFile translation:vector files:vector value:string hash:string = EncryptedPassportElement; + + +//@class InputPassportElementErrorSource @description Contains the description of an error in a Telegram Passport element; for bots only + +//@description The element contains an error in an unspecified place. The error will be considered resolved when new data is added @element_hash Current hash of the entire element +inputPassportElementErrorSourceUnspecified element_hash:bytes = InputPassportElementErrorSource; + +//@description A data field contains an error. The error is considered resolved when the field's value changes @field_name Field name @data_hash Current data hash +inputPassportElementErrorSourceDataField field_name:string data_hash:bytes = InputPassportElementErrorSource; + +//@description 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 @file_hash Current hash of the file containing the front side +inputPassportElementErrorSourceFrontSide file_hash:bytes = InputPassportElementErrorSource; + +//@description 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 @file_hash Current hash of the file containing the reverse side +inputPassportElementErrorSourceReverseSide file_hash:bytes = InputPassportElementErrorSource; + +//@description The selfie contains an error. The error is considered resolved when the file with the selfie changes @file_hash Current hash of the file containing the selfie +inputPassportElementErrorSourceSelfie file_hash:bytes = InputPassportElementErrorSource; + +//@description 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 @file_hash Current hash of the file containing the translation +inputPassportElementErrorSourceTranslationFile file_hash:bytes = InputPassportElementErrorSource; + +//@description The translation of the document contains an error. The error is considered resolved when the list of files changes @file_hashes Current hashes of all files with the translation +inputPassportElementErrorSourceTranslationFiles file_hashes:vector = InputPassportElementErrorSource; + +//@description The file contains an error. The error is considered resolved when the file changes @file_hash Current hash of the file which has the error +inputPassportElementErrorSourceFile file_hash:bytes = InputPassportElementErrorSource; + +//@description The list of attached files contains an error. The error is considered resolved when the file list changes @file_hashes Current hashes of all attached files +inputPassportElementErrorSourceFiles file_hashes:vector = InputPassportElementErrorSource; + + +//@description Contains the description of an error in a Telegram Passport element; for bots only @type Type of Telegram Passport element that has the error @message Error message @source Error source +inputPassportElementError type:PassportElementType message:string source:InputPassportElementErrorSource = InputPassportElementError; + + +//@class MessageContent @description Contains the content of a message + +//@description A text message @text Text of the message @web_page A preview of the web page that's mentioned in the text; may be null +messageText text:formattedText web_page:webPage = MessageContent; + +//@description An animation message (GIF-style). @animation The animation description @caption Animation caption @is_secret True, if the animation thumbnail must be blurred and the animation must be shown only while tapped +messageAnimation animation:animation caption:formattedText is_secret:Bool = MessageContent; + +//@description An audio message @audio The audio description @caption Audio caption +messageAudio audio:audio caption:formattedText = MessageContent; + +//@description A document message (general file) @document The document description @caption Document caption +messageDocument document:document caption:formattedText = MessageContent; + +//@description A photo message @photo The photo description @caption Photo caption @is_secret True, if the photo must be blurred and must be shown only while tapped +messagePhoto photo:photo caption:formattedText is_secret:Bool = MessageContent; + +//@description An expired photo message (self-destructed after TTL has elapsed) +messageExpiredPhoto = MessageContent; + +//@description A sticker message @sticker The sticker description +messageSticker sticker:sticker = MessageContent; + +//@description A video message @video The video description @caption Video caption @is_secret True, if the video thumbnail must be blurred and the video must be shown only while tapped +messageVideo video:video caption:formattedText is_secret:Bool = MessageContent; + +//@description An expired video message (self-destructed after TTL has elapsed) +messageExpiredVideo = MessageContent; + +//@description A video note message @video_note The video note description @is_viewed True, if at least one of the recipients has viewed the video note @is_secret True, if the video note thumbnail must be blurred and the video note must be shown only while tapped +messageVideoNote video_note:videoNote is_viewed:Bool is_secret:Bool = MessageContent; + +//@description A voice note message @voice_note The voice note description @caption Voice note caption @is_listened True, if at least one of the recipients has listened to the voice note +messageVoiceNote voice_note:voiceNote caption:formattedText is_listened:Bool = MessageContent; + +//@description A message with a location @location The location description @live_period Time relative to the message send date, for which the location can be updated, in seconds +//@expires_in Left time for which the location can be updated, in seconds. updateMessageContent is not sent when this field changes +//@heading For live locations, a direction in which the location moves, in degrees; 1-360. If 0 the direction is unknown +//@proximity_alert_radius For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). 0 if the notification is disabled. Available only for the message sender +messageLocation location:location live_period:int32 expires_in:int32 heading:int32 proximity_alert_radius:int32 = MessageContent; + +//@description A message with information about a venue @venue The venue description +messageVenue venue:venue = MessageContent; + +//@description A message with a user contact @contact The contact description +messageContact contact:contact = MessageContent; + +//@description A dice message. The dice value is randomly generated by the server +//@initial_state The animated stickers with the initial dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known +//@final_state The animated stickers with the final dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known +//@emoji Emoji on which the dice throw animation is based +//@value The dice value. If the value is 0, the dice don't have final state yet +//@success_animation_frame_number Number of frame after which a success animation like a shower of confetti needs to be shown on updateMessageSendSucceeded +messageDice initial_state:DiceStickers final_state:DiceStickers emoji:string value:int32 success_animation_frame_number:int32 = MessageContent; + +//@description A message with a game @game The game description +messageGame game:game = MessageContent; + +//@description A message with a poll @poll The poll description +messagePoll poll:poll = MessageContent; + +//@description A message with an invoice from a bot @title Product title @param_description Product description @photo Product photo; may be null @currency Currency for the product price @total_amount Product total price in the minimal quantity of the currency +//@start_parameter Unique invoice bot start_parameter. To share an invoice use the URL https://t.me/{bot_username}?start={start_parameter} @is_test True, if the invoice is a test invoice +//@need_shipping_address True, if the shipping address should be specified @receipt_message_id The identifier of the message with the receipt, after the product has been purchased +messageInvoice title:string description:string photo:photo currency:string total_amount:int53 start_parameter:string is_test:Bool need_shipping_address:Bool receipt_message_id:int53 = MessageContent; + +//@description A message with information about an ended call @is_video True, if the call was a video call @discard_reason Reason why the call was discarded @duration Call duration, in seconds +messageCall is_video:Bool discard_reason:CallDiscardReason duration:int32 = MessageContent; + +//@description A newly created basic group @title Title of the basic group @member_user_ids User identifiers of members in the basic group +messageBasicGroupChatCreate title:string member_user_ids:vector = MessageContent; + +//@description A newly created supergroup or channel @title Title of the supergroup or channel +messageSupergroupChatCreate title:string = MessageContent; + +//@description An updated chat title @title New chat title +messageChatChangeTitle title:string = MessageContent; + +//@description An updated chat photo @photo New chat photo +messageChatChangePhoto photo:chatPhoto = MessageContent; + +//@description A deleted chat photo +messageChatDeletePhoto = MessageContent; + +//@description New chat members were added @member_user_ids User identifiers of the new members +messageChatAddMembers member_user_ids:vector = MessageContent; + +//@description A new member joined the chat by invite link +messageChatJoinByLink = MessageContent; + +//@description A chat member was deleted @user_id User identifier of the deleted chat member +messageChatDeleteMember user_id:int32 = MessageContent; + +//@description A basic group was upgraded to a supergroup and was deactivated as the result @supergroup_id Identifier of the supergroup to which the basic group was upgraded +messageChatUpgradeTo supergroup_id:int32 = MessageContent; + +//@description A supergroup has been created from a basic group @title Title of the newly created supergroup @basic_group_id The identifier of the original basic group +messageChatUpgradeFrom title:string basic_group_id:int32 = MessageContent; + +//@description A message has been pinned @message_id Identifier of the pinned message, can be an identifier of a deleted message or 0 +messagePinMessage message_id:int53 = MessageContent; + +//@description A screenshot of a message in the chat has been taken +messageScreenshotTaken = MessageContent; + +//@description The TTL (Time To Live) setting messages in a secret chat has been changed @ttl New TTL +messageChatSetTtl ttl:int32 = MessageContent; + +//@description A non-standard action has happened in the chat @text Message text to be shown in the chat +messageCustomServiceAction text:string = MessageContent; + +//@description A new high score was achieved in a game @game_message_id Identifier of the message with the game, can be an identifier of a deleted message @game_id Identifier of the game; may be different from the games presented in the message with the game @score New score +messageGameScore game_message_id:int53 game_id:int64 score:int32 = MessageContent; + +//@description A payment has been completed @invoice_message_id Identifier of the message with the corresponding invoice; can be an identifier of a deleted message @currency Currency for the price of the product @total_amount Total price for the product, in the minimal quantity of the currency +messagePaymentSuccessful invoice_message_id:int53 currency:string total_amount:int53 = MessageContent; + +//@description A payment has been completed; for bots only @invoice_message_id Identifier of the message with the corresponding invoice; can be an identifier of a deleted message @currency Currency for price of the product +//@total_amount Total price for the product, in the minimal quantity of the currency @invoice_payload Invoice payload @shipping_option_id Identifier of the shipping option chosen by the user; may be empty if not applicable @order_info Information about the order; may be null +//@telegram_payment_charge_id Telegram payment identifier @provider_payment_charge_id Provider payment identifier +messagePaymentSuccessfulBot invoice_message_id:int53 currency:string total_amount:int53 invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; + +//@description A contact has registered with Telegram +messageContactRegistered = MessageContent; + +//@description The current user has connected a website by logging in using Telegram Login Widget on it @domain_name Domain name of the connected website +messageWebsiteConnected domain_name:string = MessageContent; + +//@description Telegram Passport data has been sent @types List of Telegram Passport element types sent +messagePassportDataSent types:vector = MessageContent; + +//@description Telegram Passport data has been received; for bots only @elements List of received Telegram Passport elements @credentials Encrypted data credentials +messagePassportDataReceived elements:vector credentials:encryptedCredentials = MessageContent; + +//@description A user in the chat came within proximity alert range @traveler The user or chat, which triggered the proximity alert @watcher The user or chat, which subscribed for the proximity alert @distance The distance between the users +messageProximityAlertTriggered traveler:MessageSender watcher:MessageSender distance:int32 = MessageContent; + +//@description Message content that is not supported in the current TDLib version +messageUnsupported = MessageContent; + + +//@class TextEntityType @description Represents a part of the text which must be formatted differently + +//@description A mention of a user by their username +textEntityTypeMention = TextEntityType; + +//@description A hashtag text, beginning with "#" +textEntityTypeHashtag = TextEntityType; + +//@description A cashtag text, beginning with "$" and consisting of capital english letters (i.e. "$USD") +textEntityTypeCashtag = TextEntityType; + +//@description A bot command, beginning with "/". This shouldn't be highlighted if there are no bots in the chat +textEntityTypeBotCommand = TextEntityType; + +//@description An HTTP URL +textEntityTypeUrl = TextEntityType; + +//@description An email address +textEntityTypeEmailAddress = TextEntityType; + +//@description A phone number +textEntityTypePhoneNumber = TextEntityType; + +//@description A bank card number. The getBankCardInfo method can be used to get information about the bank card +textEntityTypeBankCardNumber = TextEntityType; + +//@description A bold text +textEntityTypeBold = TextEntityType; + +//@description An italic text +textEntityTypeItalic = TextEntityType; + +//@description An underlined text +textEntityTypeUnderline = TextEntityType; + +//@description A strikethrough text +textEntityTypeStrikethrough = TextEntityType; + +//@description Text that must be formatted as if inside a code HTML tag +textEntityTypeCode = TextEntityType; + +//@description Text that must be formatted as if inside a pre HTML tag +textEntityTypePre = TextEntityType; + +//@description Text that must be formatted as if inside pre, and code HTML tags @language Programming language of the code; as defined by the sender +textEntityTypePreCode language:string = TextEntityType; + +//@description A text description shown instead of a raw URL @url HTTP or tg:// URL to be opened when the link is clicked +textEntityTypeTextUrl url:string = TextEntityType; + +//@description A text shows instead of a raw mention of the user (e.g., when the user has no username) @user_id Identifier of the mentioned user +textEntityTypeMentionName user_id:int32 = TextEntityType; + + +//@description A thumbnail to be sent along with a file; must be in JPEG or WEBP format for stickers, and less than 200 KB in size @thumbnail Thumbnail file to send. Sending thumbnails by file_id is currently not supported +//@width Thumbnail width, usually shouldn't exceed 320. Use 0 if unknown @height Thumbnail height, usually shouldn't exceed 320. Use 0 if unknown +inputThumbnail thumbnail:InputFile width:int32 height:int32 = InputThumbnail; + + +//@class MessageSchedulingState @description Contains information about the time when a scheduled message will be sent + +//@description The message will be sent at the specified date @send_date Date the message will be sent. The date must be within 367 days in the future +messageSchedulingStateSendAtDate send_date:int32 = MessageSchedulingState; + +//@description The message will be sent when the peer will be online. Applicable to private chats only and when the exact online status of the peer is known +messageSchedulingStateSendWhenOnline = MessageSchedulingState; + + +//@description Options to be used when a message is sent +//@disable_notification Pass true to disable notification for the message +//@from_background Pass true if the message is sent from the background +//@scheduling_state Message scheduling state. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled +messageSendOptions disable_notification:Bool from_background:Bool scheduling_state:MessageSchedulingState = MessageSendOptions; + +//@description Options to be used when a message content is copied without a link to the original message +//@send_copy 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 +//@replace_caption True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false +//@new_caption New message caption. Ignored if replace_caption is false +messageCopyOptions send_copy:Bool replace_caption:Bool new_caption:formattedText = MessageCopyOptions; + + +//@class InputMessageContent @description The content of a message to send + +//@description A text message @text Formatted text to be sent; 1-GetOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually +//@disable_web_page_preview True, if rich web page previews for URLs in the message text should be disabled @clear_draft True, if a chat message draft should be deleted +inputMessageText text:formattedText disable_web_page_preview:Bool clear_draft:Bool = InputMessageContent; + +//@description An animation message (GIF-style). @animation Animation file to be sent @thumbnail Animation thumbnail, if available @added_sticker_file_ids File identifiers of the stickers added to the animation, if applicable +//@duration Duration of the animation, in seconds @width Width of the animation; may be replaced by the server @height Height of the animation; may be replaced by the server @caption Animation caption; 0-GetOption("message_caption_length_max") characters +inputMessageAnimation animation:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 caption:formattedText = InputMessageContent; + +//@description An audio message @audio Audio file to be sent @album_cover_thumbnail Thumbnail of the cover for the album, if available @duration Duration of the audio, in seconds; may be replaced by the server @title Title of the audio; 0-64 characters; may be replaced by the server +//@performer Performer of the audio; 0-64 characters, may be replaced by the server @caption Audio caption; 0-GetOption("message_caption_length_max") characters +inputMessageAudio audio:InputFile album_cover_thumbnail:inputThumbnail duration:int32 title:string performer:string caption:formattedText = InputMessageContent; + +//@description A document message (general file) @document Document to be sent @thumbnail Document thumbnail, if available @disable_content_type_detection If true, automatic file type detection will be disabled and the document will be always sent as file. Always true for files sent to secret chats @caption Document caption; 0-GetOption("message_caption_length_max") characters +inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content_type_detection:Bool caption:formattedText = InputMessageContent; + +//@description A photo message @photo Photo to send @thumbnail Photo thumbnail to be sent, this is sent to the other party in secret chats only @added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable @width Photo width @height Photo height @caption Photo caption; 0-GetOption("message_caption_length_max") characters +//@ttl Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats +inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText ttl:int32 = InputMessageContent; + +//@description A sticker message @sticker Sticker to be sent @thumbnail Sticker thumbnail, if available @width Sticker width @height Sticker height +inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 height:int32 = InputMessageContent; + +//@description A video message @video Video to be sent @thumbnail Video thumbnail, if available @added_sticker_file_ids File identifiers of the stickers added to the video, if applicable +//@duration Duration of the video, in seconds @width Video width @height Video height @supports_streaming True, if the video should be tried to be streamed +//@caption Video caption; 0-GetOption("message_caption_length_max") characters @ttl Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats +inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText ttl:int32 = InputMessageContent; + +//@description A video note message @video_note Video note to be sent @thumbnail Video thumbnail, if available @duration Duration of the video, in seconds @length Video width and height; must be positive and not greater than 640 +inputMessageVideoNote video_note:InputFile thumbnail:inputThumbnail duration:int32 length:int32 = InputMessageContent; + +//@description A voice note message @voice_note Voice note to be sent @duration Duration of the voice note, in seconds @waveform Waveform representation of the voice note, in 5-bit format @caption Voice note caption; 0-GetOption("message_caption_length_max") characters +inputMessageVoiceNote voice_note:InputFile duration:int32 waveform:bytes caption:formattedText = InputMessageContent; + +//@description A message with a location @location Location to be sent @live_period Period for which the location can be updated, in seconds; should be between 60 and 86400 for a live location and 0 otherwise +//@heading For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 if unknown +//@proximity_alert_radius For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled. Can't be enabled in channels and Saved Messages +inputMessageLocation location:location live_period:int32 heading:int32 proximity_alert_radius:int32 = InputMessageContent; + +//@description A message with information about a venue @venue Venue to send +inputMessageVenue venue:venue = InputMessageContent; + +//@description A message containing a user contact @contact Contact to send +inputMessageContact contact:contact = InputMessageContent; + +//@description A dice message @emoji Emoji on which the dice throw animation is based @clear_draft True, if a chat message draft should be deleted +inputMessageDice emoji:string clear_draft:Bool = InputMessageContent; + +//@description A message with a game; not supported for channels or secret chats @bot_user_id User identifier of the bot that owns the game @game_short_name Short name of the game +inputMessageGame bot_user_id:int32 game_short_name:string = InputMessageContent; + +//@description A message with an invoice; can be used only by bots and only in private chats @invoice Invoice @title Product title; 1-32 characters @param_description Product description; 0-255 characters @photo_url Product photo URL; optional @photo_size Product photo size @photo_width Product photo width @photo_height Product photo height +//@payload The invoice payload @provider_token Payment provider token @provider_data JSON-encoded data about the invoice, which will be shared with the payment provider @start_parameter Unique invoice bot start_parameter for the generation of this invoice +inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string = InputMessageContent; + +//@description A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot @question Poll question, 1-255 characters (up to 300 characters for bots) @options List of poll answer options, 2-10 strings 1-100 characters each +//@is_anonymous True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels @type Type of the poll +//@open_period Amount of time the poll will be active after creation, in seconds; for bots only +//@close_date Point in time (Unix timestamp) when the poll will be automatically closed; for bots only +//@is_closed True, if the poll needs to be sent already closed; for bots only +inputMessagePoll question:string options:vector is_anonymous:Bool type:PollType open_period:int32 close_date:int32 is_closed:Bool = InputMessageContent; + +//@description A forwarded message @from_chat_id Identifier for the chat this forwarded message came from @message_id Identifier of the message to forward +//@in_game_share True, if a game message should be shared within a launched game; applies only to game messages +//@copy_options Options to be used to copy content of the message without a link to the original message +inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool copy_options:messageCopyOptions = InputMessageContent; + + +//@class SearchMessagesFilter @description Represents a filter for message search results + +//@description Returns all found messages, no filter is applied +searchMessagesFilterEmpty = SearchMessagesFilter; + +//@description Returns only animation messages +searchMessagesFilterAnimation = SearchMessagesFilter; + +//@description Returns only audio messages +searchMessagesFilterAudio = SearchMessagesFilter; + +//@description Returns only document messages +searchMessagesFilterDocument = SearchMessagesFilter; + +//@description Returns only photo messages +searchMessagesFilterPhoto = SearchMessagesFilter; + +//@description Returns only video messages +searchMessagesFilterVideo = SearchMessagesFilter; + +//@description Returns only voice note messages +searchMessagesFilterVoiceNote = SearchMessagesFilter; + +//@description Returns only photo and video messages +searchMessagesFilterPhotoAndVideo = SearchMessagesFilter; + +//@description Returns only messages containing URLs +searchMessagesFilterUrl = SearchMessagesFilter; + +//@description Returns only messages containing chat photos +searchMessagesFilterChatPhoto = SearchMessagesFilter; + +//@description Returns only call messages +searchMessagesFilterCall = SearchMessagesFilter; + +//@description Returns only incoming call messages with missed/declined discard reasons +searchMessagesFilterMissedCall = SearchMessagesFilter; + +//@description Returns only video note messages +searchMessagesFilterVideoNote = SearchMessagesFilter; + +//@description Returns only voice and video note messages +searchMessagesFilterVoiceAndVideoNote = SearchMessagesFilter; + +//@description Returns only messages with mentions of the current user, or messages that are replies to their messages +searchMessagesFilterMention = SearchMessagesFilter; + +//@description 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, a message thread or by the sending user +searchMessagesFilterUnreadMention = SearchMessagesFilter; + +//@description Returns only failed to send messages. This filter can be used only if the message database is used +searchMessagesFilterFailedToSend = SearchMessagesFilter; + +//@description Returns only pinned messages +searchMessagesFilterPinned = SearchMessagesFilter; + + +//@class ChatAction @description Describes the different types of activity in a chat + +//@description The user is typing a message +chatActionTyping = ChatAction; +//@description The user is recording a video +chatActionRecordingVideo = ChatAction; +//@description The user is uploading a video @progress Upload progress, as a percentage +chatActionUploadingVideo progress:int32 = ChatAction; +//@description The user is recording a voice note +chatActionRecordingVoiceNote = ChatAction; +//@description The user is uploading a voice note @progress Upload progress, as a percentage +chatActionUploadingVoiceNote progress:int32 = ChatAction; +//@description The user is uploading a photo @progress Upload progress, as a percentage +chatActionUploadingPhoto progress:int32 = ChatAction; +//@description The user is uploading a document @progress Upload progress, as a percentage +chatActionUploadingDocument progress:int32 = ChatAction; +//@description The user is picking a location or venue to send +chatActionChoosingLocation = ChatAction; +//@description The user is picking a contact to send +chatActionChoosingContact = ChatAction; +//@description The user has started to play a game +chatActionStartPlayingGame = ChatAction; +//@description The user is recording a video note +chatActionRecordingVideoNote = ChatAction; +//@description The user is uploading a video note @progress Upload progress, as a percentage +chatActionUploadingVideoNote progress:int32 = ChatAction; +//@description The user has cancelled the previous action +chatActionCancel = ChatAction; + + +//@class UserStatus @description Describes the last time the user was online + +//@description The user status was never changed +userStatusEmpty = UserStatus; + +//@description The user is online @expires Point in time (Unix timestamp) when the user's online status will expire +userStatusOnline expires:int32 = UserStatus; + +//@description The user is offline @was_online Point in time (Unix timestamp) when the user was last online +userStatusOffline was_online:int32 = UserStatus; + +//@description The user was online recently +userStatusRecently = UserStatus; + +//@description The user is offline, but was online last week +userStatusLastWeek = UserStatus; + +//@description The user is offline, but was online last month +userStatusLastMonth = UserStatus; + + +//@description Represents a list of stickers @stickers List of stickers +stickers stickers:vector = Stickers; + +//@description Represents a list of emoji @emojis List of emojis +emojis emojis:vector = Emojis; + +//@description Represents a sticker set +//@id Identifier of the sticker set @title Title of the sticker set @name Name of the sticker set @thumbnail Sticker set thumbnail in WEBP or TGS format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed +//@is_installed True, if the sticker set has been installed by the current user @is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously +//@is_official True, if the sticker set is official @is_animated True, is the stickers in the set are animated @is_masks True, if the stickers in the set are masks @is_viewed True for already viewed trending sticker sets +//@stickers List of stickers in this set @emojis 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 +stickerSet id:int64 title:string name:string thumbnail:thumbnail is_installed:Bool is_archived:Bool is_official:Bool is_animated:Bool is_masks:Bool is_viewed:Bool stickers:vector emojis:vector = StickerSet; + +//@description Represents short information about a sticker set +//@id Identifier of the sticker set @title Title of the sticker set @name Name of the sticker set @thumbnail Sticker set thumbnail in WEBP or TGS format with width and height 100; may be null +//@is_installed True, if the sticker set has been installed by current user @is_archived True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously +//@is_official True, if the sticker set is official @is_animated True, is the stickers in the set are animated @is_masks True, if the stickers in the set are masks @is_viewed True for already viewed trending sticker sets +//@size Total number of stickers in the set @covers Contains up to the first 5 stickers from the set, depending on the context. If the application needs more stickers the full set should be requested +stickerSetInfo id:int64 title:string name:string thumbnail:thumbnail is_installed:Bool is_archived:Bool is_official:Bool is_animated:Bool is_masks:Bool is_viewed:Bool size:int32 covers:vector = StickerSetInfo; + +//@description Represents a list of sticker sets @total_count Approximate total number of sticker sets found @sets List of sticker sets +stickerSets total_count:int32 sets:vector = StickerSets; + + +//@class CallDiscardReason @description Describes the reason why a call was discarded + +//@description The call wasn't discarded, or the reason is unknown +callDiscardReasonEmpty = CallDiscardReason; + +//@description The call was ended before the conversation started. It was cancelled by the caller or missed by the other party +callDiscardReasonMissed = CallDiscardReason; + +//@description The call was ended before the conversation started. It was declined by the other party +callDiscardReasonDeclined = CallDiscardReason; + +//@description The call was ended during the conversation because the users were disconnected +callDiscardReasonDisconnected = CallDiscardReason; + +//@description The call was ended because one of the parties hung up +callDiscardReasonHungUp = CallDiscardReason; + + +//@description Specifies the supported call protocols +//@udp_p2p True, if UDP peer-to-peer connections are supported +//@udp_reflector True, if connection through UDP reflectors is supported +//@min_layer The minimum supported API layer; use 65 +//@max_layer The maximum supported API layer; use 65 +//@library_versions List of supported libtgvoip versions +callProtocol udp_p2p:Bool udp_reflector:Bool min_layer:int32 max_layer:int32 library_versions:vector = CallProtocol; + + +//@class CallServerType @description Describes the type of a call server + +//@description A Telegram call reflector @peer_tag A peer tag to be used with the reflector +callServerTypeTelegramReflector peer_tag:bytes = CallServerType; + +//@description A WebRTC server @username Username to be used for authentication @password Authentication password @supports_turn True, if the server supports TURN @supports_stun True, if the server supports STUN +callServerTypeWebrtc username:string password:string supports_turn:Bool supports_stun:Bool = CallServerType; + + +//@description Describes a server for relaying call data @id Server identifier @ip_address Server IPv4 address @ipv6_address Server IPv6 address @port Server port number @type Server type +callServer id:int64 ip_address:string ipv6_address:string port:int32 type:CallServerType = CallServer; + + +//@description Contains the call identifier @id Call identifier +callId id:int32 = CallId; + + +//@class CallState @description Describes the current call state + +//@description The call is pending, waiting to be accepted by a user @is_created True, if the call has already been created by the server @is_received True, if the call has already been received by the other party +callStatePending is_created:Bool is_received:Bool = CallState; + +//@description The call has been answered and encryption keys are being exchanged +callStateExchangingKeys = CallState; + +//@description The call is ready to use @protocol Call protocols supported by the peer @servers List of available call servers @config A JSON-encoded call config @encryption_key Call encryption key @emojis Encryption key emojis fingerprint @allow_p2p True, if peer-to-peer connection is allowed by users privacy settings +callStateReady protocol:callProtocol servers:vector config:string encryption_key:bytes emojis:vector allow_p2p:Bool = CallState; + +//@description The call is hanging up after discardCall has been called +callStateHangingUp = CallState; + +//@description The call has ended successfully @reason The reason, why the call has ended @need_rating True, if the call rating should be sent to the server @need_debug_information True, if the call debug information should be sent to the server +callStateDiscarded reason:CallDiscardReason need_rating:Bool need_debug_information:Bool = CallState; + +//@description The call has ended with an error @error Error. An error with the code 4005000 will be returned if an outgoing call is missed because of an expired timeout +callStateError error:error = CallState; + + +//@class CallProblem @description Describes the exact type of a problem with a call + +//@description The user heard their own voice +callProblemEcho = CallProblem; + +//@description The user heard background noise +callProblemNoise = CallProblem; + +//@description The other side kept disappearing +callProblemInterruptions = CallProblem; + +//@description The speech was distorted +callProblemDistortedSpeech = CallProblem; + +//@description The user couldn't hear the other side +callProblemSilentLocal = CallProblem; + +//@description The other side couldn't hear the user +callProblemSilentRemote = CallProblem; + +//@description The call ended unexpectedly +callProblemDropped = CallProblem; + +//@description The video was distorted +callProblemDistortedVideo = CallProblem; + +//@description The video was pixelated +callProblemPixelatedVideo = CallProblem; + + +//@description Describes a call @id Call identifier, not persistent @user_id Peer user identifier @is_outgoing True, if the call is outgoing @is_video True, if the call is a video call @state Call state +call id:int32 user_id:int32 is_outgoing:Bool is_video:Bool state:CallState = Call; + + +//@description Contains settings for the authentication of the user's phone number +//@allow_flash_call Pass true if the authentication code may be sent via flash call to the specified phone number +//@is_current_phone_number Pass true if the authenticated phone number is used on the current device +//@allow_sms_retriever_api For official applications only. True, if the application 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 +phoneNumberAuthenticationSettings allow_flash_call:Bool is_current_phone_number:Bool allow_sms_retriever_api:Bool = PhoneNumberAuthenticationSettings; + + +//@description Represents a list of animations @animations List of animations +animations animations:vector = Animations; + + +//@class DiceStickers @description Contains animated stickers which should be used for dice animation rendering + +//@description A regular animated sticker @sticker The animated sticker with the dice animation +diceStickersRegular sticker:sticker = DiceStickers; + +//@description Animated stickers to be combined into a slot machine +//@background The animated sticker with the slot machine background. The background animation must start playing after all reel animations finish +//@lever The animated sticker with the lever animation. The lever animation must play once in the initial dice state +//@left_reel The animated sticker with the left reel +//@center_reel The animated sticker with the center reel +//@right_reel The animated sticker with the right reel +diceStickersSlotMachine background:sticker lever:sticker left_reel:sticker center_reel:sticker right_reel:sticker = DiceStickers; + + +//@description Represents the result of an ImportContacts request @user_ids 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 +//@importer_count The number of users that imported the corresponding contact; 0 for already registered users or if unavailable +importedContacts user_ids:vector importer_count:vector = ImportedContacts; + + +//@description Contains an HTTP URL @url The URL +httpUrl url:string = HttpUrl; + + +//@class InputInlineQueryResult @description Represents a single result of an inline query; for bots only + +//@description Represents a link to an animated GIF or an animated (i.e. without sound) H.264/MPEG-4 AVC video +//@id Unique identifier of the query result @title Title of the query result +//@thumbnail_url URL of the result thumbnail (JPEG, GIF, or MPEG4), if it exists @thumbnail_mime_type MIME type of the video thumbnail. If non-empty, must be one of "image/jpeg", "image/gif" and "video/mp4" +//@video_url The URL of the video file (file size must not exceed 1MB) @video_mime_type MIME type of the video file. Must be one of "image/gif" and "video/mp4" +//@video_duration Duration of the video, in seconds @video_width Width of the video @video_height Height of the video +//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null +//@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAnimation, InputMessageLocation, InputMessageVenue or InputMessageContact +inputInlineQueryResultAnimation id:string title:string thumbnail_url:string thumbnail_mime_type:string video_url:string video_mime_type:string video_duration:int32 video_width:int32 video_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; + +//@description Represents a link to an article or web page @id Unique identifier of the query result @url URL of the result, if it exists @hide_url True, if the URL must be not shown @title Title of the result +//@param_description A short description of the result @thumbnail_url URL of the result thumbnail, if it exists @thumbnail_width Thumbnail width, if known @thumbnail_height Thumbnail height, if known +//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null +//@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact +inputInlineQueryResultArticle id:string url:string hide_url:Bool title:string description:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; + +//@description Represents a link to an MP3 audio file @id Unique identifier of the query result @title Title of the audio file @performer Performer of the audio file +//@audio_url The URL of the audio file @audio_duration Audio file duration, in seconds +//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null +//@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAudio, InputMessageLocation, InputMessageVenue or InputMessageContact +inputInlineQueryResultAudio id:string title:string performer:string audio_url:string audio_duration:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; + +//@description Represents a user contact @id Unique identifier of the query result @contact User contact @thumbnail_url URL of the result thumbnail, if it exists @thumbnail_width Thumbnail width, if known @thumbnail_height Thumbnail height, if known +//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null +//@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact +inputInlineQueryResultContact id:string contact:contact thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; + +//@description Represents a link to a file @id Unique identifier of the query result @title Title of the resulting file @param_description Short description of the result, if known @document_url URL of the file @mime_type MIME type of the file content; only "application/pdf" and "application/zip" are currently allowed +//@thumbnail_url The URL of the file thumbnail, if it exists @thumbnail_width Width of the thumbnail @thumbnail_height Height of the thumbnail +//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null +//@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageDocument, InputMessageLocation, InputMessageVenue or InputMessageContact +inputInlineQueryResultDocument id:string title:string description:string document_url:string mime_type:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; + +//@description Represents a game @id Unique identifier of the query result @game_short_name Short name of the game @reply_markup Message reply markup. Must be of type replyMarkupInlineKeyboard or null +inputInlineQueryResultGame id:string game_short_name:string reply_markup:ReplyMarkup = InputInlineQueryResult; + +//@description Represents a point on the map @id Unique identifier of the query result @location Location result +//@live_period Amount of time relative to the message sent time until the location can be updated, in seconds +//@title Title of the result @thumbnail_url URL of the result thumbnail, if it exists @thumbnail_width Thumbnail width, if known @thumbnail_height Thumbnail height, if known +//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null +//@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact +inputInlineQueryResultLocation id:string location:location live_period:int32 title:string thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; + +//@description Represents link to a JPEG image @id Unique identifier of the query result @title Title of the result, if known @param_description A short description of the result, if known @thumbnail_url URL of the photo thumbnail, if it exists +//@photo_url The URL of the JPEG photo (photo size must not exceed 5MB) @photo_width Width of the photo @photo_height Height of the photo +//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null +//@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessagePhoto, InputMessageLocation, InputMessageVenue or InputMessageContact +inputInlineQueryResultPhoto id:string title:string description:string thumbnail_url:string photo_url:string photo_width:int32 photo_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; + +//@description Represents a link to a WEBP or TGS sticker @id Unique identifier of the query result @thumbnail_url URL of the sticker thumbnail, if it exists +//@sticker_url The URL of the WEBP or TGS sticker (sticker file size must not exceed 5MB) @sticker_width Width of the sticker @sticker_height Height of the sticker +//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null +//@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, inputMessageSticker, InputMessageLocation, InputMessageVenue or InputMessageContact +inputInlineQueryResultSticker id:string thumbnail_url:string sticker_url:string sticker_width:int32 sticker_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; + +//@description Represents information about a venue @id Unique identifier of the query result @venue Venue result @thumbnail_url URL of the result thumbnail, if it exists @thumbnail_width Thumbnail width, if known @thumbnail_height Thumbnail height, if known +//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null +//@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact +inputInlineQueryResultVenue id:string venue:venue thumbnail_url:string thumbnail_width:int32 thumbnail_height:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; + +//@description Represents a link to a page containing an embedded video player or a video file @id Unique identifier of the query result @title Title of the result @param_description A short description of the result, if known +//@thumbnail_url The URL of the video thumbnail (JPEG), if it exists @video_url URL of the embedded video player or video file @mime_type MIME type of the content of the video URL, only "text/html" or "video/mp4" are currently supported +//@video_width Width of the video @video_height Height of the video @video_duration Video duration, in seconds +//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null +//@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageVideo, InputMessageLocation, InputMessageVenue or InputMessageContact +inputInlineQueryResultVideo id:string title:string description:string thumbnail_url:string video_url:string mime_type:string video_width:int32 video_height:int32 video_duration:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; + +//@description Represents a link to an opus-encoded audio file within an OGG container, single channel audio @id Unique identifier of the query result @title Title of the voice note +//@voice_note_url The URL of the voice note file @voice_note_duration Duration of the voice note, in seconds +//@reply_markup The message reply markup. Must be of type replyMarkupInlineKeyboard or null +//@input_message_content The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageVoiceNote, InputMessageLocation, InputMessageVenue or InputMessageContact +inputInlineQueryResultVoiceNote id:string title:string voice_note_url:string voice_note_duration:int32 reply_markup:ReplyMarkup input_message_content:InputMessageContent = InputInlineQueryResult; + + +//@class InlineQueryResult @description Represents a single result of an inline query + +//@description Represents a link to an article or web page @id Unique identifier of the query result @url URL of the result, if it exists @hide_url True, if the URL must be not shown @title Title of the result +//@param_description A short description of the result @thumbnail Result thumbnail in JPEG format; may be null +inlineQueryResultArticle id:string url:string hide_url:Bool title:string description:string thumbnail:thumbnail = InlineQueryResult; + +//@description Represents a user contact @id Unique identifier of the query result @contact A user contact @thumbnail Result thumbnail in JPEG format; may be null +inlineQueryResultContact id:string contact:contact thumbnail:thumbnail = InlineQueryResult; + +//@description Represents a point on the map @id Unique identifier of the query result @location Location result @title Title of the result @thumbnail Result thumbnail in JPEG format; may be null +inlineQueryResultLocation id:string location:location title:string thumbnail:thumbnail = InlineQueryResult; + +//@description Represents information about a venue @id Unique identifier of the query result @venue Venue result @thumbnail Result thumbnail in JPEG format; may be null +inlineQueryResultVenue id:string venue:venue thumbnail:thumbnail = InlineQueryResult; + +//@description Represents information about a game @id Unique identifier of the query result @game Game result +inlineQueryResultGame id:string game:game = InlineQueryResult; + +//@description Represents an animation file @id Unique identifier of the query result @animation Animation file @title Animation title +inlineQueryResultAnimation id:string animation:animation title:string = InlineQueryResult; + +//@description Represents an audio file @id Unique identifier of the query result @audio Audio file +inlineQueryResultAudio id:string audio:audio = InlineQueryResult; + +//@description Represents a document @id Unique identifier of the query result @document Document @title Document title @param_description Document description +inlineQueryResultDocument id:string document:document title:string description:string = InlineQueryResult; + +//@description Represents a photo @id Unique identifier of the query result @photo Photo @title Title of the result, if known @param_description A short description of the result, if known +inlineQueryResultPhoto id:string photo:photo title:string description:string = InlineQueryResult; + +//@description Represents a sticker @id Unique identifier of the query result @sticker Sticker +inlineQueryResultSticker id:string sticker:sticker = InlineQueryResult; + +//@description Represents a video @id Unique identifier of the query result @video Video @title Title of the video @param_description Description of the video +inlineQueryResultVideo id:string video:video title:string description:string = InlineQueryResult; + +//@description Represents a voice note @id Unique identifier of the query result @voice_note Voice note @title Title of the voice note +inlineQueryResultVoiceNote id:string voice_note:voiceNote title:string = InlineQueryResult; + + +//@description Represents the results of the inline query. Use sendInlineQueryResultMessage to send the result of the query @inline_query_id Unique identifier of the inline query @next_offset The offset for the next request. If empty, there are no more results @results Results of the query +//@switch_pm_text 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 @switch_pm_parameter Parameter for the bot start message +inlineQueryResults inline_query_id:int64 next_offset:string results:vector switch_pm_text:string switch_pm_parameter:string = InlineQueryResults; + + +//@class CallbackQueryPayload @description Represents a payload of a callback query + +//@description The payload for a general callback button @data Data that was attached to the callback button +callbackQueryPayloadData data:bytes = CallbackQueryPayload; + +//@description The payload for a callback button requiring password @password The password for the current user @data Data that was attached to the callback button +callbackQueryPayloadDataWithPassword password:string data:bytes = CallbackQueryPayload; + +//@description The payload for a game callback button @game_short_name A short name of the game that was attached to the callback button +callbackQueryPayloadGame game_short_name:string = CallbackQueryPayload; + + +//@description Contains a bot's answer to a callback query @text Text of the answer @show_alert True, if an alert should be shown to the user instead of a toast notification @url URL to be opened +callbackQueryAnswer text:string show_alert:Bool url:string = CallbackQueryAnswer; + + +//@description Contains the result of a custom request @result A JSON-serialized result +customRequestResult result:string = CustomRequestResult; + + +//@description Contains one row of the game high score table @position Position in the high score table @user_id User identifier @score User score +gameHighScore position:int32 user_id:int32 score:int32 = GameHighScore; + +//@description Contains a list of game high scores @scores A list of game high scores +gameHighScores scores:vector = GameHighScores; + + +//@class ChatEventAction @description Represents a chat event + +//@description A message was edited @old_message The original message before the edit @new_message The message after it was edited +chatEventMessageEdited old_message:message new_message:message = ChatEventAction; + +//@description A message was deleted @message Deleted message +chatEventMessageDeleted message:message = ChatEventAction; + +//@description A poll in a message was stopped @message The message with the poll +chatEventPollStopped message:message = ChatEventAction; + +//@description A message was pinned @message Pinned message +chatEventMessagePinned message:message = ChatEventAction; + +//@description A message was unpinned @message Unpinned message +chatEventMessageUnpinned message:message = ChatEventAction; + +//@description A new member joined the chat +chatEventMemberJoined = ChatEventAction; + +//@description A member left the chat +chatEventMemberLeft = ChatEventAction; + +//@description A new chat member was invited @user_id New member user identifier @status New member status +chatEventMemberInvited user_id:int32 status:ChatMemberStatus = ChatEventAction; + +//@description A chat member has gained/lost administrator status, or the list of their administrator privileges has changed @user_id Chat member user identifier @old_status Previous status of the chat member @new_status New status of the chat member +chatEventMemberPromoted user_id:int32 old_status:ChatMemberStatus new_status:ChatMemberStatus = ChatEventAction; + +//@description A chat member was restricted/unrestricted or banned/unbanned, or the list of their restrictions has changed @user_id Chat member user identifier @old_status Previous status of the chat member @new_status New status of the chat member +chatEventMemberRestricted user_id:int32 old_status:ChatMemberStatus new_status:ChatMemberStatus = ChatEventAction; + +//@description The chat title was changed @old_title Previous chat title @new_title New chat title +chatEventTitleChanged old_title:string new_title:string = ChatEventAction; + +//@description The chat permissions was changed @old_permissions Previous chat permissions @new_permissions New chat permissions +chatEventPermissionsChanged old_permissions:chatPermissions new_permissions:chatPermissions = ChatEventAction; + +//@description The chat description was changed @old_description Previous chat description @new_description New chat description +chatEventDescriptionChanged old_description:string new_description:string = ChatEventAction; + +//@description The chat username was changed @old_username Previous chat username @new_username New chat username +chatEventUsernameChanged old_username:string new_username:string = ChatEventAction; + +//@description The chat photo was changed @old_photo Previous chat photo value; may be null @new_photo New chat photo value; may be null +chatEventPhotoChanged old_photo:chatPhoto new_photo:chatPhoto = ChatEventAction; + +//@description The can_invite_users permission of a supergroup chat was toggled @can_invite_users New value of can_invite_users permission +chatEventInvitesToggled can_invite_users:Bool = ChatEventAction; + +//@description The linked chat of a supergroup was changed @old_linked_chat_id Previous supergroup linked chat identifier @new_linked_chat_id New supergroup linked chat identifier +chatEventLinkedChatChanged old_linked_chat_id:int53 new_linked_chat_id:int53 = ChatEventAction; + +//@description The slow_mode_delay setting of a supergroup was changed @old_slow_mode_delay Previous value of slow_mode_delay @new_slow_mode_delay New value of slow_mode_delay +chatEventSlowModeDelayChanged old_slow_mode_delay:int32 new_slow_mode_delay:int32 = ChatEventAction; + +//@description The sign_messages setting of a channel was toggled @sign_messages New value of sign_messages +chatEventSignMessagesToggled sign_messages:Bool = ChatEventAction; + +//@description The supergroup sticker set was changed @old_sticker_set_id Previous identifier of the chat sticker set; 0 if none @new_sticker_set_id New identifier of the chat sticker set; 0 if none +chatEventStickerSetChanged old_sticker_set_id:int64 new_sticker_set_id:int64 = ChatEventAction; + +//@description The supergroup location was changed @old_location Previous location; may be null @new_location New location; may be null +chatEventLocationChanged old_location:chatLocation new_location:chatLocation = ChatEventAction; + +//@description The is_all_history_available setting of a supergroup was toggled @is_all_history_available New value of is_all_history_available +chatEventIsAllHistoryAvailableToggled is_all_history_available:Bool = ChatEventAction; + +//@description Represents a chat event @id Chat event identifier @date Point in time (Unix timestamp) when the event happened @user_id Identifier of the user who performed the action that triggered the event @action Action performed by the user +chatEvent id:int64 date:int32 user_id:int32 action:ChatEventAction = ChatEvent; + +//@description Contains a list of chat events @events List of events +chatEvents events:vector = ChatEvents; + +//@description Represents a set of filters used to obtain a chat event log +//@message_edits True, if message edits should be returned +//@message_deletions True, if message deletions should be returned +//@message_pins True, if pin/unpin events should be returned +//@member_joins True, if members joining events should be returned +//@member_leaves True, if members leaving events should be returned +//@member_invites True, if invited member events should be returned +//@member_promotions True, if member promotion/demotion events should be returned +//@member_restrictions True, if member restricted/unrestricted/banned/unbanned events should be returned +//@info_changes True, if changes in chat information should be returned +//@setting_changes True, if changes in chat settings should be returned +chatEventLogFilters message_edits:Bool message_deletions:Bool message_pins:Bool member_joins:Bool member_leaves:Bool member_invites:Bool member_promotions:Bool member_restrictions:Bool info_changes:Bool setting_changes:Bool = ChatEventLogFilters; + + +//@class LanguagePackStringValue @description Represents the value of a string in a language pack + +//@description An ordinary language pack string @value String value +languagePackStringValueOrdinary value:string = LanguagePackStringValue; + +//@description 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 +//@zero_value Value for zero objects @one_value Value for one object @two_value Value for two objects +//@few_value Value for few objects @many_value Value for many objects @other_value Default value +languagePackStringValuePluralized zero_value:string one_value:string two_value:string few_value:string many_value:string other_value:string = LanguagePackStringValue; + +//@description A deleted language pack string, the value should be taken from the built-in english language pack +languagePackStringValueDeleted = LanguagePackStringValue; + + +//@description Represents one language pack string @key String key @value String value +languagePackString key:string value:LanguagePackStringValue = LanguagePackString; + +//@description Contains a list of language pack strings @strings A list of language pack strings +languagePackStrings strings:vector = LanguagePackStrings; + +//@description Contains information about a language pack @id Unique language pack identifier +//@base_language_pack_id 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 +//@name Language name @native_name Name of the language in that language +//@plural_code 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 +//@is_official True, if the language pack is official @is_rtl True, if the language pack strings are RTL @is_beta True, if the language pack is a beta language pack +//@is_installed True, if the language pack is installed by the current user +//@total_string_count Total number of non-deleted strings from the language pack @translated_string_count Total number of translated strings from the language pack +//@local_string_count Total number of non-deleted strings from the language pack available locally @translation_url Link to language translation interface; empty for custom local language packs +languagePackInfo id:string base_language_pack_id:string name:string native_name:string plural_code:string is_official:Bool is_rtl:Bool is_beta:Bool is_installed:Bool total_string_count:int32 translated_string_count:int32 local_string_count:int32 translation_url:string = LanguagePackInfo; + +//@description Contains information about the current localization target @language_packs List of available language packs for this application +localizationTargetInfo language_packs:vector = LocalizationTargetInfo; + + +//@class DeviceToken @description Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org + +//@description A token for Firebase Cloud Messaging @token Device registration token; may be empty to de-register a device @encrypt True, if push notifications should be additionally encrypted +deviceTokenFirebaseCloudMessaging token:string encrypt:Bool = DeviceToken; + +//@description A token for Apple Push Notification service @device_token Device token; may be empty to de-register a device @is_app_sandbox True, if App Sandbox is enabled +deviceTokenApplePush device_token:string is_app_sandbox:Bool = DeviceToken; + +//@description A token for Apple Push Notification service VoIP notifications @device_token Device token; may be empty to de-register a device @is_app_sandbox True, if App Sandbox is enabled @encrypt True, if push notifications should be additionally encrypted +deviceTokenApplePushVoIP device_token:string is_app_sandbox:Bool encrypt:Bool = DeviceToken; + +//@description A token for Windows Push Notification Services @access_token The access token that will be used to send notifications; may be empty to de-register a device +deviceTokenWindowsPush access_token:string = DeviceToken; + +//@description A token for Microsoft Push Notification Service @channel_uri Push notification channel URI; may be empty to de-register a device +deviceTokenMicrosoftPush channel_uri:string = DeviceToken; + +//@description A token for Microsoft Push Notification Service VoIP channel @channel_uri Push notification channel URI; may be empty to de-register a device +deviceTokenMicrosoftPushVoIP channel_uri:string = DeviceToken; + +//@description A token for web Push API @endpoint Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device +//@p256dh_base64url Base64url-encoded P-256 elliptic curve Diffie-Hellman public key @auth_base64url Base64url-encoded authentication secret +deviceTokenWebPush endpoint:string p256dh_base64url:string auth_base64url:string = DeviceToken; + +//@description A token for Simple Push API for Firefox OS @endpoint Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device +deviceTokenSimplePush endpoint:string = DeviceToken; + +//@description A token for Ubuntu Push Client service @token Token; may be empty to de-register a device +deviceTokenUbuntuPush token:string = DeviceToken; + +//@description A token for BlackBerry Push Service @token Token; may be empty to de-register a device +deviceTokenBlackBerryPush token:string = DeviceToken; + +//@description A token for Tizen Push Service @reg_id Push service registration identifier; may be empty to de-register a device +deviceTokenTizenPush reg_id:string = DeviceToken; + + +//@description Contains a globally unique push receiver identifier, which can be used to identify which account has received a push notification @id The globally unique identifier of push notification subscription +pushReceiverId id:int64 = PushReceiverId; + + +//@class BackgroundFill @description Describes a fill of a background + +//@description Describes a solid fill of a background @color A color of the background in the RGB24 format +backgroundFillSolid color:int32 = BackgroundFill; + +//@description Describes a gradient fill of a background @top_color A top color of the background in the RGB24 format @bottom_color A bottom color of the background in the RGB24 format +//@rotation_angle Clockwise rotation angle of the gradient, in degrees; 0-359. Should be always divisible by 45 +backgroundFillGradient top_color:int32 bottom_color:int32 rotation_angle:int32 = BackgroundFill; + + +//@class BackgroundType @description Describes the type of a background + +//@description A wallpaper in JPEG format +//@is_blurred True, if the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12 +//@is_moving True, if the background needs to be slightly moved when device is tilted +backgroundTypeWallpaper is_blurred:Bool is_moving:Bool = BackgroundType; + +//@description A PNG or TGV (gzipped subset of SVG with MIME type "application/x-tgwallpattern") pattern to be combined with the background fill chosen by the user +//@fill Description of the background fill +//@intensity Intensity of the pattern when it is shown above the filled background, 0-100 +//@is_moving True, if the background needs to be slightly moved when device is tilted +backgroundTypePattern fill:BackgroundFill intensity:int32 is_moving:Bool = BackgroundType; + +//@description A filled background @fill Description of the background fill +backgroundTypeFill fill:BackgroundFill = BackgroundType; + + +//@description Describes a chat background +//@id Unique background identifier +//@is_default True, if this is one of default backgrounds +//@is_dark True, if the background is dark and is recommended to be used with dark theme +//@name Unique background name +//@document Document with the background; may be null. Null only for filled backgrounds +//@type Type of the background +background id:int64 is_default:Bool is_dark:Bool name:string document:document type:BackgroundType = Background; + +//@description Contains a list of backgrounds @backgrounds A list of backgrounds +backgrounds backgrounds:vector = Backgrounds; + + +//@class InputBackground @description Contains information about background to set + +//@description A background from a local file +//@background Background file to use. Only inputFileLocal and inputFileGenerated are supported. The file must be in JPEG format for wallpapers and in PNG format for patterns +inputBackgroundLocal background:InputFile = InputBackground; + +//@description A background from the server @background_id The background identifier +inputBackgroundRemote background_id:int64 = InputBackground; + + +//@description Contains a list of hashtags @hashtags A list of hashtags +hashtags hashtags:vector = Hashtags; + + +//@class CanTransferOwnershipResult @description Represents result of checking whether the current session can be used to transfer a chat ownership to another user + +//@description The session can be used +canTransferOwnershipResultOk = CanTransferOwnershipResult; + +//@description The 2-step verification needs to be enabled first +canTransferOwnershipResultPasswordNeeded = CanTransferOwnershipResult; + +//@description The 2-step verification was enabled recently, user needs to wait @retry_after Time left before the session can be used to transfer ownership of a chat, in seconds +canTransferOwnershipResultPasswordTooFresh retry_after:int32 = CanTransferOwnershipResult; + +//@description The session was created recently, user needs to wait @retry_after Time left before the session can be used to transfer ownership of a chat, in seconds +canTransferOwnershipResultSessionTooFresh retry_after:int32 = CanTransferOwnershipResult; + + +//@class CheckChatUsernameResult @description Represents result of checking whether a username can be set for a chat + +//@description The username can be set +checkChatUsernameResultOk = CheckChatUsernameResult; + +//@description The username is invalid +checkChatUsernameResultUsernameInvalid = CheckChatUsernameResult; + +//@description The username is occupied +checkChatUsernameResultUsernameOccupied = CheckChatUsernameResult; + +//@description The user has too much chats with username, one of them should be made private first +checkChatUsernameResultPublicChatsTooMuch = CheckChatUsernameResult; + +//@description The user can't be a member of a public supergroup +checkChatUsernameResultPublicGroupsUnavailable = CheckChatUsernameResult; + + +//@class PushMessageContent @description Contains content of a push message notification + +//@description A general message with hidden content @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentHidden is_pinned:Bool = PushMessageContent; + +//@description An animation message (GIF-style). @animation Message content; may be null @caption Animation caption @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentAnimation animation:animation caption:string is_pinned:Bool = PushMessageContent; + +//@description An audio message @audio Message content; may be null @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentAudio audio:audio is_pinned:Bool = PushMessageContent; + +//@description A message with a user contact @name Contact's name @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentContact name:string is_pinned:Bool = PushMessageContent; + +//@description A contact has registered with Telegram +pushMessageContentContactRegistered = PushMessageContent; + +//@description A document message (a general file) @document Message content; may be null @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentDocument document:document is_pinned:Bool = PushMessageContent; + +//@description A message with a game @title Game title, empty for pinned game message @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentGame title:string is_pinned:Bool = PushMessageContent; + +//@description A new high score was achieved in a game @title Game title, empty for pinned message @score New score, 0 for pinned message @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentGameScore title:string score:int32 is_pinned:Bool = PushMessageContent; + +//@description A message with an invoice from a bot @price Product price @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentInvoice price:string is_pinned:Bool = PushMessageContent; + +//@description A message with a location @is_live True, if the location is live @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentLocation is_live:Bool is_pinned:Bool = PushMessageContent; + +//@description A photo message @photo Message content; may be null @caption Photo caption @is_secret True, if the photo is secret @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentPhoto photo:photo caption:string is_secret:Bool is_pinned:Bool = PushMessageContent; + +//@description A message with a poll @question Poll question @is_regular True, if the poll is regular and not in quiz mode @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentPoll question:string is_regular:Bool is_pinned:Bool = PushMessageContent; + +//@description A screenshot of a message in the chat has been taken +pushMessageContentScreenshotTaken = PushMessageContent; + +//@description A message with a sticker @sticker Message content; may be null @emoji Emoji corresponding to the sticker; may be empty @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentSticker sticker:sticker emoji:string is_pinned:Bool = PushMessageContent; + +//@description A text message @text Message text @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentText text:string is_pinned:Bool = PushMessageContent; + +//@description A video message @video Message content; may be null @caption Video caption @is_secret True, if the video is secret @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentVideo video:video caption:string is_secret:Bool is_pinned:Bool = PushMessageContent; + +//@description A video note message @video_note Message content; may be null @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentVideoNote video_note:videoNote is_pinned:Bool = PushMessageContent; + +//@description A voice note message @voice_note Message content; may be null @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentVoiceNote voice_note:voiceNote is_pinned:Bool = PushMessageContent; + +//@description A newly created basic group +pushMessageContentBasicGroupChatCreate = PushMessageContent; + +//@description New chat members were invited to a group @member_name Name of the added member @is_current_user True, if the current user was added to the group +//@is_returned True, if the user has returned to the group themself +pushMessageContentChatAddMembers member_name:string is_current_user:Bool is_returned:Bool = PushMessageContent; + +//@description A chat photo was edited +pushMessageContentChatChangePhoto = PushMessageContent; + +//@description A chat title was edited @title New chat title +pushMessageContentChatChangeTitle title:string = PushMessageContent; + +//@description A chat member was deleted @member_name Name of the deleted member @is_current_user True, if the current user was deleted from the group +//@is_left True, if the user has left the group themself +pushMessageContentChatDeleteMember member_name:string is_current_user:Bool is_left:Bool = PushMessageContent; + +//@description A new member joined the chat by invite link +pushMessageContentChatJoinByLink = PushMessageContent; + +//@description A forwarded messages @total_count Number of forwarded messages +pushMessageContentMessageForwards total_count:int32 = PushMessageContent; + +//@description A media album @total_count Number of messages in the album @has_photos True, if the album has at least one photo @has_videos True, if the album has at least one video +//@has_audios True, if the album has at least one audio file @has_documents True, if the album has at least one document +pushMessageContentMediaAlbum total_count:int32 has_photos:Bool has_videos:Bool has_audios:Bool has_documents:Bool = PushMessageContent; + + +//@class NotificationType @description Contains detailed information about a notification + +//@description New message was received @message The message +notificationTypeNewMessage message:message = NotificationType; + +//@description New secret chat was created +notificationTypeNewSecretChat = NotificationType; + +//@description New call was received @call_id Call identifier +notificationTypeNewCall call_id:int32 = NotificationType; + +//@description New message was received through a push notification +//@message_id The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages, or as reply_to_message_id +//@sender The sender of the message. Corresponding user or chat may be inaccessible +//@sender_name Name of the sender +//@is_outgoing True, if the message is outgoing +//@content Push message content +notificationTypeNewPushMessage message_id:int53 sender:MessageSender sender_name:string is_outgoing:Bool content:PushMessageContent = NotificationType; + + +//@class NotificationGroupType @description Describes the type of notifications in a notification group + +//@description A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with ordinary unread messages +notificationGroupTypeMessages = NotificationGroupType; + +//@description A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with unread mentions of the current user, replies to their messages, or a pinned message +notificationGroupTypeMentions = NotificationGroupType; + +//@description A group containing a notification of type notificationTypeNewSecretChat +notificationGroupTypeSecretChat = NotificationGroupType; + +//@description A group containing notifications of type notificationTypeNewCall +notificationGroupTypeCalls = NotificationGroupType; + + +//@description Contains information about a notification @id Unique persistent identifier of this notification @date Notification date +//@is_silent True, if the notification was initially silent @type Notification type +notification id:int32 date:int32 is_silent:Bool type:NotificationType = Notification; + +//@description Describes a group of notifications @id Unique persistent auto-incremented from 1 identifier of the notification group @type Type of the group +//@chat_id Identifier of a chat to which all notifications in the group belong +//@total_count Total number of active notifications in the group @notifications The list of active notifications +notificationGroup id:int32 type:NotificationGroupType chat_id:int53 total_count:int32 notifications:vector = NotificationGroup; + + +//@class OptionValue @description Represents the value of an option + +//@description Represents a boolean option @value The value of the option +optionValueBoolean value:Bool = OptionValue; + +//@description Represents an unknown option or an option which has a default value +optionValueEmpty = OptionValue; + +//@description Represents an integer option @value The value of the option +optionValueInteger value:int64 = OptionValue; + +//@description Represents a string option @value The value of the option +optionValueString value:string = OptionValue; + + +//@description Represents one member of a JSON object @key Member's key @value Member's value +jsonObjectMember key:string value:JsonValue = JsonObjectMember; + +//@class JsonValue @description Represents a JSON value + +//@description Represents a null JSON value +jsonValueNull = JsonValue; + +//@description Represents a boolean JSON value @value The value +jsonValueBoolean value:Bool = JsonValue; + +//@description Represents a numeric JSON value @value The value +jsonValueNumber value:double = JsonValue; + +//@description Represents a string JSON value @value The value +jsonValueString value:string = JsonValue; + +//@description Represents a JSON array @values The list of array elements +jsonValueArray values:vector = JsonValue; + +//@description Represents a JSON object @members The list of object members +jsonValueObject members:vector = JsonValue; + + +//@class UserPrivacySettingRule @description Represents a single rule for managing privacy settings + +//@description A rule to allow all users to do something +userPrivacySettingRuleAllowAll = UserPrivacySettingRule; + +//@description A rule to allow all of a user's contacts to do something +userPrivacySettingRuleAllowContacts = UserPrivacySettingRule; + +//@description A rule to allow certain specified users to do something @user_ids The user identifiers, total number of users in all rules must not exceed 1000 +userPrivacySettingRuleAllowUsers user_ids:vector = UserPrivacySettingRule; + +//@description A rule to allow all members of certain specified basic groups and supergroups to doing something @chat_ids The chat identifiers, total number of chats in all rules must not exceed 20 +userPrivacySettingRuleAllowChatMembers chat_ids:vector = UserPrivacySettingRule; + +//@description A rule to restrict all users from doing something +userPrivacySettingRuleRestrictAll = UserPrivacySettingRule; + +//@description A rule to restrict all contacts of a user from doing something +userPrivacySettingRuleRestrictContacts = UserPrivacySettingRule; + +//@description A rule to restrict all specified users from doing something @user_ids The user identifiers, total number of users in all rules must not exceed 1000 +userPrivacySettingRuleRestrictUsers user_ids:vector = UserPrivacySettingRule; + +//@description A rule to restrict all members of specified basic groups and supergroups from doing something @chat_ids The chat identifiers, total number of chats in all rules must not exceed 20 +userPrivacySettingRuleRestrictChatMembers chat_ids:vector = UserPrivacySettingRule; + +//@description 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 @rules A list of rules +userPrivacySettingRules rules:vector = UserPrivacySettingRules; + +//@class UserPrivacySetting @description Describes available user privacy settings + +//@description A privacy setting for managing whether the user's online status is visible +userPrivacySettingShowStatus = UserPrivacySetting; + +//@description A privacy setting for managing whether the user's profile photo is visible +userPrivacySettingShowProfilePhoto = UserPrivacySetting; + +//@description A privacy setting for managing whether a link to the user's account is included in forwarded messages +userPrivacySettingShowLinkInForwardedMessages = UserPrivacySetting; + +//@description A privacy setting for managing whether the user's phone number is visible +userPrivacySettingShowPhoneNumber = UserPrivacySetting; + +//@description A privacy setting for managing whether the user can be invited to chats +userPrivacySettingAllowChatInvites = UserPrivacySetting; + +//@description A privacy setting for managing whether the user can be called +userPrivacySettingAllowCalls = UserPrivacySetting; + +//@description A privacy setting for managing whether peer-to-peer connections can be used for calls +userPrivacySettingAllowPeerToPeerCalls = UserPrivacySetting; + +//@description A privacy setting for managing whether the user can be found by their phone number. Checked only if the phone number is not known to the other user. Can be set only to "Allow contacts" or "Allow all" +userPrivacySettingAllowFindingByPhoneNumber = UserPrivacySetting; + + +//@description Contains information about the period of inactivity after which the current user's account will automatically be deleted @days Number of days of inactivity before the account will be flagged for deletion; should range from 30-366 days +accountTtl days:int32 = AccountTtl; + + +//@description 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 +//@id Session identifier @is_current True, if this session is the current session +//@is_password_pending True, if a password is needed to complete authorization of the session +//@api_id Telegram API identifier, as provided by the application @application_name Name of the application, as provided by the application +//@application_version The version of the application, as provided by the application @is_official_application True, if the application is an official application or uses the api_id of an official application +//@device_model Model of the device the application has been run or is running on, as provided by the application @platform Operating system the application has been run or is running on, as provided by the application +//@system_version Version of the operating system the application has been run or is running on, as provided by the application @log_in_date Point in time (Unix timestamp) when the user has logged in +//@last_active_date Point in time (Unix timestamp) when the session was last used @ip IP address from which the session was created, in human-readable format +//@country A two-letter country code for the country from which the session was created, based on the IP address @region Region code from which the session was created, based on the IP address +session id:int64 is_current:Bool is_password_pending:Bool api_id:int32 application_name:string application_version:string is_official_application:Bool device_model:string platform:string system_version:string log_in_date:int32 last_active_date:int32 ip:string country:string region:string = Session; + +//@description Contains a list of sessions @sessions List of sessions +sessions sessions:vector = Sessions; + + +//@description Contains information about one website the current user is logged in with Telegram +//@id Website identifier +//@domain_name The domain name of the website +//@bot_user_id User identifier of a bot linked with the website +//@browser The version of a browser used to log in +//@platform Operating system the browser is running on +//@log_in_date Point in time (Unix timestamp) when the user was logged in +//@last_active_date Point in time (Unix timestamp) when obtained authorization was last used +//@ip IP address from which the user was logged in, in human-readable format +//@location Human-readable description of a country and a region, from which the user was logged in, based on the IP address +connectedWebsite id:int64 domain_name:string bot_user_id:int32 browser:string platform:string log_in_date:int32 last_active_date:int32 ip:string location:string = ConnectedWebsite; + +//@description Contains a list of websites the current user is logged in with Telegram @websites List of connected websites +connectedWebsites websites:vector = ConnectedWebsites; + + +//@class ChatReportReason @description Describes the reason why a chat is reported + +//@description The chat contains spam messages +chatReportReasonSpam = ChatReportReason; + +//@description The chat promotes violence +chatReportReasonViolence = ChatReportReason; + +//@description The chat contains pornographic messages +chatReportReasonPornography = ChatReportReason; + +//@description The chat has child abuse related content +chatReportReasonChildAbuse = ChatReportReason; + +//@description The chat contains copyrighted content +chatReportReasonCopyright = ChatReportReason; + +//@description The location-based chat is unrelated to its stated location +chatReportReasonUnrelatedLocation = ChatReportReason; + +//@description A custom reason provided by the user @text Report text +chatReportReasonCustom text:string = ChatReportReason; + + +//@description Contains an HTTPS link to a message in a supergroup or channel @link Message link @is_public True, if the link will work for non-members of the chat +messageLink link:string is_public:Bool = MessageLink; + +//@description Contains information about a link to a message in a chat +//@is_public True, if the link is a public link for a message in a chat +//@chat_id If found, identifier of the chat to which the message belongs, 0 otherwise +//@message If found, the linked message; may be null +//@for_album True, if the whole media album to which the message belongs is linked +//@for_comment True, if the message is linked as a channel post comment or from a message thread +messageLinkInfo is_public:Bool chat_id:int53 message:message for_album:Bool for_comment:Bool = MessageLinkInfo; + + +//@description Contains a part of a file @data File bytes +filePart data:bytes = FilePart; + + +//@class FileType @description Represents the type of a file + +//@description The data is not a file +fileTypeNone = FileType; + +//@description The file is an animation +fileTypeAnimation = FileType; + +//@description The file is an audio file +fileTypeAudio = FileType; + +//@description The file is a document +fileTypeDocument = FileType; + +//@description The file is a photo +fileTypePhoto = FileType; + +//@description The file is a profile photo +fileTypeProfilePhoto = FileType; + +//@description The file was sent to a secret chat (the file type is not known to the server) +fileTypeSecret = FileType; + +//@description The file is a thumbnail of a file from a secret chat +fileTypeSecretThumbnail = FileType; + +//@description The file is a file from Secure storage used for storing Telegram Passport files +fileTypeSecure = FileType; + +//@description The file is a sticker +fileTypeSticker = FileType; + +//@description The file is a thumbnail of another file +fileTypeThumbnail = FileType; + +//@description The file type is not yet known +fileTypeUnknown = FileType; + +//@description The file is a video +fileTypeVideo = FileType; + +//@description The file is a video note +fileTypeVideoNote = FileType; + +//@description The file is a voice note +fileTypeVoiceNote = FileType; + +//@description The file is a wallpaper or a background pattern +fileTypeWallpaper = FileType; + + +//@description Contains the storage usage statistics for a specific file type @file_type File type @size Total size of the files @count Total number of files +storageStatisticsByFileType file_type:FileType size:int53 count:int32 = StorageStatisticsByFileType; + +//@description Contains the storage usage statistics for a specific chat @chat_id Chat identifier; 0 if none @size Total size of the files in the chat @count Total number of files in the chat @by_file_type Statistics split by file types +storageStatisticsByChat chat_id:int53 size:int53 count:int32 by_file_type:vector = StorageStatisticsByChat; + +//@description Contains the exact storage usage statistics split by chats and file type @size Total size of files @count Total number of files @by_chat Statistics split by chats +storageStatistics size:int53 count:int32 by_chat:vector = StorageStatistics; + +//@description Contains approximate storage usage statistics, excluding files of unknown file type @files_size Approximate total size of files @file_count Approximate number of files +//@database_size Size of the database @language_pack_database_size Size of the language pack database @log_size Size of the TDLib internal log +storageStatisticsFast files_size:int53 file_count:int32 database_size:int53 language_pack_database_size:int53 log_size:int53 = StorageStatisticsFast; + +//@description Contains database statistics +//@statistics Database statistics in an unspecified human-readable format +databaseStatistics statistics:string = DatabaseStatistics; + + +//@class NetworkType @description Represents the type of a network + +//@description The network is not available +networkTypeNone = NetworkType; + +//@description A mobile network +networkTypeMobile = NetworkType; + +//@description A mobile roaming network +networkTypeMobileRoaming = NetworkType; + +//@description A Wi-Fi network +networkTypeWiFi = NetworkType; + +//@description A different network type (e.g., Ethernet network) +networkTypeOther = NetworkType; + + +//@class NetworkStatisticsEntry @description Contains statistics about network usage + +//@description Contains information about the total amount of data that was used to send and receive files @file_type Type of the file the data is part of @network_type Type of the network the data was sent through. Call setNetworkType to maintain the actual network type +//@sent_bytes Total number of bytes sent @received_bytes Total number of bytes received +networkStatisticsEntryFile file_type:FileType network_type:NetworkType sent_bytes:int53 received_bytes:int53 = NetworkStatisticsEntry; + +//@description Contains information about the total amount of data that was used for calls @network_type Type of the network the data was sent through. Call setNetworkType to maintain the actual network type +//@sent_bytes Total number of bytes sent @received_bytes Total number of bytes received @duration Total call duration, in seconds +networkStatisticsEntryCall network_type:NetworkType sent_bytes:int53 received_bytes:int53 duration:double = NetworkStatisticsEntry; + +//@description A full list of available network statistic entries @since_date Point in time (Unix timestamp) from which the statistics are collected @entries Network statistics entries +networkStatistics since_date:int32 entries:vector = NetworkStatistics; + + +//@description Contains auto-download settings +//@is_auto_download_enabled True, if the auto-download is enabled +//@max_photo_file_size The maximum size of a photo file to be auto-downloaded +//@max_video_file_size The maximum size of a video file to be auto-downloaded +//@max_other_file_size The maximum size of other file types to be auto-downloaded +//@video_upload_bitrate The maximum suggested bitrate for uploaded videos +//@preload_large_videos True, if the beginning of video files needs to be preloaded for instant playback +//@preload_next_audio True, if the next audio track needs to be preloaded while the user is listening to an audio file +//@use_less_data_for_calls True, if "use less data for calls" option needs to be enabled +autoDownloadSettings is_auto_download_enabled:Bool max_photo_file_size:int32 max_video_file_size:int32 max_other_file_size:int32 video_upload_bitrate:int32 preload_large_videos:Bool preload_next_audio:Bool use_less_data_for_calls:Bool = AutoDownloadSettings; + +//@description Contains auto-download settings presets for the user +//@low Preset with lowest settings; supposed to be used by default when roaming +//@medium Preset with medium settings; supposed to be used by default when using mobile data +//@high Preset with highest settings; supposed to be used by default when connected on Wi-Fi +autoDownloadSettingsPresets low:autoDownloadSettings medium:autoDownloadSettings high:autoDownloadSettings = AutoDownloadSettingsPresets; + + +//@class ConnectionState @description Describes the current state of the connection to Telegram servers + +//@description Currently waiting for the network to become available. Use setNetworkType to change the available network type +connectionStateWaitingForNetwork = ConnectionState; + +//@description Currently establishing a connection with a proxy server +connectionStateConnectingToProxy = ConnectionState; + +//@description Currently establishing a connection to the Telegram servers +connectionStateConnecting = ConnectionState; + +//@description Downloading data received while the application was offline +connectionStateUpdating = ConnectionState; + +//@description There is a working connection to the Telegram servers +connectionStateReady = ConnectionState; + + +//@class TopChatCategory @description Represents the categories of chats for which a list of frequently used chats can be retrieved + +//@description A category containing frequently used private chats with non-bot users +topChatCategoryUsers = TopChatCategory; + +//@description A category containing frequently used private chats with bot users +topChatCategoryBots = TopChatCategory; + +//@description A category containing frequently used basic groups and supergroups +topChatCategoryGroups = TopChatCategory; + +//@description A category containing frequently used channels +topChatCategoryChannels = TopChatCategory; + +//@description A category containing frequently used chats with inline bots sorted by their usage in inline mode +topChatCategoryInlineBots = TopChatCategory; + +//@description A category containing frequently used chats used for calls +topChatCategoryCalls = TopChatCategory; + +//@description A category containing frequently used chats used to forward messages +topChatCategoryForwardChats = TopChatCategory; + + +//@class TMeUrlType @description Describes the type of a URL linking to an internal Telegram entity + +//@description A URL linking to a user @user_id Identifier of the user +tMeUrlTypeUser user_id:int32 = TMeUrlType; + +//@description A URL linking to a public supergroup or channel @supergroup_id Identifier of the supergroup or channel +tMeUrlTypeSupergroup supergroup_id:int53 = TMeUrlType; + +//@description A chat invite link @info Chat invite link info +tMeUrlTypeChatInvite info:chatInviteLinkInfo = TMeUrlType; + +//@description A URL linking to a sticker set @sticker_set_id Identifier of the sticker set +tMeUrlTypeStickerSet sticker_set_id:int64 = TMeUrlType; + +//@description Represents a URL linking to an internal Telegram entity @url URL @type Type of the URL +tMeUrl url:string type:TMeUrlType = TMeUrl; + +//@description Contains a list of t.me URLs @urls List of URLs +tMeUrls urls:vector = TMeUrls; + + +//@class SuggestedAction @description Describes an action suggested to the current user + +//@description Suggests the user to enable "archive_and_mute_new_chats_from_unknown_users" option +suggestedActionEnableArchiveAndMuteNewChats = SuggestedAction; + +//@description Suggests the user to check authorization phone number and change the phone number if it is inaccessible +suggestedActionCheckPhoneNumber = SuggestedAction; + + +//@description Contains a counter @count Count +count count:int32 = Count; + +//@description Contains some text @text Text +text text:string = Text; + +//@description Contains a value representing a number of seconds @seconds Number of seconds +seconds seconds:double = Seconds; + + +//@description Contains information about a tg:// deep link @text Text to be shown to the user @need_update_application True, if user should be asked to update the application +deepLinkInfo text:formattedText need_update_application:Bool = DeepLinkInfo; + + +//@class TextParseMode @description Describes the way the text should be parsed for TextEntities + +//@description The text uses Markdown-style formatting +//@version Version of the parser: 0 or 1 - Telegram Bot API "Markdown" parse mode, 2 - Telegram Bot API "MarkdownV2" parse mode +textParseModeMarkdown version:int32 = TextParseMode; + +//@description The text uses HTML-style formatting. The same as Telegram Bot API "HTML" parse mode +textParseModeHTML = TextParseMode; + + +//@class ProxyType @description Describes the type of a proxy server + +//@description A SOCKS5 proxy server @username Username for logging in; may be empty @password Password for logging in; may be empty +proxyTypeSocks5 username:string password:string = ProxyType; + +//@description A HTTP transparent proxy server @username Username for logging in; may be empty @password Password for logging in; may be empty @http_only Pass true if the proxy supports only HTTP requests and doesn't support transparent TCP connections via HTTP CONNECT method +proxyTypeHttp username:string password:string http_only:Bool = ProxyType; + +//@description An MTProto proxy server @secret The proxy's secret in hexadecimal encoding +proxyTypeMtproto secret:string = ProxyType; + + +//@description Contains information about a proxy server @id Unique identifier of the proxy @server Proxy server IP address @port Proxy server port @last_used_date Point in time (Unix timestamp) when the proxy was last used; 0 if never @is_enabled True, if the proxy is enabled now @type Type of the proxy +proxy id:int32 server:string port:int32 last_used_date:int32 is_enabled:Bool type:ProxyType = Proxy; + +//@description Represents a list of proxy servers @proxies List of proxy servers +proxies proxies:vector = Proxies; + + +//@class InputSticker @description Describes a sticker that needs to be added to a sticker set + +//@description A static sticker in PNG format, which will be converted to WEBP server-side +//@sticker PNG image with the sticker; must be up to 512 KB in size and fit in a 512x512 square +//@emojis Emojis corresponding to the sticker +//@mask_position For masks, position where the mask should be placed; may be null +inputStickerStatic sticker:InputFile emojis:string mask_position:maskPosition = InputSticker; + +//@description An animated sticker in TGS format +//@sticker File with the animated sticker. Only local or uploaded within a week files are supported. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements +//@emojis Emojis corresponding to the sticker +inputStickerAnimated sticker:InputFile emojis:string = InputSticker; + + +//@description Represents a date range @start_date Point in time (Unix timestamp) at which the date range begins @end_date Point in time (Unix timestamp) at which the date range ends +dateRange start_date:int32 end_date:int32 = DateRange; + + +//@description A value with information about its recent changes @value The current value @previous_value The value for the previous day @growth_rate_percentage The growth rate of the value, as a percentage +statisticalValue value:double previous_value:double growth_rate_percentage:double = StatisticalValue; + + +//@class StatisticalGraph @description Describes a statistical graph + +//@description A graph data @json_data Graph data in JSON format @zoom_token If non-empty, a token which can be used to receive a zoomed in graph +statisticalGraphData json_data:string zoom_token:string = StatisticalGraph; + +//@description The graph data to be asynchronously loaded through getStatisticalGraph @token The token to use for data loading +statisticalGraphAsync token:string = StatisticalGraph; + +//@description An error message to be shown to the user instead of the graph @error_message The error message +statisticalGraphError error_message:string = StatisticalGraph; + + +//@description Contains statistics about interactions with a message +//@message_id Message identifier +//@view_count Number of times the message was viewed +//@forward_count Number of times the message was forwarded +chatStatisticsMessageInteractionInfo message_id:int53 view_count:int32 forward_count:int32 = ChatStatisticsMessageInteractionInfo; + +//@description Contains statistics about messages sent by a user +//@user_id User identifier +//@sent_message_count Number of sent messages +//@average_character_count Average number of characters in sent messages +chatStatisticsMessageSenderInfo user_id:int32 sent_message_count:int32 average_character_count:int32 = ChatStatisticsMessageSenderInfo; + +//@description Contains statistics about administrator actions done by a user +//@user_id Administrator user identifier +//@deleted_message_count Number of messages deleted by the administrator +//@banned_user_count Number of users banned by the administrator +//@restricted_user_count Number of users restricted by the administrator +chatStatisticsAdministratorActionsInfo user_id:int32 deleted_message_count:int32 banned_user_count:int32 restricted_user_count:int32 = ChatStatisticsAdministratorActionsInfo; + +//@description Contains statistics about number of new members invited by a user +//@user_id User identifier +//@added_member_count Number of new members invited by the user +chatStatisticsInviterInfo user_id:int32 added_member_count:int32 = ChatStatisticsInviterInfo; + + +//@class ChatStatistics @description Contains a detailed statistics about a chat + +//@description A detailed statistics about a supergroup chat +//@period A period to which the statistics applies +//@member_count Number of members in the chat +//@message_count Number of messages sent to the chat +//@viewer_count Number of users who viewed messages in the chat +//@sender_count Number of users who sent messages to the chat +//@member_count_graph A graph containing number of members in the chat +//@join_graph A graph containing number of members joined and left the chat +//@join_by_source_graph A graph containing number of new member joins per source +//@language_graph A graph containing distribution of active users per language +//@message_content_graph A graph containing distribution of sent messages by content type +//@action_graph A graph containing number of different actions in the chat +//@day_graph A graph containing distribution of message views per hour +//@week_graph A graph containing distribution of message views per day of week +//@top_senders List of users sent most messages in the last week +//@top_administrators List of most active administrators in the last week +//@top_inviters List of most active inviters of new members in the last week +chatStatisticsSupergroup period:dateRange member_count:statisticalValue message_count:statisticalValue viewer_count:statisticalValue sender_count:statisticalValue member_count_graph:StatisticalGraph join_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_content_graph:StatisticalGraph action_graph:StatisticalGraph day_graph:StatisticalGraph week_graph:StatisticalGraph top_senders:vector top_administrators:vector top_inviters:vector = ChatStatistics; + +//@description A detailed statistics about a channel chat +//@period A period to which the statistics applies +//@member_count Number of members in the chat +//@mean_view_count Mean number of times the recently sent messages was viewed +//@mean_share_count Mean number of times the recently sent messages was shared +//@enabled_notifications_percentage A percentage of users with enabled notifications for the chat +//@member_count_graph A graph containing number of members in the chat +//@join_graph A graph containing number of members joined and left the chat +//@mute_graph A graph containing number of members muted and unmuted the chat +//@view_count_by_hour_graph A graph containing number of message views in a given hour in the last two weeks +//@view_count_by_source_graph A graph containing number of message views per source +//@join_by_source_graph A graph containing number of new member joins per source +//@language_graph A graph containing number of users viewed chat messages per language +//@message_interaction_graph A graph containing number of chat message views and shares +//@instant_view_interaction_graph A graph containing number of views of associated with the chat instant views +//@recent_message_interactions Detailed statistics about number of views and shares of recently sent messages +chatStatisticsChannel period:dateRange member_count:statisticalValue mean_view_count:statisticalValue mean_share_count:statisticalValue enabled_notifications_percentage:double member_count_graph:StatisticalGraph join_graph:StatisticalGraph mute_graph:StatisticalGraph view_count_by_hour_graph:StatisticalGraph view_count_by_source_graph:StatisticalGraph join_by_source_graph:StatisticalGraph language_graph:StatisticalGraph message_interaction_graph:StatisticalGraph instant_view_interaction_graph:StatisticalGraph recent_message_interactions:vector = ChatStatistics; + + +//@description A detailed statistics about a message @message_interaction_graph A graph containing number of message views and shares +messageStatistics message_interaction_graph:StatisticalGraph = MessageStatistics; + + +//@class Update @description Contains notifications about data changes + +//@description The user authorization state has changed @authorization_state New authorization state +updateAuthorizationState authorization_state:AuthorizationState = Update; + +//@description A new message was received; can also be an outgoing message @message The new message +updateNewMessage message:message = Update; + +//@description 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 +//@chat_id The chat identifier of the sent message @message_id A temporary message identifier +updateMessageSendAcknowledged chat_id:int53 message_id:int53 = Update; + +//@description A message has been successfully sent @message Information about the sent message. Usually only the message identifier, date, and content are changed, but almost all other fields can also change @old_message_id The previous temporary message identifier +updateMessageSendSucceeded message:message old_message_id:int53 = Update; + +//@description 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 +//@message Contains information about the message which failed to send @old_message_id The previous temporary message identifier @error_code An error code @error_message Error message +updateMessageSendFailed message:message old_message_id:int53 error_code:int32 error_message:string = Update; + +//@description The message content has changed @chat_id Chat identifier @message_id Message identifier @new_content New message content +updateMessageContent chat_id:int53 message_id:int53 new_content:MessageContent = Update; + +//@description A message was edited. Changes in the message content will come in a separate updateMessageContent @chat_id Chat identifier @message_id Message identifier @edit_date Point in time (Unix timestamp) when the message was edited @reply_markup New message reply markup; may be null +updateMessageEdited chat_id:int53 message_id:int53 edit_date:int32 reply_markup:ReplyMarkup = Update; + +//@description The message pinned state was changed @chat_id Chat identifier @message_id The message identifier @is_pinned True, if the message is pinned +updateMessageIsPinned chat_id:int53 message_id:int53 is_pinned:Bool = Update; + +//@description The information about interactions with a message has changed @chat_id Chat identifier @message_id Message identifier @interaction_info New information about interactions with the message; may be null +updateMessageInteractionInfo chat_id:int53 message_id:int53 interaction_info:messageInteractionInfo = Update; + +//@description 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 @chat_id Chat identifier @message_id Message identifier +updateMessageContentOpened chat_id:int53 message_id:int53 = Update; + +//@description A message with an unread mention was read @chat_id Chat identifier @message_id Message identifier @unread_mention_count The new number of unread mention messages left in the chat +updateMessageMentionRead chat_id:int53 message_id:int53 unread_mention_count:int32 = Update; + +//@description A message with a live location was viewed. When the update is received, the application is supposed to update the live location +//@chat_id Identifier of the chat with the live location message @message_id Identifier of the message with live location +updateMessageLiveLocationViewed chat_id:int53 message_id:int53 = Update; + +//@description A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the application. The chat field changes will be reported through separate updates @chat The chat +updateNewChat chat:chat = Update; + +//@description The title of a chat was changed @chat_id Chat identifier @title The new chat title +updateChatTitle chat_id:int53 title:string = Update; + +//@description A chat photo was changed @chat_id Chat identifier @photo The new chat photo; may be null +updateChatPhoto chat_id:int53 photo:chatPhotoInfo = Update; + +//@description Chat permissions was changed @chat_id Chat identifier @permissions The new chat permissions +updateChatPermissions chat_id:int53 permissions:chatPermissions = Update; + +//@description 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 @chat_id Chat identifier @last_message The new last message in the chat; may be null @positions The new chat positions in the chat lists +updateChatLastMessage chat_id:int53 last_message:message positions:vector = Update; + +//@description The position of a chat in a chat list has changed. Instead of this update updateChatLastMessage or updateChatDraftMessage might be sent @chat_id Chat identifier @position New chat position. If new order is 0, then the chat needs to be removed from the list +updateChatPosition chat_id:int53 position:chatPosition = Update; + +//@description A chat was marked as unread or was read @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread +updateChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Update; + +//@description A chat was blocked or unblocked @chat_id Chat identifier @is_blocked New value of is_blocked +updateChatIsBlocked chat_id:int53 is_blocked:Bool = Update; + +//@description A chat's has_scheduled_messages field has changed @chat_id Chat identifier @has_scheduled_messages New value of has_scheduled_messages +updateChatHasScheduledMessages chat_id:int53 has_scheduled_messages:Bool = Update; + +//@description The value of the default disable_notification parameter, used when a message is sent to the chat, was changed @chat_id Chat identifier @default_disable_notification The new default_disable_notification value +updateChatDefaultDisableNotification chat_id:int53 default_disable_notification:Bool = Update; + +//@description Incoming messages were read or number of unread messages has been changed @chat_id Chat identifier @last_read_inbox_message_id Identifier of the last read incoming message @unread_count The number of unread messages left in the chat +updateChatReadInbox chat_id:int53 last_read_inbox_message_id:int53 unread_count:int32 = Update; + +//@description Outgoing messages were read @chat_id Chat identifier @last_read_outbox_message_id Identifier of last read outgoing message +updateChatReadOutbox chat_id:int53 last_read_outbox_message_id:int53 = Update; + +//@description The chat unread_mention_count has changed @chat_id Chat identifier @unread_mention_count The number of unread mention messages left in the chat +updateChatUnreadMentionCount chat_id:int53 unread_mention_count:int32 = Update; + +//@description Notification settings for a chat were changed @chat_id Chat identifier @notification_settings The new notification settings +updateChatNotificationSettings chat_id:int53 notification_settings:chatNotificationSettings = Update; + +//@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings +updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; + +//@description The chat action bar was changed @chat_id Chat identifier @action_bar The new value of the action bar; may be null +updateChatActionBar chat_id:int53 action_bar:ChatActionBar = Update; + +//@description 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 +//@chat_id Chat identifier @reply_markup_message_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 +updateChatReplyMarkup chat_id:int53 reply_markup_message_id:int53 = Update; + +//@description 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 @chat_id Chat identifier @draft_message The new draft message; may be null @positions The new chat positions in the chat lists +updateChatDraftMessage chat_id:int53 draft_message:draftMessage positions:vector = Update; + +//@description The list of chat filters or a chat filter has changed @chat_filters The new list of chat filters +updateChatFilters chat_filters:vector = Update; + +//@description 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 @chat_id Identifier of the chat @online_member_count New number of online members in the chat, or 0 if unknown +updateChatOnlineMemberCount chat_id:int53 online_member_count:int32 = Update; + +//@description A notification was changed @notification_group_id Unique notification group identifier @notification Changed notification +updateNotification notification_group_id:int32 notification:notification = Update; + +//@description A list of active notifications in a notification group has changed +//@notification_group_id Unique notification group identifier +//@type New type of the notification group +//@chat_id Identifier of a chat to which all notifications in the group belong +//@notification_settings_chat_id Chat identifier, which notification settings must be applied to the added notifications +//@is_silent True, if the notifications should be shown without sound +//@total_count Total number of unread notifications in the group, can be bigger than number of active notifications +//@added_notifications List of added group notifications, sorted by notification ID @removed_notification_ids Identifiers of removed group notifications, sorted by notification ID +updateNotificationGroup notification_group_id:int32 type:NotificationGroupType chat_id:int53 notification_settings_chat_id:int53 is_silent:Bool total_count:int32 added_notifications:vector removed_notification_ids:vector = Update; + +//@description Contains active notifications that was shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update @groups Lists of active notification groups +updateActiveNotifications groups:vector = Update; + +//@description Describes whether there are some pending notification updates. Can be used to prevent application from killing, while there are some pending notifications +//@have_delayed_notifications True, if there are some delayed notification updates, which will be sent soon +//@have_unreceived_notifications True, if there can be some yet unreceived notifications, which are being fetched from the server +updateHavePendingNotifications have_delayed_notifications:Bool have_unreceived_notifications:Bool = Update; + +//@description Some messages were deleted @chat_id Chat identifier @message_ids Identifiers of the deleted messages +//@is_permanent True, if the messages are permanently deleted by a user (as opposed to just becoming inaccessible) +//@from_cache True, if the messages are deleted only from the cache and can possibly be retrieved again in the future +updateDeleteMessages chat_id:int53 message_ids:vector is_permanent:Bool from_cache:Bool = Update; + +//@description User activity in the chat has changed @chat_id Chat identifier @message_thread_id If not 0, a message thread identifier in which the action was performed @user_id Identifier of a user performing an action @action The action description +updateUserChatAction chat_id:int53 message_thread_id:int53 user_id:int32 action:ChatAction = Update; + +//@description The user went online or offline @user_id User identifier @status New status of the user +updateUserStatus user_id:int32 status:UserStatus = Update; + +//@description Some data of a user has changed. This update is guaranteed to come before the user identifier is returned to the application @user New data about the user +updateUser user:user = Update; + +//@description Some data of a basic group has changed. This update is guaranteed to come before the basic group identifier is returned to the application @basic_group New data about the group +updateBasicGroup basic_group:basicGroup = Update; + +//@description Some data of a supergroup or a channel has changed. This update is guaranteed to come before the supergroup identifier is returned to the application @supergroup New data about the supergroup +updateSupergroup supergroup:supergroup = Update; + +//@description Some data of a secret chat has changed. This update is guaranteed to come before the secret chat identifier is returned to the application @secret_chat New data about the secret chat +updateSecretChat secret_chat:secretChat = Update; + +//@description Some data from userFullInfo has been changed @user_id User identifier @user_full_info New full information about the user +updateUserFullInfo user_id:int32 user_full_info:userFullInfo = Update; + +//@description Some data from basicGroupFullInfo has been changed @basic_group_id Identifier of a basic group @basic_group_full_info New full information about the group +updateBasicGroupFullInfo basic_group_id:int32 basic_group_full_info:basicGroupFullInfo = Update; + +//@description Some data from supergroupFullInfo has been changed @supergroup_id Identifier of the supergroup or channel @supergroup_full_info New full information about the supergroup +updateSupergroupFullInfo supergroup_id:int32 supergroup_full_info:supergroupFullInfo = Update; + +//@description Service notification from the server. Upon receiving this the application must show a popup with the content of the notification +//@type 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 +//@content Notification content +updateServiceNotification type:string content:MessageContent = Update; + +//@description Information about a file was updated @file New data about the file +updateFile file:file = Update; + +//@description The file generation process needs to be started by the application +//@generation_id Unique identifier for the generation process +//@original_path The path to a file from which a new file is generated; may be empty +//@destination_path The path to a file that should be created and where the new file should be generated +//@conversion 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 application +updateFileGenerationStart generation_id:int64 original_path:string destination_path:string conversion:string = Update; + +//@description File generation is no longer needed @generation_id Unique identifier for the generation process +updateFileGenerationStop generation_id:int64 = Update; + +//@description New call was created or information about a call was updated @call New data about a call +updateCall call:call = Update; + +//@description New call signaling data arrived @call_id The call identifier @data The data +updateNewCallSignalingData call_id:int32 data:bytes = Update; + +//@description Some privacy setting rules have been changed @setting The privacy setting @rules New privacy rules +updateUserPrivacySettingRules setting:UserPrivacySetting rules:userPrivacySettingRules = Update; + +//@description Number of unread messages in a chat list has changed. This update is sent only if the message database is used @chat_list The chat list with changed number of unread messages +//@unread_count Total number of unread messages @unread_unmuted_count Total number of unread messages in unmuted chats +updateUnreadMessageCount chat_list:ChatList unread_count:int32 unread_unmuted_count:int32 = Update; + +//@description Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if the message database is used +//@chat_list The chat list with changed number of unread messages +//@total_count Approximate total number of chats in the chat list +//@unread_count Total number of unread chats @unread_unmuted_count Total number of unread unmuted chats +//@marked_as_unread_count Total number of chats marked as unread @marked_as_unread_unmuted_count Total number of unmuted chats marked as unread +updateUnreadChatCount chat_list:ChatList total_count:int32 unread_count:int32 unread_unmuted_count:int32 marked_as_unread_count:int32 marked_as_unread_unmuted_count:int32 = Update; + +//@description An option changed its value @name The option name @value The new option value +updateOption name:string value:OptionValue = Update; + +//@description A sticker set has changed @sticker_set The sticker set +updateStickerSet sticker_set:stickerSet = Update; + +//@description The list of installed sticker sets was updated @is_masks True, if the list of installed mask sticker sets was updated @sticker_set_ids The new list of installed ordinary sticker sets +updateInstalledStickerSets is_masks:Bool sticker_set_ids:vector = Update; + +//@description The list of trending sticker sets was updated or some of them were viewed @sticker_sets The prefix of the list of trending sticker sets with the newest trending sticker sets +updateTrendingStickerSets sticker_sets:stickerSets = Update; + +//@description The list of recently used stickers was updated @is_attached True, if the list of stickers attached to photo or video files was updated, otherwise the list of sent stickers is updated @sticker_ids The new list of file identifiers of recently used stickers +updateRecentStickers is_attached:Bool sticker_ids:vector = Update; + +//@description The list of favorite stickers was updated @sticker_ids The new list of file identifiers of favorite stickers +updateFavoriteStickers sticker_ids:vector = Update; + +//@description The list of saved animations was updated @animation_ids The new list of file identifiers of saved animations +updateSavedAnimations animation_ids:vector = Update; + +//@description The selected background has changed @for_dark_theme True, if background for dark theme has changed @background The new selected background; may be null +updateSelectedBackground for_dark_theme:Bool background:background = Update; + +//@description Some language pack strings have been updated @localization_target Localization target to which the language pack belongs @language_pack_id Identifier of the updated language pack @strings List of changed language pack strings +updateLanguagePackStrings localization_target:string language_pack_id:string strings:vector = Update; + +//@description The connection state has changed. This update must be used only to show a human-readable description of the connection state @state The new connection state +updateConnectionState state:ConnectionState = Update; + +//@description 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" @terms_of_service_id Identifier of the terms of service @terms_of_service The new terms of service +updateTermsOfService terms_of_service_id:string terms_of_service:termsOfService = Update; + +//@description The list of users nearby has changed. The update is guaranteed to be sent only 60 seconds after a successful searchChatsNearby request @users_nearby The new list of users nearby +updateUsersNearby users_nearby:vector = Update; + +//@description The list of supported dice emojis has changed @emojis The new list of supported dice emojis +updateDiceEmojis emojis:vector = Update; + +//@description The parameters of animation search through GetOption("animation_search_bot_username") bot has changed @provider Name of the animation search provider @emojis The new list of emojis suggested for searching +updateAnimationSearchParameters provider:string emojis:vector = Update; + +//@description The list of suggested to the user actions has changed @added_actions Added suggested actions @removed_actions Removed suggested actions +updateSuggestedActions added_actions:vector removed_actions:vector = Update; + +//@description A new incoming inline query; for bots only @id Unique query identifier @sender_user_id Identifier of the user who sent the query @user_location User location; may be null +//@query Text of the query @offset Offset of the first entry to return +updateNewInlineQuery id:int64 sender_user_id:int32 user_location:location query:string offset:string = Update; + +//@description The user has chosen a result of an inline query; for bots only @sender_user_id Identifier of the user who sent the query @user_location User location; may be null +//@query Text of the query @result_id Identifier of the chosen result @inline_message_id Identifier of the sent inline message, if known +updateNewChosenInlineResult sender_user_id:int32 user_location:location query:string result_id:string inline_message_id:string = Update; + +//@description A new incoming callback query; for bots only @id Unique query identifier @sender_user_id Identifier of the user who sent the query +//@chat_id Identifier of the chat where the query was sent @message_id Identifier of the message, from which the query originated +//@chat_instance Identifier that uniquely corresponds to the chat to which the message was sent @payload Query payload +updateNewCallbackQuery id:int64 sender_user_id:int32 chat_id:int53 message_id:int53 chat_instance:int64 payload:CallbackQueryPayload = Update; + +//@description A new incoming callback query from a message sent via a bot; for bots only @id Unique query identifier @sender_user_id Identifier of the user who sent the query @inline_message_id Identifier of the inline message, from which the query originated +//@chat_instance An identifier uniquely corresponding to the chat a message was sent to @payload Query payload +updateNewInlineCallbackQuery id:int64 sender_user_id:int32 inline_message_id:string chat_instance:int64 payload:CallbackQueryPayload = Update; + +//@description A new incoming shipping query; for bots only. Only for invoices with flexible price @id Unique query identifier @sender_user_id Identifier of the user who sent the query @invoice_payload Invoice payload @shipping_address User shipping address +updateNewShippingQuery id:int64 sender_user_id:int32 invoice_payload:string shipping_address:address = Update; + +//@description A new incoming pre-checkout query; for bots only. Contains full information about a checkout @id Unique query identifier @sender_user_id Identifier of the user who sent the query @currency Currency for the product price @total_amount Total price for the product, in the minimal quantity of the currency +//@invoice_payload Invoice payload @shipping_option_id Identifier of a shipping option chosen by the user; may be empty if not applicable @order_info Information about the order; may be null +updateNewPreCheckoutQuery id:int64 sender_user_id:int32 currency:string total_amount:int53 invoice_payload:bytes shipping_option_id:string order_info:orderInfo = Update; + +//@description A new incoming event; for bots only @event A JSON-serialized event +updateNewCustomEvent event:string = Update; + +//@description A new incoming query; for bots only @id The query identifier @data JSON-serialized query data @timeout Query timeout +updateNewCustomQuery id:int64 data:string timeout:int32 = Update; + +//@description A poll was updated; for bots only @poll New data about the poll +updatePoll poll:poll = Update; + +//@description A user changed the answer to a poll; for bots only @poll_id Unique poll identifier @user_id The user, who changed the answer to the poll @option_ids 0-based identifiers of answer options, chosen by the user +updatePollAnswer poll_id:int64 user_id:int32 option_ids:vector = Update; + + +//@description Contains a list of updates @updates List of updates +updates updates:vector = Updates; + + +//@class LogStream @description Describes a stream to which TDLib internal log is written + +//@description The log is written to stderr or an OS specific log +logStreamDefault = LogStream; + +//@description The log is written to a file +//@path Path to the file to where the internal TDLib log will be written +//@max_file_size The maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated +//@redirect_stderr Pass true to additionally redirect stderr to the log file. Ignored on Windows +logStreamFile path:string max_file_size:int53 redirect_stderr:Bool = LogStream; + +//@description The log is written nowhere +logStreamEmpty = LogStream; + + +//@description Contains a TDLib internal log verbosity level @verbosity_level Log verbosity level +logVerbosityLevel verbosity_level:int32 = LogVerbosityLevel; + +//@description Contains a list of available TDLib internal log tags @tags List of log tags +logTags tags:vector = LogTags; + + +//@description A simple object containing a number; for testing only @value Number +testInt value:int32 = TestInt; +//@description A simple object containing a string; for testing only @value String +testString value:string = TestString; +//@description A simple object containing a sequence of bytes; for testing only @value Bytes +testBytes value:bytes = TestBytes; +//@description A simple object containing a vector of numbers; for testing only @value Vector of numbers +testVectorInt value:vector = TestVectorInt; +//@description A simple object containing a vector of objects that hold a number; for testing only @value Vector of objects +testVectorIntObject value:vector = TestVectorIntObject; +//@description A simple object containing a vector of strings; for testing only @value Vector of strings +testVectorString value:vector = TestVectorString; +//@description A simple object containing a vector of objects that hold a string; for testing only @value Vector of objects +testVectorStringObject value:vector = TestVectorStringObject; + +---functions--- + +//@description Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization +getAuthorizationState = AuthorizationState; + + +//@description Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters @parameters Parameters +setTdlibParameters parameters:tdlibParameters = Ok; + +//@description Checks the database encryption key for correctness. Works only when the current authorization state is authorizationStateWaitEncryptionKey @encryption_key Encryption key to check or set up +checkDatabaseEncryptionKey encryption_key:bytes = Ok; + +//@description Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, +//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +//@phone_number The phone number of the user, in international format @settings Settings for the authentication of the user's phone number +setAuthenticationPhoneNumber phone_number:string settings:phoneNumberAuthenticationSettings = Ok; + +//@description Re-sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode and the next_code_type of the result is not null +resendAuthenticationCode = Ok; + +//@description Checks the authentication code. Works only when the current authorization state is authorizationStateWaitCode @code The verification code received via SMS, Telegram message, phone call, or flash call +checkAuthenticationCode code:string = Ok; + +//@description Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, +//-or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +//@other_user_ids List of user identifiers of other users currently using the application +requestQrCodeAuthentication other_user_ids:vector = Ok; + +//@description Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration +//@first_name The first name of the user; 1-64 characters @last_name The last name of the user; 0-64 characters +registerUser first_name:string last_name:string = Ok; + +//@description Checks the authentication password for correctness. Works only when the current authorization state is authorizationStateWaitPassword @password The password to check +checkAuthenticationPassword password:string = Ok; + +//@description Requests to send a password recovery code to an email address that was previously set up. Works only when the current authorization state is authorizationStateWaitPassword +requestAuthenticationPasswordRecovery = Ok; + +//@description Recovers the password with a password recovery code sent to an email address that was previously set up. Works only when the current authorization state is authorizationStateWaitPassword @recovery_code Recovery code to check +recoverAuthenticationPassword recovery_code:string = Ok; + +//@description Checks the authentication token of a bot; to log in as a bot. Works only when the current authorization state is authorizationStateWaitPhoneNumber. Can be used instead of setAuthenticationPhoneNumber and checkAuthenticationCode to log in @token The bot token +checkAuthenticationBotToken token:string = Ok; + +//@description Closes the TDLib instance after a proper logout. Requires an available network connection. All local data will be destroyed. After the logout completes, updateAuthorizationState with authorizationStateClosed will be sent +logOut = Ok; + +//@description Closes the TDLib instance. All databases will be flushed to disk and properly closed. After the close completes, updateAuthorizationState with authorizationStateClosed will be sent. Can be called before initialization +close = Ok; + +//@description Closes the TDLib instance, destroying all local data without a proper logout. The current user session will remain in the list of all active sessions. All local data will be destroyed. After the destruction completes updateAuthorizationState with authorizationStateClosed will be sent. Can be called before authorization +destroy = Ok; + + +//@description Confirms QR code authentication on another device. Returns created session on success @link A link from a QR code. The link must be scanned by the in-app camera +confirmQrCodeAuthentication link:string = Session; + + +//@description Returns all updates needed to restore current TDLib state, i.e. all actual UpdateAuthorizationState/UpdateUser/UpdateNewChat and others. This is especially useful if TDLib is run in a separate process. Can be called before initialization +getCurrentState = Updates; + + +//@description Changes the database encryption key. Usually the encryption key is never changed and is stored in some OS keychain @new_encryption_key New encryption key +setDatabaseEncryptionKey new_encryption_key:bytes = Ok; + + +//@description Returns the current state of 2-step verification +getPasswordState = PasswordState; + +//@description Changes the password for the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed +//@old_password Previous password of the user @new_password New password of the user; may be empty to remove the password @new_hint New password hint; may be empty @set_recovery_email_address Pass true if the recovery email address should be changed @new_recovery_email_address New recovery email address; may be empty +setPassword old_password:string new_password:string new_hint:string set_recovery_email_address:Bool new_recovery_email_address:string = PasswordState; + +//@description Returns a 2-step verification recovery email address that was previously set up. This method can be used to verify a password provided by the user @password The password for the current user +getRecoveryEmailAddress password:string = RecoveryEmailAddress; + +//@description Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed. +//-If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation @password Password of the current user @new_recovery_email_address New recovery email address +setRecoveryEmailAddress password:string new_recovery_email_address:string = PasswordState; + +//@description Checks the 2-step verification recovery email address verification code @code Verification code +checkRecoveryEmailAddressCode code:string = PasswordState; + +//@description Resends the 2-step verification recovery email address verification code +resendRecoveryEmailAddressCode = PasswordState; + +//@description Requests to send a password recovery code to an email address that was previously set up +requestPasswordRecovery = EmailAddressAuthenticationCodeInfo; + +//@description Recovers the password using a recovery code sent to an email address that was previously set up @recovery_code Recovery code to check +recoverPassword recovery_code:string = PasswordState; + +//@description Creates a new temporary password for processing payments @password Persistent user password @valid_for Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 +createTemporaryPassword password:string valid_for:int32 = TemporaryPasswordState; + +//@description Returns information about the current temporary password +getTemporaryPasswordState = TemporaryPasswordState; + + +//@description Returns the current user +getMe = User; + +//@description Returns information about a user by their identifier. This is an offline request if the current user is not a bot @user_id User identifier +getUser user_id:int32 = User; + +//@description Returns full information about a user by their identifier @user_id User identifier +getUserFullInfo user_id:int32 = UserFullInfo; + +//@description Returns information about a basic group by its identifier. This is an offline request if the current user is not a bot @basic_group_id Basic group identifier +getBasicGroup basic_group_id:int32 = BasicGroup; + +//@description Returns full information about a basic group by its identifier @basic_group_id Basic group identifier +getBasicGroupFullInfo basic_group_id:int32 = BasicGroupFullInfo; + +//@description Returns information about a supergroup or a channel by its identifier. This is an offline request if the current user is not a bot @supergroup_id Supergroup or channel identifier +getSupergroup supergroup_id:int32 = Supergroup; + +//@description Returns full information about a supergroup or a channel by its identifier, cached for up to 1 minute @supergroup_id Supergroup or channel identifier +getSupergroupFullInfo supergroup_id:int32 = SupergroupFullInfo; + +//@description Returns information about a secret chat by its identifier. This is an offline request @secret_chat_id Secret chat identifier +getSecretChat secret_chat_id:int32 = SecretChat; + +//@description Returns information about a chat by its identifier, this is an offline request if the current user is not a bot @chat_id Chat identifier +getChat chat_id:int53 = Chat; + +//@description Returns information about a message @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get +getMessage chat_id:int53 message_id:int53 = Message; + +//@description Returns information about a message, if it is available locally without sending network request. This is an offline request @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get +getMessageLocally chat_id:int53 message_id:int53 = Message; + +//@description Returns information about a message that is replied by a given message. Also returns the pinned message, the game message, and the invoice message for messages of the types messagePinMessage, messageGameScore, and messagePaymentSuccessful respectively +//@chat_id Identifier of the chat the message belongs to @message_id Identifier of the message reply to which to get +getRepliedMessage chat_id:int53 message_id:int53 = Message; + +//@description Returns information about a newest pinned message in the chat @chat_id Identifier of the chat the message belongs to +getChatPinnedMessage chat_id:int53 = Message; + +//@description Returns information about a message with the callback button that originated a callback query; for bots only @chat_id Identifier of the chat the message belongs to @message_id Message identifier @callback_query_id Identifier of the callback query +getCallbackQueryMessage chat_id:int53 message_id:int53 callback_query_id:int64 = Message; + +//@description Returns information about messages. If a message is not found, returns null on the corresponding position of the result @chat_id Identifier of the chat the messages belong to @message_ids Identifiers of the messages to get +getMessages chat_id:int53 message_ids:vector = Messages; + +//@description Returns information about a message thread. Can be used only if message.can_get_message_thread == true @chat_id Chat identifier @message_id Identifier of the message +getMessageThread chat_id:int53 message_id:int53 = MessageThreadInfo; + +//@description Returns information about a file; this is an offline request @file_id Identifier of the file to get +getFile file_id:int32 = File; + +//@description Returns information about a file by its remote ID; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. +//-For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application +//@remote_file_id Remote identifier of the file to get @file_type File type, if known +getRemoteFile remote_file_id:string file_type:FileType = File; + +//@description Returns an ordered list of chats in a chat list. Chats are sorted by the pair (chat.position.order, chat.id) in descending order. (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed 64-bit number 9223372036854775807 == 2^63 - 1). +//-For optimal performance the number of returned chats is chosen by the library +//@chat_list The chat list in which to return chats +//@offset_order Chat order to return chats from @offset_chat_id Chat identifier to return chats from +//@limit The maximum number of chats to be returned. It is possible that fewer chats than the limit are returned even if the end of the list is not reached +getChats chat_list:ChatList offset_order:int64 offset_chat_id:int53 limit:int32 = Chats; + +//@description Searches a public chat by its username. Currently only private chats, supergroups and channels can be public. Returns the chat if found; otherwise an error is returned @username Username to be resolved +searchPublicChat username:string = Chat; + +//@description Searches public chats by looking for specified query in their username and title. Currently only private chats, supergroups and channels can be public. Returns a meaningful number of results. Returns nothing if the length of the searched username prefix is less than 5. Excludes private chats with contacts and chats from the chat list from the results @query Query to search for +searchPublicChats query:string = Chats; + +//@description Searches for the specified query in the title and username of already known chats, this is an offline request. Returns chats in the order seen in the main chat list @query Query to search for. If the query is empty, returns up to 20 recently found chats @limit The maximum number of chats to be returned +searchChats query:string limit:int32 = Chats; + +//@description Searches for the specified query in the title and username of already known chats via request to the server. Returns chats in the order seen in the main chat list @query Query to search for @limit The maximum number of chats to be returned +searchChatsOnServer query:string limit:int32 = Chats; + +//@description Returns a list of users and location-based supergroups nearby. The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby. The request should be sent again every 25 seconds with adjusted location to not miss new chats @location Current user location +searchChatsNearby location:location = ChatsNearby; + +//@description Returns a list of frequently used chats. Supported only if the chat info database is enabled @category Category of chats to be returned @limit The maximum number of chats to be returned; up to 30 +getTopChats category:TopChatCategory limit:int32 = Chats; + +//@description Removes a chat from the list of frequently used chats. Supported only if the chat info database is enabled @category Category of frequently used chats @chat_id Chat identifier +removeTopChat category:TopChatCategory chat_id:int53 = Ok; + +//@description Adds a chat to the list of recently found chats. The chat is added to the beginning of the list. If the chat is already in the list, it will be removed from the list first @chat_id Identifier of the chat to add +addRecentlyFoundChat chat_id:int53 = Ok; + +//@description Removes a chat from the list of recently found chats @chat_id Identifier of the chat to be removed +removeRecentlyFoundChat chat_id:int53 = Ok; + +//@description Clears the list of recently found chats +clearRecentlyFoundChats = Ok; + +//@description Checks whether a username can be set for a chat @chat_id Chat identifier; should be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if chat is being created @username Username to be checked +checkChatUsername chat_id:int53 username:string = CheckChatUsernameResult; + +//@description Returns a list of public chats of the specified type, owned by the user @type Type of the public chats to return +getCreatedPublicChats type:PublicChatType = Chats; + +//@description Checks whether the maximum number of owned public chats has been reached. Returns corresponding error if the limit was reached @type Type of the public chats, for which to check the limit +checkCreatedPublicChatsLimit type:PublicChatType = Ok; + +//@description Returns a list of basic group and supergroup chats, which can be used as a discussion group for a channel. Returned basic group chats must be first upgraded to supergroups before they can be set as a discussion group. To set a returned supergroup as a discussion group, access to its old messages must be enabled using toggleSupergroupIsAllHistoryAvailable first +getSuitableDiscussionChats = Chats; + +//@description Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error +getInactiveSupergroupChats = Chats; + + +//@description Returns a list of common group chats with a given user. Chats are sorted by their type and creation date @user_id User identifier @offset_chat_id Chat identifier starting from which to return chats; use 0 for the first request @limit The maximum number of chats to be returned; up to 100 +getGroupsInCommon user_id:int32 offset_chat_id:int53 limit:int32 = Chats; + + +//@description Returns messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). +//-For optimal performance the number of returned messages is chosen by the library. This is an offline request if only_local is true +//@chat_id Chat identifier +//@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message +//@offset Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached +//@only_local If true, returns only messages that are available locally without sending network requests +getChatHistory chat_id:int53 from_message_id:int53 offset:int32 limit:int32 only_local:Bool = Messages; + +//@description Returns messages in a message thread of a message. Can be used only if message.can_get_message_thread == true. Message thread of a channel message is in the channel's linked supergroup. +//-The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library +//@chat_id Chat identifier +//@message_id Message identifier, which thread history needs to be returned +//@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message +//@offset Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. Fewer messages may be returned than specified by the limit, even if the end of the message thread history has not been reached +getMessageThreadHistory chat_id:int53 message_id:int53 from_message_id:int53 offset:int32 limit:int32 = Messages; + +//@description Deletes all messages in the chat. Use Chat.can_be_deleted_only_for_self and Chat.can_be_deleted_for_all_users fields to find whether and how the method can be applied to the chat +//@chat_id Chat identifier @remove_from_chat_list Pass true if the chat should be removed from the chat list @revoke Pass true to try to delete chat history for all users +deleteChatHistory chat_id:int53 remove_from_chat_list:Bool revoke:Bool = Ok; + +//@description Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query +//-(searchSecretMessages should be used instead), or without an enabled message database. For optimal performance the number of returned messages is chosen by the library +//@chat_id Identifier of the chat in which to search messages +//@query Query to search for +//@sender If not null, only messages sent by the specified sender will be returned. Not supported in secret chats +//@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message +//@offset Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached +//@filter Filter for message content in the search results +//@message_thread_id If not 0, only messages in the specified thread will be returned; supergroups only +searchChatMessages chat_id:int53 query:string sender:MessageSender from_message_id:int53 offset:int32 limit:int32 filter:SearchMessagesFilter message_thread_id:int53 = Messages; + +//@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). +//-For optimal performance the number of returned messages is chosen by the library +//@chat_list Chat list in which to search messages; pass null to search in all chats regardless of their chat list +//@query Query to search for +//@offset_date The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the last message +//@offset_chat_id The chat identifier of the last found message, or 0 for the first request +//@offset_message_id The message identifier of the last found message, or 0 for the first request +//@limit The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached +//@filter Filter for message content in the search results; searchMessagesFilterCall, searchMessagesFilterMissedCall, searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterFailedToSend and searchMessagesFilterPinned are unsupported in this function +//@min_date If not 0, the minimum date of the messages to return +//@max_date If not 0, the maximum date of the messages to return +searchMessages chat_list:ChatList query:string offset_date:int32 offset_chat_id:int53 offset_message_id:int53 limit:int32 filter:SearchMessagesFilter min_date:int32 max_date:int32 = Messages; + +//@description Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance the number of returned messages is chosen by the library +//@chat_id Identifier of the chat in which to search. Specify 0 to search in all secret chats +//@query Query to search for. If empty, searchChatMessages should be used instead +//@offset Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results +//@limit The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached +//@filter A filter for message content in the search results +searchSecretMessages chat_id:int53 query:string offset:string limit:int32 filter:SearchMessagesFilter = FoundMessages; + +//@description Searches for call messages. Returns the results in reverse chronological order (i. e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library +//@from_message_id Identifier of the message from which to search; use 0 to get results from the last message +//@limit The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached @only_missed If true, returns only messages with missed calls +searchCallMessages from_message_id:int53 limit:int32 only_missed:Bool = Messages; + +//@description Returns information about the recent locations of chat members that were sent to the chat. Returns up to 1 location message per user @chat_id Chat identifier @limit The maximum number of messages to be returned +searchChatRecentLocationMessages chat_id:int53 limit:int32 = Messages; + +//@description Returns all active live locations that should be updated by the application. The list is persistent across application restarts only if the message database is used +getActiveLiveLocationMessages = Messages; + +//@description Returns the last message sent in a chat no later than the specified date @chat_id Chat identifier @date Point in time (Unix timestamp) relative to which to search for messages +getChatMessageByDate chat_id:int53 date:int32 = Message; + +//@description Returns approximate number of messages of the specified type in the chat @chat_id Identifier of the chat in which to count messages @filter Filter for message content; searchMessagesFilterEmpty is unsupported in this function @return_local If true, returns count that is available locally without sending network requests, returning -1 if the number of messages is unknown +getChatMessageCount chat_id:int53 filter:SearchMessagesFilter return_local:Bool = Count; + +//@description Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) @chat_id Chat identifier +getChatScheduledMessages chat_id:int53 = Messages; + +//@description Returns forwarded copies of a channel message to different public channels. For optimal performance the number of returned messages is chosen by the library +//@chat_id Chat identifier of the message +//@message_id Message identifier +//@offset Offset of the first entry to return as received from the previous request; use empty string to get first chunk of results +//@limit The maximum number of messages to be returned; must be positive and can't be greater than 100. Fewer messages may be returned than specified by the limit, even if the end of the list has not been reached +getMessagePublicForwards chat_id:int53 message_id:int53 offset:string limit:int32 = FoundMessages; + + +//@description Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user @notification_group_id Identifier of notification group to which the notification belongs @notification_id Identifier of removed notification +removeNotification notification_group_id:int32 notification_id:int32 = Ok; + +//@description Removes a group of active notifications. Needs to be called only if the notification group is removed by the current user @notification_group_id Notification group identifier @max_notification_id The maximum identifier of removed notifications +removeNotificationGroup notification_group_id:int32 max_notification_id:int32 = Ok; + + +//@description Returns an HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels. This is an offline request +//@chat_id Identifier of the chat to which the message belongs +//@message_id Identifier of the message +//@for_album Pass true to create a link for the whole media album +//@for_comment Pass true to create a link to the message as a channel post comment, or from a message thread +getMessageLink chat_id:int53 message_id:int53 for_album:Bool for_comment:Bool = MessageLink; + +//@description Returns an HTML code for embedding the message. Available only for messages in supergroups and channels with a username +//@chat_id Identifier of the chat to which the message belongs +//@message_id Identifier of the message +//@for_album Pass true to return an HTML code for embedding of the whole media album +getMessageEmbeddingCode chat_id:int53 message_id:int53 for_album:Bool = Text; + +//@description Returns information about a public or private message link @url The message link in the format "https://t.me/c/...", or "tg://privatepost?...", or "https://t.me/username/...", or "tg://resolve?..." +getMessageLinkInfo url:string = MessageLinkInfo; + + +//@description Sends a message. Returns the sent message +//@chat_id Target chat +//@message_thread_id If not 0, a message thread identifier in which the message will be sent +//@reply_to_message_id Identifier of the message to reply to or 0 +//@options Options to be used to send the message +//@reply_markup Markup for replying to the message; for bots only @input_message_content The content of the message to be sent +sendMessage chat_id:int53 message_thread_id:int53 reply_to_message_id:int53 options:messageSendOptions reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; + +//@description Sends messages grouped together into an album. Currently only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages +//@chat_id Target chat +//@message_thread_id If not 0, a message thread identifier in which the messages will be sent +//@reply_to_message_id Identifier of a message to reply to or 0 +//@options Options to be used to send the messages +//@input_message_contents Contents of messages to be sent +sendMessageAlbum chat_id:int53 message_thread_id:int53 reply_to_message_id:int53 options:messageSendOptions input_message_contents:vector = Messages; + +//@description Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message +//@bot_user_id Identifier of the bot @chat_id Identifier of the target chat @parameter A hidden parameter sent to the bot for deep linking purposes (https://core.telegram.org/bots#deep-linking) +sendBotStartMessage bot_user_id:int32 chat_id:int53 parameter:string = Message; + +//@description Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message +//@chat_id Target chat +//@message_thread_id If not 0, a message thread identifier in which the message will be sent +//@reply_to_message_id Identifier of a message to reply to or 0 +//@options Options to be used to send the message +//@query_id Identifier of the inline query @result_id Identifier of the inline result +//@hide_via_bot If true, there will be no mention of a bot, via which the message is sent. Can be used only for bots GetOption("animation_search_bot_username"), GetOption("photo_search_bot_username") and GetOption("venue_search_bot_username") +sendInlineQueryResultMessage chat_id:int53 message_thread_id:int53 reply_to_message_id:int53 options:messageSendOptions query_id:int64 result_id:string hide_via_bot:Bool = Message; + +//@description Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message +//@chat_id Identifier of the chat to which to forward messages @from_chat_id Identifier of the chat from which to forward messages @message_ids Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order +//@options Options to be used to send the messages +//@send_copy True, if content of the messages needs to be copied without links to the original messages. Always true if the messages are forwarded to a secret chat +//@remove_caption True, if media caption of message copies needs to be removed. Ignored if send_copy is false +forwardMessages chat_id:int53 from_chat_id:int53 message_ids:vector options:messageSendOptions send_copy:Bool remove_caption:Bool = Messages; + +//@description Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. +//-If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message +//@chat_id Identifier of the chat to send messages @message_ids Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order +resendMessages chat_id:int53 message_ids:vector = Messages; + +//@description Changes the current TTL setting (sets a new self-destruct timer) in a secret chat and sends the corresponding message @chat_id Chat identifier @ttl New TTL value, in seconds +sendChatSetTtlMessage chat_id:int53 ttl:int32 = Message; + +//@description Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats @chat_id Chat identifier +sendChatScreenshotTakenNotification chat_id:int53 = Ok; + +//@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message +//@chat_id Target chat +//@sender The sender sender of the message +//@reply_to_message_id Identifier of the message to reply to or 0 +//@disable_notification Pass true to disable notification for the message +//@input_message_content The content of the message to be added +addLocalMessage chat_id:int53 sender:MessageSender reply_to_message_id:int53 disable_notification:Bool input_message_content:InputMessageContent = Message; + +//@description Deletes messages @chat_id Chat identifier @message_ids Identifiers of the messages to be deleted @revoke Pass true to try to delete messages for all chat members. Always true for supergroups, channels and secret chats +deleteMessages chat_id:int53 message_ids:vector revoke:Bool = Ok; + +//@description Deletes all messages sent by the specified user to a chat. Supported only for supergroups; requires can_delete_messages administrator privileges @chat_id Chat identifier @user_id User identifier +deleteChatMessagesFromUser chat_id:int53 user_id:int32 = Ok; + + +//@description Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side +//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @input_message_content New text content of the message. Should be of type InputMessageText +editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; + +//@description Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side +//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @location New location content of the message; may be null. Pass null to stop sharing the live location +//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown +//@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled +editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location heading:int32 proximity_alert_radius:int32 = Message; + +//@description Edits the content of a message with an animation, an audio, a document, a photo or a video. The media in the message can't be replaced if the message was set to self-destruct. Media can't be replaced by self-destructing media. Media in an album can be edited only to contain a photo or a video. Returns the edited message after the edit is completed on the server side +//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @input_message_content New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo +editMessageMedia chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; + +//@description Edits the message content caption. Returns the edited message after the edit is completed on the server side +//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @caption New message content caption; 0-GetOption("message_caption_length_max") characters +editMessageCaption chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText = Message; + +//@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side +//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup +editMessageReplyMarkup chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Message; + +//@description Edits the text of an inline text or game message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup @input_message_content New text content of the message. Should be of type InputMessageText +editInlineMessageText inline_message_id:string reply_markup:ReplyMarkup input_message_content:InputMessageContent = Ok; + +//@description Edits the content of a live location in an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup +//@location New location content of the message; may be null. Pass null to stop sharing the live location +//@heading The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown +//@proximity_alert_radius The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled +editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location heading:int32 proximity_alert_radius:int32 = Ok; + +//@description Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only @inline_message_id Inline message identifier +//@reply_markup The new message reply markup; for bots only @input_message_content New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo +editInlineMessageMedia inline_message_id:string reply_markup:ReplyMarkup input_message_content:InputMessageContent = Ok; + +//@description Edits the caption of an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup @caption New message content caption; 0-GetOption("message_caption_length_max") characters +editInlineMessageCaption inline_message_id:string reply_markup:ReplyMarkup caption:formattedText = Ok; + +//@description Edits the reply markup of an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup +editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup = Ok; + +//@description Edits the time when a scheduled message will be sent. Scheduling state of all messages in the same album or forwarded together with the message will be also changed @chat_id The chat the message belongs to @message_id Identifier of the message @scheduling_state The new message scheduling state. Pass null to send the message immediately +editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok; + + +//@description Returns all entities (mentions, hashtags, cashtags, bot commands, bank card numbers, URLs, and email addresses) contained in the text. Can be called synchronously @text The text in which to look for entites +getTextEntities text:string = TextEntities; + +//@description Parses Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities contained in the text. Can be called synchronously @text The text to parse @parse_mode Text parse mode +parseTextEntities text:string parse_mode:TextParseMode = FormattedText; + +//@description Parses Markdown entities in a human-friendly format, ignoring markup errors. Can be called synchronously +//@text The text to parse. For example, "__italic__ ~~strikethrough~~ **bold** `code` ```pre``` __[italic__ text_url](telegram.org) __italic**bold italic__bold**" +parseMarkdown text:formattedText = FormattedText; + +//@description Replaces text entities with Markdown formatting in a human-friendly format. Entities that can't be represented in Markdown unambiguously are kept as is. Can be called synchronously @text The text +getMarkdownText text:formattedText = FormattedText; + +//@description Returns the MIME type of a file, guessed by its extension. Returns an empty string on failure. Can be called synchronously @file_name The name of the file or path to the file +getFileMimeType file_name:string = Text; + +//@description Returns the extension of a file, guessed by its MIME type. Returns an empty string on failure. Can be called synchronously @mime_type The MIME type of the file +getFileExtension mime_type:string = Text; + +//@description Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously @file_name File name or path to the file +cleanFileName file_name:string = Text; + +//@description Returns a string stored in the local database from the specified localization target and language pack by its key. Returns a 404 error if the string is not found. Can be called synchronously +//@language_pack_database_path Path to the language pack database in which strings are stored @localization_target Localization target to which the language pack belongs @language_pack_id Language pack identifier @key Language pack key of the string to be returned +getLanguagePackString language_pack_database_path:string localization_target:string language_pack_id:string key:string = LanguagePackStringValue; + +//@description Converts a JSON-serialized string to corresponding JsonValue object. Can be called synchronously @json The JSON-serialized string +getJsonValue json:string = JsonValue; + +//@description Converts a JsonValue object to corresponding JSON-serialized string. Can be called synchronously @json_value The JsonValue object +getJsonString json_value:JsonValue = Text; + + +//@description Changes the user answer to a poll. A poll in quiz mode can be answered only once +//@chat_id Identifier of the chat to which the poll belongs @message_id Identifier of the message containing the poll +//@option_ids 0-based identifiers of answer options, chosen by the user. User can choose more than 1 answer option only is the poll allows multiple answers +setPollAnswer chat_id:int53 message_id:int53 option_ids:vector = Ok; + +//@description Returns users voted for the specified option in a non-anonymous polls. For the optimal performance the number of returned users is chosen by the library +//@chat_id Identifier of the chat to which the poll belongs @message_id Identifier of the message containing the poll +//@option_id 0-based identifier of the answer option +//@offset Number of users to skip in the result; must be non-negative +//@limit The maximum number of users to be returned; must be positive and can't be greater than 50. Fewer users may be returned than specified by the limit, even if the end of the voter list has not been reached +getPollVoters chat_id:int53 message_id:int53 option_id:int32 offset:int32 limit:int32 = Users; + +//@description Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set +//@chat_id Identifier of the chat to which the poll belongs @message_id Identifier of the message containing the poll @reply_markup The new message reply markup; for bots only +stopPoll chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok; + + +//@description Hides a suggested action @action Suggested action to hide +hideSuggestedAction action:SuggestedAction = Ok; + + +//@description Returns information about a button of type inlineKeyboardButtonTypeLoginUrl. The method needs to be called when the user presses the button +//@chat_id Chat identifier of the message with the button @message_id Message identifier of the message with the button @button_id Button identifier +getLoginUrlInfo chat_id:int53 message_id:int53 button_id:int32 = LoginUrlInfo; + +//@description Returns an HTTP URL which can be used to automatically authorize the user on a website after clicking an inline button of type inlineKeyboardButtonTypeLoginUrl. +//-Use the method getLoginUrlInfo to find whether a prior user confirmation is needed. If an error is returned, then the button must be handled as an ordinary URL button +//@chat_id Chat identifier of the message with the button @message_id Message identifier of the message with the button @button_id Button identifier +//@allow_write_access True, if the user allowed the bot to send them messages +getLoginUrl chat_id:int53 message_id:int53 button_id:int32 allow_write_access:Bool = HttpUrl; + + +//@description Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires @bot_user_id The identifier of the target bot +//@chat_id Identifier of the chat where the query was sent @user_location Location of the user, only if needed @query Text of the query @offset Offset of the first entry to return +getInlineQueryResults bot_user_id:int32 chat_id:int53 user_location:location query:string offset:string = InlineQueryResults; + +//@description Sets the result of an inline query; for bots only @inline_query_id Identifier of the inline query @is_personal True, if the result of the query can be cached for the specified user +//@results The results of the query @cache_time Allowed time to cache the results of the query, in seconds @next_offset Offset for the next inline query; pass an empty string if there are no more results +//@switch_pm_text If non-empty, this text should be shown on the button that opens a private chat with the bot and sends a start message to the bot with the parameter switch_pm_parameter @switch_pm_parameter The parameter for the bot start message +answerInlineQuery inline_query_id:int64 is_personal:Bool results:vector cache_time:int32 next_offset:string switch_pm_text:string switch_pm_parameter:string = Ok; + + +//@description Sends a callback query to a bot and returns an answer. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires @chat_id Identifier of the chat with the message @message_id Identifier of the message from which the query originated @payload Query payload +getCallbackQueryAnswer chat_id:int53 message_id:int53 payload:CallbackQueryPayload = CallbackQueryAnswer; + +//@description Sets the result of a callback query; for bots only @callback_query_id Identifier of the callback query @text Text of the answer @show_alert If true, an alert should be shown to the user instead of a toast notification @url URL to be opened @cache_time Time during which the result of the query can be cached, in seconds +answerCallbackQuery callback_query_id:int64 text:string show_alert:Bool url:string cache_time:int32 = Ok; + + +//@description Sets the result of a shipping query; for bots only @shipping_query_id Identifier of the shipping query @shipping_options Available shipping options @error_message An error message, empty on success +answerShippingQuery shipping_query_id:int64 shipping_options:vector error_message:string = Ok; + +//@description Sets the result of a pre-checkout query; for bots only @pre_checkout_query_id Identifier of the pre-checkout query @error_message An error message, empty on success +answerPreCheckoutQuery pre_checkout_query_id:int64 error_message:string = Ok; + + +//@description Updates the game score of the specified user in the game; for bots only @chat_id The chat to which the message with the game belongs @message_id Identifier of the message @edit_message True, if the message should be edited @user_id User identifier @score The new score +//@force Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table +setGameScore chat_id:int53 message_id:int53 edit_message:Bool user_id:int32 score:int32 force:Bool = Message; + +//@description Updates the game score of the specified user in a game; for bots only @inline_message_id Inline message identifier @edit_message True, if the message should be edited @user_id User identifier @score The new score +//@force Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table +setInlineGameScore inline_message_id:string edit_message:Bool user_id:int32 score:int32 force:Bool = Ok; + +//@description Returns the high scores for a game and some part of the high score table in the range of the specified user; for bots only @chat_id The chat that contains the message with the game @message_id Identifier of the message @user_id User identifier +getGameHighScores chat_id:int53 message_id:int53 user_id:int32 = GameHighScores; + +//@description Returns game high scores and some part of the high score table in the range of the specified user; for bots only @inline_message_id Inline message identifier @user_id User identifier +getInlineGameHighScores inline_message_id:string user_id:int32 = GameHighScores; + + +//@description Deletes the default reply markup from a chat. Must be called after a one-time keyboard or a ForceReply reply markup has been used. UpdateChatReplyMarkup will be sent if the reply markup will be changed @chat_id Chat identifier +//@message_id The message identifier of the used keyboard +deleteChatReplyMarkup chat_id:int53 message_id:int53 = Ok; + + +//@description Sends a notification about user activity in a chat @chat_id Chat identifier @message_thread_id If not 0, a message thread identifier in which the action was performed @action The action description +sendChatAction chat_id:int53 message_thread_id:int53 action:ChatAction = Ok; + + +//@description Informs TDLib that the chat is opened by the user. Many useful activities depend on the chat being opened or closed (e.g., in supergroups and channels all updates are received only for opened chats) @chat_id Chat identifier +openChat chat_id:int53 = Ok; + +//@description Informs TDLib that the chat is closed by the user. Many useful activities depend on the chat being opened or closed @chat_id Chat identifier +closeChat chat_id:int53 = Ok; + +//@description Informs TDLib that messages are being viewed by the user. Many useful activities depend on whether the messages are currently being viewed or not (e.g., marking messages as read, incrementing a view counter, updating a view counter, removing deleted messages in supergroups and channels) +//@chat_id Chat identifier +//@message_thread_id If not 0, a message thread identifier in which the messages are being viewed +//@message_ids The identifiers of the messages being viewed +//@force_read True, if messages in closed chats should be marked as read by the request +viewMessages chat_id:int53 message_thread_id:int53 message_ids:vector force_read:Bool = Ok; + +//@description Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). An updateMessageContentOpened update will be generated if something has changed @chat_id Chat identifier of the message @message_id Identifier of the message with the opened content +openMessageContent chat_id:int53 message_id:int53 = Ok; + + +//@description Marks all mentions in a chat as read @chat_id Chat identifier +readAllChatMentions chat_id:int53 = Ok; + + +//@description Returns an existing chat corresponding to a given user @user_id User identifier @force If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect +createPrivateChat user_id:int32 force:Bool = Chat; + +//@description Returns an existing chat corresponding to a known basic group @basic_group_id Basic group identifier @force If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect +createBasicGroupChat basic_group_id:int32 force:Bool = Chat; + +//@description Returns an existing chat corresponding to a known supergroup or channel @supergroup_id Supergroup or channel identifier @force If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect +createSupergroupChat supergroup_id:int32 force:Bool = Chat; + +//@description Returns an existing chat corresponding to a known secret chat @secret_chat_id Secret chat identifier +createSecretChat secret_chat_id:int32 = Chat; + +//@description Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat @user_ids Identifiers of users to be added to the basic group @title Title of the new basic group; 1-128 characters +createNewBasicGroupChat user_ids:vector title:string = Chat; + +//@description Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat @title Title of the new chat; 1-128 characters @is_channel True, if a channel chat should be created @param_description Chat description; 0-255 characters @location Chat location if a location-based supergroup is being created +createNewSupergroupChat title:string is_channel:Bool description:string location:chatLocation = Chat; + +//@description Creates a new secret chat. Returns the newly created chat @user_id Identifier of the target user +createNewSecretChat user_id:int32 = Chat; + +//@description Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires creator privileges. Deactivates the original basic group @chat_id Identifier of the chat to upgrade +upgradeBasicGroupChatToSupergroupChat chat_id:int53 = Chat; + + +//@description Returns chat lists to which the chat can be added. This is an offline request @chat_id Chat identifier +getChatListsToAddChat chat_id:int53 = ChatLists; + +//@description Adds a chat to a chat list. A chat can't be simultaneously in Main and Archive chat lists, so it is automatically removed from another one if needed +//@chat_id Chat identifier @chat_list The chat list. Use getChatListsToAddChat to get suitable chat lists +addChatToList chat_id:int53 chat_list:ChatList = Ok; + +//@description Returns information about a chat filter by its identifier @chat_filter_id Chat filter identifier +getChatFilter chat_filter_id:int32 = ChatFilter; + +//@description Creates new chat filter. Returns information about the created chat filter @filter Chat filter +createChatFilter filter:chatFilter = ChatFilterInfo; + +//@description Edits existing chat filter. Returns information about the edited chat filter @chat_filter_id Chat filter identifier @filter The edited chat filter +editChatFilter chat_filter_id:int32 filter:chatFilter = ChatFilterInfo; + +//@description Deletes existing chat filter @chat_filter_id Chat filter identifier +deleteChatFilter chat_filter_id:int32 = Ok; + +//@description Changes the order of chat filters @chat_filter_ids Identifiers of chat filters in the new correct order +reorderChatFilters chat_filter_ids:vector = Ok; + +//@description Returns recommended chat filters for the current user +getRecommendedChatFilters = RecommendedChatFilters; + +//@description Returns default icon name for a filter. Can be called synchronously @filter Chat filter +getChatFilterDefaultIconName filter:chatFilter = Text; + + +//@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info rights +//@chat_id Chat identifier @title New title of the chat; 1-128 characters +setChatTitle chat_id:int53 title:string = Ok; + +//@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info rights +//@chat_id Chat identifier @photo New chat photo. Pass null to delete the chat photo +setChatPhoto chat_id:int53 photo:InputChatPhoto = Ok; + +//@description Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right +//@chat_id Chat identifier @permissions New non-administrator members permissions in the chat +setChatPermissions chat_id:int53 permissions:chatPermissions = Ok; + +//@description Changes the draft message in a chat @chat_id Chat identifier @message_thread_id If not 0, a message thread identifier in which the draft was changed @draft_message New draft message; may be null +setChatDraftMessage chat_id:int53 message_thread_id:int53 draft_message:draftMessage = Ok; + +//@description Changes the notification settings of a chat. Notification settings of a chat with the current user (Saved Messages) can't be changed +//@chat_id Chat identifier @notification_settings New notification settings for the chat. If the chat is muted for more than 1 week, it is considered to be muted forever +setChatNotificationSettings chat_id:int53 notification_settings:chatNotificationSettings = Ok; + +//@description Changes the marked as unread state of a chat @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread +toggleChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Ok; + +//@description Changes the value of the default disable_notification parameter, used when a message is sent to a chat @chat_id Chat identifier @default_disable_notification New value of default_disable_notification +toggleChatDefaultDisableNotification chat_id:int53 default_disable_notification:Bool = Ok; + +//@description Changes application-specific data associated with a chat @chat_id Chat identifier @client_data New value of client_data +setChatClientData chat_id:int53 client_data:string = Ok; + +//@description Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info rights @chat_id Identifier of the chat @param_description New chat description; 0-255 characters +setChatDescription chat_id:int53 description:string = Ok; + +//@description Changes the discussion group of a channel chat; requires can_change_info rights in the channel if it is specified @chat_id Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages rights in the supergroup) @discussion_chat_id Identifier of a new channel's discussion group. Use 0 to remove the discussion group. +//-Use the method getSuitableDiscussionChats to find all suitable groups. Basic group chats must be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that +setChatDiscussionGroup chat_id:int53 discussion_chat_id:int53 = Ok; + +//@description Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use @chat_id Chat identifier @location New location for the chat; must be valid and not null +setChatLocation chat_id:int53 location:chatLocation = Ok; + +//@description Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members rights @chat_id Chat identifier @slow_mode_delay New slow mode delay for the chat; must be one of 0, 10, 30, 60, 300, 900, 3600 +setChatSlowModeDelay chat_id:int53 slow_mode_delay:int32 = Ok; + +//@description Pins a message in a chat; requires can_pin_messages rights or can_edit_messages rights in the channel +//@chat_id Identifier of the chat +//@message_id Identifier of the new pinned message +//@disable_notification True, if there should be no notification about the pinned message. Notifications are always disabled in channels and private chats +//@only_for_self True, if the message needs to be pinned for one side only; private chats only +pinChatMessage chat_id:int53 message_id:int53 disable_notification:Bool only_for_self:Bool = Ok; + +//@description Removes a pinned message from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel @chat_id Identifier of the chat @message_id Identifier of the removed pinned message +unpinChatMessage chat_id:int53 message_id:int53 = Ok; + +//@description Removes all pinned messages from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel @chat_id Identifier of the chat +unpinAllChatMessages chat_id:int53 = Ok; + + +//@description Adds current user as a new member to a chat. Private and secret chats can't be joined using this method @chat_id Chat identifier +joinChat chat_id:int53 = Ok; + +//@description Removes current user from chat members. Private and secret chats can't be left using this method @chat_id Chat identifier +leaveChat chat_id:int53 = Ok; + +//@description Adds a new member to a chat. Members can't be added to private or secret chats. Members will not be added until the chat state has been synchronized with the server +//@chat_id Chat identifier @user_id Identifier of the user @forward_limit The number of earlier messages from the chat to be forwarded to the new member; up to 100. Ignored for supergroups and channels +addChatMember chat_id:int53 user_id:int32 forward_limit:int32 = Ok; + +//@description Adds multiple new members to a chat. Currently this option is only available for supergroups and channels. This option can't be used to join a chat. Members can't be added to a channel if it has more than 200 members. Members will not be added until the chat state has been synchronized with the server +//@chat_id Chat identifier @user_ids Identifiers of the users to be added to the chat +addChatMembers chat_id:int53 user_ids:vector = Ok; + +//@description Changes the status of a chat member, needs appropriate privileges. This function is currently not suitable for adding new members to the chat and transferring chat ownership; instead, use addChatMember or transferChatOwnership. The chat member status will not be changed until it has been synchronized with the server +//@chat_id Chat identifier @user_id User identifier @status The new status of the member in the chat +setChatMemberStatus chat_id:int53 user_id:int32 status:ChatMemberStatus = Ok; + +//@description Checks whether the current session can be used to transfer a chat ownership to another user +canTransferOwnership = CanTransferOwnershipResult; + +//@description Changes the owner of a chat. The current user must be a current owner of the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats +//@chat_id Chat identifier @user_id Identifier of the user to which transfer the ownership. The ownership can't be transferred to a bot or to a deleted user @password The password of the current user +transferChatOwnership chat_id:int53 user_id:int32 password:string = Ok; + +//@description Returns information about a single member of a chat @chat_id Chat identifier @user_id User identifier +getChatMember chat_id:int53 user_id:int32 = ChatMember; + +//@description Searches for a specified query in the first name, last name and username of the members of a specified chat. Requires administrator rights in channels @chat_id Chat identifier @query Query to search for @limit The maximum number of users to be returned @filter The type of users to return. By default, chatMembersFilterMembers +searchChatMembers chat_id:int53 query:string limit:int32 filter:ChatMembersFilter = ChatMembers; + +//@description Returns a list of administrators of the chat with their custom titles @chat_id Chat identifier +getChatAdministrators chat_id:int53 = ChatAdministrators; + + +//@description Clears draft messages in all chats @exclude_secret_chats If true, local draft messages in secret chats will not be cleared +clearAllDraftMessages exclude_secret_chats:Bool = Ok; + + +//@description Returns list of chats with non-default notification settings @scope If specified, only chats from the specified scope will be returned @compare_sound If true, also chats with non-default sound will be returned +getChatNotificationSettingsExceptions scope:NotificationSettingsScope compare_sound:Bool = Chats; + +//@description Returns the notification settings for chats of a given type @scope Types of chats for which to return the notification settings information +getScopeNotificationSettings scope:NotificationSettingsScope = ScopeNotificationSettings; + +//@description Changes notification settings for chats of a given type @scope Types of chats for which to change the notification settings @notification_settings The new notification settings for the given scope +setScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Ok; + +//@description Resets all notification settings to their default values. By default, all chats are unmuted, the sound is set to "default" and message previews are shown +resetAllNotificationSettings = Ok; + + +//@description Changes the pinned state of a chat. There can be up to GetOption("pinned_chat_count_max")/GetOption("pinned_archived_chat_count_max") pinned non-secret chats and the same number of secret chats in the main/arhive chat list +//@chat_list Chat list in which to change the pinned state of the chat @chat_id Chat identifier @is_pinned True, if the chat is pinned +toggleChatIsPinned chat_list:ChatList chat_id:int53 is_pinned:Bool = Ok; + +//@description Changes the order of pinned chats @chat_list Chat list in which to change the order of pinned chats @chat_ids The new list of pinned chats +setPinnedChats chat_list:ChatList chat_ids:vector = Ok; + + +//@description Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates +//@file_id Identifier of the file to download +//@priority Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded first +//@offset The starting position from which the file should be downloaded +//@limit Number of bytes which should be downloaded starting from the "offset" position before the download will be automatically cancelled; use 0 to download without a limit +//@synchronous If false, this request returns file state just after the download has been started. If true, this request returns file state only after +//-the download has succeeded, has failed, has been cancelled or a new downloadFile request with different offset/limit parameters was sent +downloadFile file_id:int32 priority:int32 offset:int32 limit:int32 synchronous:Bool = File; + +//@description Returns file downloaded prefix size from a given offset @file_id Identifier of the file @offset Offset from which downloaded prefix size should be calculated +getFileDownloadedPrefixSize file_id:int32 offset:int32 = Count; + +//@description Stops the downloading of a file. If a file has already been downloaded, does nothing @file_id Identifier of a file to stop downloading @only_if_pending Pass true to stop downloading only if it hasn't been started, i.e. request hasn't been sent to server +cancelDownloadFile file_id:int32 only_if_pending:Bool = Ok; + +//@description Asynchronously uploads a file to the cloud without sending it in a message. updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message @file File to upload @file_type File type +//@priority Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which uploadFile was called will be uploaded first +uploadFile file:InputFile file_type:FileType priority:int32 = File; + +//@description Stops the uploading of a file. Supported only for files uploaded by using uploadFile. For other files the behavior is undefined @file_id Identifier of the file to stop uploading +cancelUploadFile file_id:int32 = Ok; + +//@description Writes a part of a generated file. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct write to the destination file +//@generation_id The identifier of the generation process @offset The offset from which to write the data to the file @data The data to write +writeGeneratedFilePart generation_id:int64 offset:int32 data:bytes = Ok; + +//@description Informs TDLib on a file generation progress +//@generation_id The identifier of the generation process +//@expected_size Expected size of the generated file, in bytes; 0 if unknown +//@local_prefix_size The number of bytes already generated +setFileGenerationProgress generation_id:int64 expected_size:int32 local_prefix_size:int32 = Ok; + +//@description Finishes the file generation +//@generation_id The identifier of the generation process +//@error If set, means that file generation has failed and should be terminated +finishFileGeneration generation_id:int64 error:error = Ok; + +//@description Reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct read from the file +//@file_id Identifier of the file. The file must be located in the TDLib file cache +//@offset The offset from which to read the file +//@count Number of bytes to read. An error will be returned if there are not enough bytes available in the file from the specified position. Pass 0 to read all available data from the specified position +readFilePart file_id:int32 offset:int32 count:int32 = FilePart; + +//@description Deletes a file from the TDLib file cache @file_id Identifier of the file to delete +deleteFile file_id:int32 = Ok; + + +//@description Generates a new invite link for a chat; the previously generated link is revoked. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right @chat_id Chat identifier +generateChatInviteLink chat_id:int53 = ChatInviteLink; + +//@description Checks the validity of an invite link for a chat and returns information about the corresponding chat @invite_link Invite link to be checked; should begin with "https://t.me/joinchat/", "https://telegram.me/joinchat/", or "https://telegram.dog/joinchat/" +checkChatInviteLink invite_link:string = ChatInviteLinkInfo; + +//@description Uses an invite link to add the current user to the chat if possible. The new member will not be added until the chat state has been synchronized with the server +//@invite_link Invite link to import; should begin with "https://t.me/joinchat/", "https://telegram.me/joinchat/", or "https://telegram.dog/joinchat/" +joinChatByInviteLink invite_link:string = Chat; + + +//@description Creates a new call @user_id Identifier of the user to be called @protocol Description of the call protocols supported by the application @is_video True, if a video call needs to be created +createCall user_id:int32 protocol:callProtocol is_video:Bool = CallId; + +//@description Accepts an incoming call @call_id Call identifier @protocol Description of the call protocols supported by the application +acceptCall call_id:int32 protocol:callProtocol = Ok; + +//@description Sends call signaling data @call_id Call identifier @data The data +sendCallSignalingData call_id:int32 data:bytes = Ok; + +//@description Discards a call @call_id Call identifier @is_disconnected True, if the user was disconnected @duration The call duration, in seconds @is_video True, if the call was a video call @connection_id Identifier of the connection used during the call +discardCall call_id:int32 is_disconnected:Bool duration:int32 is_video:Bool connection_id:int64 = Ok; + +//@description Sends a call rating @call_id Call identifier @rating Call rating; 1-5 @comment An optional user comment if the rating is less than 5 @problems List of the exact types of problems with the call, specified by the user +sendCallRating call_id:int32 rating:int32 comment:string problems:vector = Ok; + +//@description Sends debug information for a call @call_id Call identifier @debug_information Debug information in application-specific format +sendCallDebugInformation call_id:int32 debug_information:string = Ok; + + +//@description Changes the block state of a message sender. Currently, only users and supergroup chats can be blocked @sender Message Sender @is_blocked New value of is_blocked +toggleMessageSenderIsBlocked sender:MessageSender is_blocked:Bool = Ok; + +//@description Blocks an original sender of a message in the Replies chat +//@message_id The identifier of an incoming message in the Replies chat +//@delete_message Pass true if the message must be deleted +//@delete_all_messages Pass true if all messages from the same sender must be deleted +//@report_spam Pass true if the sender must be reported to the Telegram moderators +blockMessageSenderFromReplies message_id:int53 delete_message:Bool delete_all_messages:Bool report_spam:Bool = Ok; + +//@description Returns users and chats that were blocked by the current user @offset Number of users and chats to skip in the result; must be non-negative @limit The maximum number of users and chats to return; up to 100 +getBlockedMessageSenders offset:int32 limit:int32 = MessageSenders; + + +//@description Adds a user to the contact list or edits an existing contact by their user identifier @contact The contact to add or edit; phone number can be empty and needs to be specified only if known, vCard is ignored +//@share_phone_number True, if the new contact needs to be allowed to see current user's phone number. A corresponding rule to userPrivacySettingShowPhoneNumber will be added if needed. Use the field UserFullInfo.need_phone_number_privacy_exception to check whether the current user needs to be asked to share their phone number +addContact contact:contact share_phone_number:Bool = Ok; + +//@description Adds new contacts or edits existing contacts by their phone numbers; contacts' user identifiers are ignored @contacts The list of contacts to import or edit; contacts' vCard are ignored and are not imported +importContacts contacts:vector = ImportedContacts; + +//@description Returns all user contacts +getContacts = Users; + +//@description Searches for the specified query in the first names, last names and usernames of the known user contacts @query Query to search for; may be empty to return all contacts @limit The maximum number of users to be returned +searchContacts query:string limit:int32 = Users; + +//@description Removes users from the contact list @user_ids Identifiers of users to be deleted +removeContacts user_ids:vector = Ok; + +//@description Returns the total number of imported contacts +getImportedContactCount = Count; + +//@description Changes imported contacts using the list of current user contacts saved on the device. Imports newly added contacts and, if at least the file database is enabled, deletes recently deleted contacts. +//-Query result depends on the result of the previous query, so only one query is possible at the same time @contacts The new list of contacts, contact's vCard are ignored and are not imported +changeImportedContacts contacts:vector = ImportedContacts; + +//@description Clears all imported contacts, contact list remains unchanged +clearImportedContacts = Ok; + + +//@description Shares the phone number of the current user with a mutual contact. Supposed to be called when the user clicks on chatActionBarSharePhoneNumber @user_id Identifier of the user with whom to share the phone number. The user must be a mutual contact +sharePhoneNumber user_id:int32 = Ok; + + +//@description Returns the profile photos of a user. The result of this query may be outdated: some photos might have been deleted already @user_id User identifier @offset The number of photos to skip; must be non-negative @limit The maximum number of photos to be returned; up to 100 +getUserProfilePhotos user_id:int32 offset:int32 limit:int32 = ChatPhotos; + + +//@description Returns stickers from the installed sticker sets that correspond to a given emoji. If the emoji is not empty, favorite and recently used stickers may also be returned @emoji String representation of emoji. If empty, returns all known installed stickers @limit The maximum number of stickers to be returned +getStickers emoji:string limit:int32 = Stickers; + +//@description Searches for stickers from public sticker sets that correspond to a given emoji @emoji String representation of emoji; must be non-empty @limit The maximum number of stickers to be returned +searchStickers emoji:string limit:int32 = Stickers; + +//@description Returns a list of installed sticker sets @is_masks Pass true to return mask sticker sets; pass false to return ordinary sticker sets +getInstalledStickerSets is_masks:Bool = StickerSets; + +//@description Returns a list of archived sticker sets @is_masks Pass true to return mask stickers sets; pass false to return ordinary sticker sets @offset_sticker_set_id Identifier of the sticker set from which to return the result @limit The maximum number of sticker sets to return +getArchivedStickerSets is_masks:Bool offset_sticker_set_id:int64 limit:int32 = StickerSets; + +//@description Returns a list of trending sticker sets. For the optimal performance the number of returned sticker sets is chosen by the library +//@offset The offset from which to return the sticker sets; must be non-negative +//@limit The maximum number of sticker sets to be returned; must be non-negative. Fewer sticker sets may be returned than specified by the limit, even if the end of the list has not been reached +getTrendingStickerSets offset:int32 limit:int32 = StickerSets; + +//@description Returns a list of sticker sets attached to a file. Currently only photos and videos can have attached sticker sets @file_id File identifier +getAttachedStickerSets file_id:int32 = StickerSets; + +//@description Returns information about a sticker set by its identifier @set_id Identifier of the sticker set +getStickerSet set_id:int64 = StickerSet; + +//@description Searches for a sticker set by its name @name Name of the sticker set +searchStickerSet name:string = StickerSet; + +//@description Searches for installed sticker sets by looking for specified query in their title and name @is_masks Pass true to return mask sticker sets; pass false to return ordinary sticker sets @query Query to search for @limit The maximum number of sticker sets to return +searchInstalledStickerSets is_masks:Bool query:string limit:int32 = StickerSets; + +//@description Searches for ordinary sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results @query Query to search for +searchStickerSets query:string = StickerSets; + +//@description Installs/uninstalls or activates/archives a sticker set @set_id Identifier of the sticker set @is_installed The new value of is_installed @is_archived The new value of is_archived. A sticker set can't be installed and archived simultaneously +changeStickerSet set_id:int64 is_installed:Bool is_archived:Bool = Ok; + +//@description Informs the server that some trending sticker sets have been viewed by the user @sticker_set_ids Identifiers of viewed trending sticker sets +viewTrendingStickerSets sticker_set_ids:vector = Ok; + +//@description Changes the order of installed sticker sets @is_masks Pass true to change the order of mask sticker sets; pass false to change the order of ordinary sticker sets @sticker_set_ids Identifiers of installed sticker sets in the new correct order +reorderInstalledStickerSets is_masks:Bool sticker_set_ids:vector = Ok; + +//@description Returns a list of recently used stickers @is_attached Pass true to return stickers and masks that were recently attached to photos or video files; pass false to return recently sent stickers +getRecentStickers is_attached:Bool = Stickers; + +//@description Manually adds a new sticker to the list of recently used stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list +//@is_attached Pass true to add the sticker to the list of stickers recently attached to photo or video files; pass false to add the sticker to the list of recently sent stickers @sticker Sticker file to add +addRecentSticker is_attached:Bool sticker:InputFile = Stickers; + +//@description Removes a sticker from the list of recently used stickers @is_attached Pass true to remove the sticker from the list of stickers recently attached to photo or video files; pass false to remove the sticker from the list of recently sent stickers @sticker Sticker file to delete +removeRecentSticker is_attached:Bool sticker:InputFile = Ok; + +//@description Clears the list of recently used stickers @is_attached Pass true to clear the list of stickers recently attached to photo or video files; pass false to clear the list of recently sent stickers +clearRecentStickers is_attached:Bool = Ok; + +//@description Returns favorite stickers +getFavoriteStickers = Stickers; + +//@description Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list +//@sticker Sticker file to add +addFavoriteSticker sticker:InputFile = Ok; + +//@description Removes a sticker from the list of favorite stickers @sticker Sticker file to delete from the list +removeFavoriteSticker sticker:InputFile = Ok; + +//@description Returns emoji corresponding to a sticker. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object @sticker Sticker file identifier +getStickerEmojis sticker:InputFile = Emojis; + +//@description Searches for emojis by keywords. Supported only if the file database is enabled @text Text to search for @exact_match True, if only emojis, which exactly match text needs to be returned @input_language_codes List of possible IETF language tags of the user's input language; may be empty if unknown +searchEmojis text:string exact_match:Bool input_language_codes:vector = Emojis; + +//@description Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation @language_code Language code for which the emoji replacements will be suggested +getEmojiSuggestionsUrl language_code:string = HttpUrl; + + +//@description Returns saved animations +getSavedAnimations = Animations; + +//@description Manually adds a new animation to the list of saved animations. The new animation is added to the beginning of the list. If the animation was already in the list, it is removed first. Only non-secret video animations with MIME type "video/mp4" can be added to the list +//@animation The animation file to be added. Only animations known to the server (i.e. successfully sent via a message) can be added to the list +addSavedAnimation animation:InputFile = Ok; + +//@description Removes an animation from the list of saved animations @animation Animation file to be removed +removeSavedAnimation animation:InputFile = Ok; + + +//@description Returns up to 20 recently used inline bots in the order of their last usage +getRecentInlineBots = Users; + + +//@description Searches for recently used hashtags by their prefix @prefix Hashtag prefix to search for @limit The maximum number of hashtags to be returned +searchHashtags prefix:string limit:int32 = Hashtags; + +//@description Removes a hashtag from the list of recently used hashtags @hashtag Hashtag to delete +removeRecentHashtag hashtag:string = Ok; + + +//@description Returns a web page preview by the text of the message. Do not call this function too often. Returns a 404 error if the web page has no preview @text Message text with formatting +getWebPagePreview text:formattedText = WebPage; + +//@description Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page @url The web page URL @force_full If true, the full instant view for the web page will be returned +getWebPageInstantView url:string force_full:Bool = WebPageInstantView; + + +//@description Changes a profile photo for the current user @photo Profile photo to set +setProfilePhoto photo:InputChatPhoto = Ok; + +//@description Deletes a profile photo @profile_photo_id Identifier of the profile photo to delete +deleteProfilePhoto profile_photo_id:int64 = Ok; + +//@description Changes the first and last name of the current user @first_name The new value of the first name for the user; 1-64 characters @last_name The new value of the optional last name for the user; 0-64 characters +setName first_name:string last_name:string = Ok; + +//@description Changes the bio of the current user @bio The new value of the user bio; 0-70 characters without line feeds +setBio bio:string = Ok; + +//@description Changes the username of the current user @username The new value of the username. Use an empty string to remove the username +setUsername username:string = Ok; + +//@description Changes the location of the current user. Needs to be called if GetOption("is_location_visible") is true and location changes for more than 1 kilometer @location The new location of the user +setLocation location:location = Ok; + +//@description Changes the phone number of the user and sends an authentication code to the user's new phone number. On success, returns information about the sent code +//@phone_number The new phone number of the user in international format @settings Settings for the authentication of the user's phone number +changePhoneNumber phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo; + +//@description Re-sends the authentication code sent to confirm a new phone number for the user. Works only if the previously received authenticationCodeInfo next_code_type was not null +resendChangePhoneNumberCode = AuthenticationCodeInfo; + +//@description Checks the authentication code sent to confirm a new phone number of the user @code Verification code received by SMS, phone call or flash call +checkChangePhoneNumberCode code:string = Ok; + +//@description Sets the list of commands supported by the bot; for bots only @commands List of the bot's commands +setCommands commands:vector = Ok; + + +//@description Returns all active sessions of the current user +getActiveSessions = Sessions; + +//@description Terminates a session of the current user @session_id Session identifier +terminateSession session_id:int64 = Ok; + +//@description Terminates all other sessions of the current user +terminateAllOtherSessions = Ok; + + +//@description Returns all website where the current user used Telegram to log in +getConnectedWebsites = ConnectedWebsites; + +//@description Disconnects website from the current user's Telegram account @website_id Website identifier +disconnectWebsite website_id:int64 = Ok; + +//@description Disconnects all websites from the current user's Telegram account +disconnectAllWebsites = Ok; + + +//@description Changes the username of a supergroup or channel, requires owner privileges in the supergroup or channel @supergroup_id Identifier of the supergroup or channel @username New value of the username. Use an empty string to remove the username +setSupergroupUsername supergroup_id:int32 username:string = Ok; + +//@description Changes the sticker set of a supergroup; requires can_change_info rights @supergroup_id Identifier of the supergroup @sticker_set_id New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set +setSupergroupStickerSet supergroup_id:int32 sticker_set_id:int64 = Ok; + +//@description Toggles sender signatures messages sent in a channel; requires can_change_info rights @supergroup_id Identifier of the channel @sign_messages New value of sign_messages +toggleSupergroupSignMessages supergroup_id:int32 sign_messages:Bool = Ok; + +//@description Toggles whether the message history of a supergroup is available to new members; requires can_change_info rights @supergroup_id The identifier of the supergroup @is_all_history_available The new value of is_all_history_available +toggleSupergroupIsAllHistoryAvailable supergroup_id:int32 is_all_history_available:Bool = Ok; + +//@description Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup @supergroup_id Supergroup identifier @user_id User identifier @message_ids Identifiers of messages sent in the supergroup by the user. This list must be non-empty +reportSupergroupSpam supergroup_id:int32 user_id:int32 message_ids:vector = Ok; + +//@description Returns information about members or banned users in a supergroup or channel. Can be used only if SupergroupFullInfo.can_get_members == true; additionally, administrator privileges may be required for some filters @supergroup_id Identifier of the supergroup or channel +//@filter The type of users to return. By default, supergroupMembersFilterRecent @offset Number of users to skip @limit The maximum number of users be returned; up to 200 +getSupergroupMembers supergroup_id:int32 filter:SupergroupMembersFilter offset:int32 limit:int32 = ChatMembers; + +//@description Deletes a supergroup or channel along with all messages in the corresponding chat. This will release the supergroup or channel username and remove all members; requires owner privileges in the supergroup or channel. Chats with more than 1000 members can't be deleted using this method @supergroup_id Identifier of the supergroup or channel +deleteSupergroup supergroup_id:int32 = Ok; + + +//@description Closes a secret chat, effectively transferring its state to secretChatStateClosed @secret_chat_id Secret chat identifier +closeSecretChat secret_chat_id:int32 = Ok; + + +//@description Returns a list of service actions taken by chat members and administrators in the last 48 hours. Available only for supergroups and channels. Requires administrator rights. Returns results in reverse chronological order (i. e., in order of decreasing event_id) +//@chat_id Chat identifier @query Search query by which to filter events @from_event_id Identifier of an event from which to return results. Use 0 to get results from the latest events @limit The maximum number of events to return; up to 100 +//@filters The types of events to return. By default, all types will be returned @user_ids User identifiers by which to filter events. By default, events relating to all users will be returned +getChatEventLog chat_id:int53 query:string from_event_id:int64 limit:int32 filters:chatEventLogFilters user_ids:vector = ChatEvents; + + +//@description Returns an invoice payment form. This method should be called when the user presses inlineKeyboardButtonBuy @chat_id Chat identifier of the Invoice message @message_id Message identifier +getPaymentForm chat_id:int53 message_id:int53 = PaymentForm; + +//@description Validates the order information provided by a user and returns the available shipping options for a flexible invoice @chat_id Chat identifier of the Invoice message @message_id Message identifier @order_info The order information, provided by the user @allow_save True, if the order information can be saved +validateOrderInfo chat_id:int53 message_id:int53 order_info:orderInfo allow_save:Bool = ValidatedOrderInfo; + +//@description Sends a filled-out payment form to the bot for final verification @chat_id Chat identifier of the Invoice message @message_id Message identifier @order_info_id Identifier returned by ValidateOrderInfo, or an empty string @shipping_option_id Identifier of a chosen shipping option, if applicable +//@credentials The credentials chosen by user for payment +sendPaymentForm chat_id:int53 message_id:int53 order_info_id:string shipping_option_id:string credentials:InputCredentials = PaymentResult; + +//@description Returns information about a successful payment @chat_id Chat identifier of the PaymentSuccessful message @message_id Message identifier +getPaymentReceipt chat_id:int53 message_id:int53 = PaymentReceipt; + +//@description Returns saved order info, if any +getSavedOrderInfo = OrderInfo; + +//@description Deletes saved order info +deleteSavedOrderInfo = Ok; + +//@description Deletes saved credentials for all payment provider bots +deleteSavedCredentials = Ok; + + +//@description Returns a user that can be contacted to get support +getSupportUser = User; + + +//@description Returns backgrounds installed by the user @for_dark_theme True, if the backgrounds must be ordered for dark theme +getBackgrounds for_dark_theme:Bool = Backgrounds; + +//@description Constructs a persistent HTTP URL for a background @name Background name @type Background type +getBackgroundUrl name:string type:BackgroundType = HttpUrl; + +//@description Searches for a background by its name @name The name of the background +searchBackground name:string = Background; + +//@description Changes the background selected by the user; adds background to the list of installed backgrounds +//@background The input background to use, null for filled backgrounds +//@type Background type; null for default background. The method will return error 404 if type is null +//@for_dark_theme True, if the background is chosen for dark theme +setBackground background:InputBackground type:BackgroundType for_dark_theme:Bool = Background; + +//@description Removes background from the list of installed backgrounds @background_id The background identifier +removeBackground background_id:int64 = Ok; + +//@description Resets list of installed backgrounds to its default value +resetBackgrounds = Ok; + + +//@description Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization @only_local If true, returns only locally available information without sending network requests +getLocalizationTargetInfo only_local:Bool = LocalizationTargetInfo; + +//@description Returns information about a language pack. Returned language pack identifier may be different from a provided one. Can be called before authorization @language_pack_id Language pack identifier +getLanguagePackInfo language_pack_id:string = LanguagePackInfo; + +//@description Returns strings from a language pack in the current localization target by their keys. Can be called before authorization @language_pack_id Language pack identifier of the strings to be returned @keys Language pack keys of the strings to be returned; leave empty to request all available strings +getLanguagePackStrings language_pack_id:string keys:vector = LanguagePackStrings; + +//@description Fetches the latest versions of all strings from a language pack in the current localization target from the server. This method shouldn't be called explicitly for the current used/base language packs. Can be called before authorization @language_pack_id Language pack identifier +synchronizeLanguagePack language_pack_id:string = Ok; + +//@description Adds a custom server language pack to the list of installed language packs in current localization target. Can be called before authorization @language_pack_id Identifier of a language pack to be added; may be different from a name that is used in an "https://t.me/setlanguage/" link +addCustomServerLanguagePack language_pack_id:string = Ok; + +//@description Adds or changes a custom local language pack to the current localization target @info Information about the language pack. Language pack ID must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization @strings Strings of the new language pack +setCustomLanguagePack info:languagePackInfo strings:vector = Ok; + +//@description Edits information about a custom local language pack in the current localization target. Can be called before authorization @info New information about the custom local language pack +editCustomLanguagePackInfo info:languagePackInfo = Ok; + +//@description Adds, edits or deletes a string in a custom local language pack. Can be called before authorization @language_pack_id Identifier of a previously added custom local language pack in the current localization target @new_string New language pack string +setCustomLanguagePackString language_pack_id:string new_string:languagePackString = Ok; + +//@description Deletes all information about a language pack in the current localization target. The language pack which is currently in use (including base language pack) or is being synchronized can't be deleted. Can be called before authorization @language_pack_id Identifier of the language pack to delete +deleteLanguagePack language_pack_id:string = Ok; + + +//@description Registers the currently used device for receiving push notifications. Returns a globally unique identifier of the push notification subscription @device_token Device token @other_user_ids List of user identifiers of other users currently using the application +registerDevice device_token:DeviceToken other_user_ids:vector = PushReceiverId; + +//@description Handles a push notification. Returns error with code 406 if the push notification is not supported and connection to the server is required to fetch new data. Can be called before authorization +//@payload JSON-encoded push notification payload with all fields sent by the server, and "google.sent_time" and "google.notification.sound" fields added +processPushNotification payload:string = Ok; + +//@description Returns a globally unique push notification subscription identifier for identification of an account, which has received a push notification. Can be called synchronously @payload JSON-encoded push notification payload +getPushReceiverId payload:string = PushReceiverId; + + +//@description Returns t.me URLs recently visited by a newly registered user @referrer Google Play referrer to identify the user +getRecentlyVisitedTMeUrls referrer:string = TMeUrls; + + +//@description Changes user privacy settings @setting The privacy setting @rules The new privacy rules +setUserPrivacySettingRules setting:UserPrivacySetting rules:userPrivacySettingRules = Ok; + +//@description Returns the current privacy settings @setting The privacy setting +getUserPrivacySettingRules setting:UserPrivacySetting = UserPrivacySettingRules; + + +//@description Returns the value of an option by its name. (Check the list of available options on https://core.telegram.org/tdlib/options.) Can be called before authorization +//@name The name of the option +getOption name:string = OptionValue; + +//@description Sets the value of an option. (Check the list of available options on https://core.telegram.org/tdlib/options.) Only writable options can be set. Can be called before authorization +//@name The name of the option @value The new value of the option +setOption name:string value:OptionValue = Ok; + + +//@description Changes the period of inactivity after which the account of the current user will automatically be deleted @ttl New account TTL +setAccountTtl ttl:accountTtl = Ok; + +//@description Returns the period of inactivity after which the account of the current user will automatically be deleted +getAccountTtl = AccountTtl; + +//@description Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account. Can be called before authorization when the current authorization state is authorizationStateWaitPassword @reason The reason why the account was deleted; optional +deleteAccount reason:string = Ok; + + +//@description Removes a chat action bar without any other action @chat_id Chat identifier +removeChatActionBar chat_id:int53 = Ok; + +//@description Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if this is a private chats with a bot, a private chat with a user sharing their location, a supergroup, or a channel, since other chats can't be checked by moderators @chat_id Chat identifier @reason The reason for reporting the chat @message_ids Identifiers of reported messages, if any +reportChat chat_id:int53 reason:ChatReportReason message_ids:vector = Ok; + + +//@description Returns an HTTP URL with the chat statistics. Currently this method of getting the statistics are disabled and can be deleted in the future @chat_id Chat identifier @parameters Parameters from "tg://statsrefresh?params=******" link @is_dark Pass true if a URL with the dark theme must be returned +getChatStatisticsUrl chat_id:int53 parameters:string is_dark:Bool = HttpUrl; + +//@description Returns detailed statistics about a chat. Currently this method can be used only for supergroups and channels. Can be used only if SupergroupFullInfo.can_get_statistics == true @chat_id Chat identifier @is_dark Pass true if a dark theme is used by the application +getChatStatistics chat_id:int53 is_dark:Bool = ChatStatistics; + +//@description Returns detailed statistics about a message. Can be used only if Message.can_get_statistics == true @chat_id Chat identifier @message_id Message identifier @is_dark Pass true if a dark theme is used by the application +getMessageStatistics chat_id:int53 message_id:int53 is_dark:Bool = MessageStatistics; + +//@description Loads an asynchronous or a zoomed in statistical graph @chat_id Chat identifier @token The token for graph loading @x X-value for zoomed in graph or 0 otherwise +getStatisticalGraph chat_id:int53 token:string x:int53 = StatisticalGraph; + + +//@description Returns storage usage statistics. Can be called before authorization @chat_limit The maximum number of chats with the largest storage usage for which separate statistics should be returned. All other chats will be grouped in entries with chat_id == 0. If the chat info database is not used, the chat_limit is ignored and is always set to 0 +getStorageStatistics chat_limit:int32 = StorageStatistics; + +//@description Quickly returns approximate storage usage statistics. Can be called before authorization +getStorageStatisticsFast = StorageStatisticsFast; + +//@description Returns database statistics +getDatabaseStatistics = DatabaseStatistics; + +//@description Optimizes storage usage, i.e. deletes some files and returns new storage usage statistics. Secret thumbnails can't be deleted +//@size Limit on the total size of files after deletion. Pass -1 to use the default limit +//@ttl Limit on the time that has passed since the last time a file was accessed (or creation time for some filesystems). Pass -1 to use the default limit +//@count Limit on the total count of files after deletion. Pass -1 to use the default limit +//@immunity_delay The amount of time after the creation of a file during which it can't be deleted, in seconds. Pass -1 to use the default value +//@file_types If not empty, only files with the given type(s) are considered. By default, all types except thumbnails, profile photos, stickers and wallpapers are deleted +//@chat_ids If not empty, only files from the given chats are considered. Use 0 as chat identifier to delete files not belonging to any chat (e.g., profile photos) +//@exclude_chat_ids If not empty, files from the given chats are excluded. Use 0 as chat identifier to exclude all files not belonging to any chat (e.g., profile photos) +//@return_deleted_file_statistics Pass true if statistics about the files that were deleted must be returned instead of the whole storage usage statistics. Affects only returned statistics +//@chat_limit Same as in getStorageStatistics. Affects only returned statistics +optimizeStorage size:int53 ttl:int32 count:int32 immunity_delay:int32 file_types:vector chat_ids:vector exclude_chat_ids:vector return_deleted_file_statistics:Bool chat_limit:int32 = StorageStatistics; + + +//@description Sets the current network type. Can be called before authorization. Calling this method forces all network connections to reopen, mitigating the delay in switching between different networks, so it should be called whenever the network is changed, even if the network type remains the same. +//-Network type is used to check whether the library can use the network at all and also for collecting detailed network data usage statistics @type The new network type. By default, networkTypeOther +setNetworkType type:NetworkType = Ok; + +//@description Returns network data usage statistics. Can be called before authorization @only_current If true, returns only data for the current library launch +getNetworkStatistics only_current:Bool = NetworkStatistics; + +//@description Adds the specified data to data usage statistics. Can be called before authorization @entry The network statistics entry with the data to be added to statistics +addNetworkStatistics entry:NetworkStatisticsEntry = Ok; + +//@description Resets all network data usage statistics to zero. Can be called before authorization +resetNetworkStatistics = Ok; + +//@description Returns auto-download settings presets for the current user +getAutoDownloadSettingsPresets = AutoDownloadSettingsPresets; + +//@description Sets auto-download settings @settings New user auto-download settings @type Type of the network for which the new settings are applied +setAutoDownloadSettings settings:autoDownloadSettings type:NetworkType = Ok; + + +//@description Returns information about a bank card @bank_card_number The bank card number +getBankCardInfo bank_card_number:string = BankCardInfo; + + +//@description Returns one of the available Telegram Passport elements @type Telegram Passport element type @password Password of the current user +getPassportElement type:PassportElementType password:string = PassportElement; + +//@description Returns all available Telegram Passport elements @password Password of the current user +getAllPassportElements password:string = PassportElements; + +//@description Adds an element to the user's Telegram Passport. May return an error with a message "PHONE_VERIFICATION_NEEDED" or "EMAIL_VERIFICATION_NEEDED" if the chosen phone number or the chosen email address must be verified first @element Input Telegram Passport element @password Password of the current user +setPassportElement element:InputPassportElement password:string = PassportElement; + +//@description Deletes a Telegram Passport element @type Element type +deletePassportElement type:PassportElementType = Ok; + +//@description Informs the user that some of the elements in their Telegram Passport contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed @user_id User identifier @errors The errors +setPassportElementErrors user_id:int32 errors:vector = Ok; + + +//@description Returns an IETF language tag of the language preferred in the country, which should be used to fill native fields in Telegram Passport personal details. Returns a 404 error if unknown @country_code A two-letter ISO 3166-1 alpha-2 country code +getPreferredCountryLanguage country_code:string = Text; + + +//@description Sends a code to verify a phone number to be added to a user's Telegram Passport +//@phone_number The phone number of the user, in international format @settings Settings for the authentication of the user's phone number +sendPhoneNumberVerificationCode phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo; + +//@description Re-sends the code to verify a phone number to be added to a user's Telegram Passport +resendPhoneNumberVerificationCode = AuthenticationCodeInfo; + +//@description Checks the phone number verification code for Telegram Passport @code Verification code +checkPhoneNumberVerificationCode code:string = Ok; + + +//@description Sends a code to verify an email address to be added to a user's Telegram Passport @email_address Email address +sendEmailAddressVerificationCode email_address:string = EmailAddressAuthenticationCodeInfo; + +//@description Re-sends the code to verify an email address to be added to a user's Telegram Passport +resendEmailAddressVerificationCode = EmailAddressAuthenticationCodeInfo; + +//@description Checks the email address verification code for Telegram Passport @code Verification code +checkEmailAddressVerificationCode code:string = Ok; + + +//@description Returns a Telegram Passport authorization form for sharing data with a service @bot_user_id User identifier of the service's bot @scope Telegram Passport element types requested by the service @public_key Service's public_key @nonce Authorization form nonce provided by the service +getPassportAuthorizationForm bot_user_id:int32 scope:string public_key:string nonce:string = PassportAuthorizationForm; + +//@description Returns already available Telegram Passport elements suitable for completing a Telegram Passport authorization form. Result can be received only once for each authorization form @autorization_form_id Authorization form identifier @password Password of the current user +getPassportAuthorizationFormAvailableElements autorization_form_id:int32 password:string = PassportElementsWithErrors; + +//@description Sends a Telegram Passport authorization form, effectively sharing data with the service. This method must be called after getPassportAuthorizationFormAvailableElements if some previously available elements are going to be reused +//@autorization_form_id Authorization form identifier @types Types of Telegram Passport elements chosen by user to complete the authorization form +sendPassportAuthorizationForm autorization_form_id:int32 types:vector = Ok; + + +//@description Sends phone number confirmation code. Should be called when user presses "https://t.me/confirmphone?phone=*******&hash=**********" or "tg://confirmphone?phone=*******&hash=**********" link @hash Value of the "hash" parameter from the link +//@phone_number Value of the "phone" parameter from the link @settings Settings for the authentication of the user's phone number +sendPhoneNumberConfirmationCode hash:string phone_number:string settings:phoneNumberAuthenticationSettings = AuthenticationCodeInfo; + +//@description Resends phone number confirmation code +resendPhoneNumberConfirmationCode = AuthenticationCodeInfo; + +//@description Checks phone number confirmation code @code The phone number confirmation code +checkPhoneNumberConfirmationCode code:string = Ok; + + +//@description Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only @pending_update_count The number of pending updates @error_message The last error message +setBotUpdatesStatus pending_update_count:int32 error_message:string = Ok; + + +//@description Uploads a PNG image with a sticker; for bots only; returns the uploaded file +//@user_id Sticker file owner @png_sticker PNG image with the sticker; must be up to 512 KB in size and fit in 512x512 square +uploadStickerFile user_id:int32 png_sticker:InputFile = File; + +//@description Creates a new sticker set; for bots only. Returns the newly created sticker set +//@user_id Sticker set owner +//@title Sticker set title; 1-64 characters +//@name Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive); 1-64 characters +//@is_masks True, if stickers are masks. Animated stickers can't be masks +//@stickers List of stickers to be added to the set; must be non-empty. All stickers must be of the same type +createNewStickerSet user_id:int32 title:string name:string is_masks:Bool stickers:vector = StickerSet; + +//@description Adds a new sticker to a set; for bots only. Returns the sticker set +//@user_id Sticker set owner @name Sticker set name @sticker Sticker to add to the set +addStickerToSet user_id:int32 name:string sticker:InputSticker = StickerSet; + +//@description Sets a sticker set thumbnail; for bots only. Returns the sticker set +//@user_id Sticker set owner @name Sticker set name +//@thumbnail Thumbnail to set in PNG or TGS format. Animated thumbnail must be set for animated sticker sets and only for them. Pass a zero InputFileId to delete the thumbnail +setStickerSetThumbnail user_id:int32 name:string thumbnail:InputFile = StickerSet; + +//@description Changes the position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot +//@sticker Sticker @position New position of the sticker in the set, zero-based +setStickerPositionInSet sticker:InputFile position:int32 = Ok; + +//@description Removes a sticker from the set to which it belongs; for bots only. The sticker set must have been created by the bot @sticker Sticker +removeStickerFromSet sticker:InputFile = Ok; + + +//@description Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded @location Location of the map center @zoom Map zoom level; 13-20 @width Map width in pixels before applying scale; 16-1024 @height Map height in pixels before applying scale; 16-1024 @scale Map scale; 1-3 @chat_id Identifier of a chat, in which the thumbnail will be shown. Use 0 if unknown +getMapThumbnailFile location:location zoom:int32 width:int32 height:int32 scale:int32 chat_id:int53 = File; + + +//@description Accepts Telegram terms of services @terms_of_service_id Terms of service identifier +acceptTermsOfService terms_of_service_id:string = Ok; + + +//@description Sends a custom request; for bots only @method The method name @parameters JSON-serialized method parameters +sendCustomRequest method:string parameters:string = CustomRequestResult; + +//@description Answers a custom query; for bots only @custom_query_id Identifier of a custom query @data JSON-serialized answer to the query +answerCustomQuery custom_query_id:int64 data:string = Ok; + + +//@description Succeeds after a specified amount of time has passed. Can be called before initialization @seconds Number of seconds before the function returns +setAlarm seconds:double = Ok; + + +//@description Returns information about existing countries. Can be called before authorization +getCountries = Countries; + +//@description Uses current user IP address to find their country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization +getCountryCode = Text; + +//@description Returns information about a phone number by its prefix. Can be called before authorization @phone_number_prefix The phone number prefix +getPhoneNumberInfo phone_number_prefix:string = PhoneNumberInfo; + +//@description Returns the default text for invitation messages to be used as a placeholder when the current user invites friends to Telegram +getInviteText = Text; + +//@description Returns information about a tg:// deep link. Use "tg://need_update_for_some_feature" or "tg:some_unsupported_feature" for testing. Returns a 404 error for unknown links. Can be called before authorization @link The link +getDeepLinkInfo link:string = DeepLinkInfo; + + +//@description Returns application config, provided by the server. Can be called before authorization +getApplicationConfig = JsonValue; + +//@description Saves application log event on the server. Can be called before authorization @type Event type @chat_id Optional chat identifier, associated with the event @data The log event data +saveApplicationLogEvent type:string chat_id:int53 data:JsonValue = Ok; + + +//@description Adds a proxy server for network requests. Can be called before authorization @server Proxy server IP address @port Proxy server port @enable True, if the proxy should be enabled @type Proxy type +addProxy server:string port:int32 enable:Bool type:ProxyType = Proxy; + +//@description Edits an existing proxy server for network requests. Can be called before authorization @proxy_id Proxy identifier @server Proxy server IP address @port Proxy server port @enable True, if the proxy should be enabled @type Proxy type +editProxy proxy_id:int32 server:string port:int32 enable:Bool type:ProxyType = Proxy; + +//@description Enables a proxy. Only one proxy can be enabled at a time. Can be called before authorization @proxy_id Proxy identifier +enableProxy proxy_id:int32 = Ok; + +//@description Disables the currently enabled proxy. Can be called before authorization +disableProxy = Ok; + +//@description Removes a proxy server. Can be called before authorization @proxy_id Proxy identifier +removeProxy proxy_id:int32 = Ok; + +//@description Returns list of proxies that are currently set up. Can be called before authorization +getProxies = Proxies; + +//@description Returns an HTTPS link, which can be used to add a proxy. Available only for SOCKS5 and MTProto proxies. Can be called before authorization @proxy_id Proxy identifier +getProxyLink proxy_id:int32 = Text; + +//@description Computes time needed to receive a response from a Telegram server through a proxy. Can be called before authorization @proxy_id Proxy identifier. Use 0 to ping a Telegram server without a proxy +pingProxy proxy_id:int32 = Seconds; + + +//@description Sets new log stream for internal logging of TDLib. Can be called synchronously @log_stream New log stream +setLogStream log_stream:LogStream = Ok; + +//@description Returns information about currently used log stream for internal logging of TDLib. Can be called synchronously +getLogStream = LogStream; + +//@description Sets the verbosity level of the internal logging of TDLib. Can be called synchronously +//@new_verbosity_level New value of the verbosity level for logging. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug, value greater than 5 and up to 1023 can be used to enable even more logging +setLogVerbosityLevel new_verbosity_level:int32 = Ok; + +//@description Returns current verbosity level of the internal logging of TDLib. Can be called synchronously +getLogVerbosityLevel = LogVerbosityLevel; + +//@description Returns list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously +getLogTags = LogTags; + +//@description Sets the verbosity level for a specified TDLib internal log tag. Can be called synchronously +//@tag Logging tag to change verbosity level @new_verbosity_level New verbosity level; 1-1024 +setLogTagVerbosityLevel tag:string new_verbosity_level:int32 = Ok; + +//@description Returns current verbosity level for a specified TDLib internal log tag. Can be called synchronously @tag Logging tag to change verbosity level +getLogTagVerbosityLevel tag:string = LogVerbosityLevel; + +//@description Adds a message to TDLib internal log. Can be called synchronously +//@verbosity_level The minimum verbosity level needed for the message to be logged, 0-1023 @text Text of a message to log +addLogMessage verbosity_level:int32 text:string = Ok; + + +//@description Does nothing; for testing only. This is an offline method. Can be called before authorization +testCallEmpty = Ok; +//@description Returns the received string; for testing only. This is an offline method. Can be called before authorization @x String to return +testCallString x:string = TestString; +//@description Returns the received bytes; for testing only. This is an offline method. Can be called before authorization @x Bytes to return +testCallBytes x:bytes = TestBytes; +//@description Returns the received vector of numbers; for testing only. This is an offline method. Can be called before authorization @x Vector of numbers to return +testCallVectorInt x:vector = TestVectorInt; +//@description Returns the received vector of objects containing a number; for testing only. This is an offline method. Can be called before authorization @x Vector of objects to return +testCallVectorIntObject x:vector = TestVectorIntObject; +//@description Returns the received vector of strings; for testing only. This is an offline method. Can be called before authorization @x Vector of strings to return +testCallVectorString x:vector = TestVectorString; +//@description Returns the received vector of objects containing a string; for testing only. This is an offline method. Can be called before authorization @x Vector of objects to return +testCallVectorStringObject x:vector = TestVectorStringObject; +//@description Returns the squared received number; for testing only. This is an offline method. Can be called before authorization @x Number to square +testSquareInt x:int32 = TestInt; +//@description Sends a simple network request to the Telegram servers; for testing only. Can be called before authorization +testNetwork = Ok; +//@description Sends a simple network request to the Telegram servers via proxy; for testing only. Can be called before authorization @server Proxy server IP address @port Proxy server port @type Proxy type +//@dc_id Identifier of a datacenter, with which to test connection @timeout The maximum overall timeout for the request +testProxy server:string port:int32 type:ProxyType dc_id:int32 timeout:double = Ok; +//@description Forces an updates.getDifference call to the Telegram servers; for testing only +testGetDifference = Ok; +//@description Does nothing and ensures that the Update object is used; for testing only. This is an offline method. Can be called before authorization +testUseUpdate = Update; +//@description Returns the specified error and ensures that the Error object is used; for testing only. Can be called synchronously @error The error to be returned +testReturnError error:error = Error; diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..e55aff3 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module github.com/astravexton/go-tdlib + +go 1.16 + +require golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..9bd8c9b --- /dev/null +++ b/go.sum @@ -0,0 +1,10 @@ +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/tlparser/code.go b/tlparser/code.go new file mode 100644 index 0000000..acfbf05 --- /dev/null +++ b/tlparser/code.go @@ -0,0 +1,74 @@ +package tlparser + +import ( + "bufio" + "fmt" + "io" + "strings" +) + +func ParseCode(reader io.Reader, schema *Schema) error { + var prevLine string + var curLine string + + userMethods := map[string]bool{} + botMethods := map[string]bool{} + + scanner := bufio.NewScanner(reader) + for scanner.Scan() { + prevLine = curLine + curLine = scanner.Text() + + if strings.Contains(curLine, "CHECK_IS_USER();") { + fields := strings.Fields(prevLine) + for _, field := range fields { + var methodName string + n, err := fmt.Sscanf(field, "td_api::%s", &methodName) + if err == nil && n > 0 { + userMethods[methodName] = true + } + } + } + + if strings.Contains(curLine, "CHECK_IS_BOT();") { + fields := strings.Fields(prevLine) + for _, field := range fields { + var methodName string + n, err := fmt.Sscanf(field, "td_api::%s", &methodName) + if err == nil && n > 0 { + botMethods[methodName] = true + } + } + } + } + + err := scanner.Err() + if err != nil { + return err + } + + var ok bool + + for index, _ := range schema.Functions { + hasType := false + _, ok = userMethods[schema.Functions[index].Name] + if ok { + schema.Functions[index].Type = FUNCTION_TYPE_USER + hasType = true + } + + _, ok = botMethods[schema.Functions[index].Name] + if ok { + schema.Functions[index].Type = FUNCTION_TYPE_BOT + hasType = true + } + + if !hasType { + schema.Functions[index].Type = FUNCTION_TYPE_COMMON + } + + ok = false + } + + return nil +} diff --git a/tlparser/parser.go b/tlparser/parser.go new file mode 100644 index 0000000..c22b96a --- /dev/null +++ b/tlparser/parser.go @@ -0,0 +1,174 @@ +package tlparser + +import ( + "bufio" + "io" + "strings" +) + +func Parse(reader io.Reader) (*Schema, error) { + schema := &Schema{ + Types: []*Type{}, + Classes: []*Class{}, + Functions: []*Function{}, + } + + scanner := bufio.NewScanner(reader) + + hitFunctions := false + + for scanner.Scan() { + line := scanner.Text() + + switch { + case strings.HasPrefix(line, "//@description"): + if hitFunctions { + schema.Functions = append(schema.Functions, parseFunction(line, scanner)) + } else { + schema.Types = append(schema.Types, parseType(line, scanner)) + } + + case strings.HasPrefix(line, "//@class"): + schema.Classes = append(schema.Classes, parseClass(line, scanner)) + + case strings.Contains(line, "---functions---"): + hitFunctions = true + + case line == "": + + default: + bodyFields := strings.Fields(line) + name := bodyFields[0] + class := strings.TrimRight(bodyFields[len(bodyFields)-1], ";") + if hitFunctions { + schema.Functions = append(schema.Functions, &Function{ + Name: name, + Description: "", + Class: class, + Properties: []*Property{}, + IsSynchronous: false, + Type: FUNCTION_TYPE_UNKNOWN, + }) + } else { + if name == "vector" { + name = "vector" + class = "Vector" + } + + schema.Types = append(schema.Types, &Type{ + Name: name, + Description: "", + Class: class, + Properties: []*Property{}, + }) + } + } + } + + return schema, nil +} + +func parseType(firstLine string, scanner *bufio.Scanner) *Type { + name, description, class, properties, _ := parseEntity(firstLine, scanner) + return &Type{ + Name: name, + Description: description, + Class: class, + Properties: properties, + } +} + +func parseFunction(firstLine string, scanner *bufio.Scanner) *Function { + name, description, class, properties, isSynchronous := parseEntity(firstLine, scanner) + return &Function{ + Name: name, + Description: description, + Class: class, + Properties: properties, + IsSynchronous: isSynchronous, + Type: FUNCTION_TYPE_UNKNOWN, + } +} + +func parseClass(firstLine string, scanner *bufio.Scanner) *Class { + class := &Class{ + Name: "", + Description: "", + } + + classLineParts := strings.Split(firstLine, "@") + + _, class.Name = parseProperty(classLineParts[1]) + _, class.Description = parseProperty(classLineParts[2]) + + return class +} + +func parseEntity(firstLine string, scanner *bufio.Scanner) (string, string, string, []*Property, bool) { + name := "" + description := "" + class := "" + properties := []*Property{} + + propertiesLine := strings.TrimLeft(firstLine, "//") + +Loop: + for scanner.Scan() { + line := scanner.Text() + + switch { + case strings.HasPrefix(line, "//@"): + propertiesLine += " " + strings.TrimLeft(line, "//") + + case strings.HasPrefix(line, "//-"): + propertiesLine += " " + strings.TrimLeft(line, "//-") + + default: + bodyFields := strings.Fields(line) + name = bodyFields[0] + + for _, rawProperty := range bodyFields[1 : len(bodyFields)-2] { + propertyParts := strings.Split(rawProperty, ":") + property := &Property{ + Name: propertyParts[0], + Type: propertyParts[1], + } + properties = append(properties, property) + } + class = strings.TrimRight(bodyFields[len(bodyFields)-1], ";") + break Loop + } + } + + rawProperties := strings.Split(propertiesLine, "@") + for _, rawProperty := range rawProperties[1:] { + name, value := parseProperty(rawProperty) + switch { + case name == "description": + description = value + default: + name = strings.TrimPrefix(name, "param_") + property := getProperty(properties, name) + property.Description = value + + } + } + + return name, description, class, properties, strings.Contains(description, "Can be called synchronously") +} + +func parseProperty(str string) (string, string) { + strParts := strings.Fields(str) + + return strParts[0], strings.Join(strParts[1:], " ") +} + +func getProperty(properties []*Property, name string) *Property { + for _, property := range properties { + if property.Name == name { + return property + } + } + + return nil +} diff --git a/tlparser/type.go b/tlparser/type.go new file mode 100644 index 0000000..5948fe1 --- /dev/null +++ b/tlparser/type.go @@ -0,0 +1,43 @@ +package tlparser + +type Schema struct { + Types []*Type `json:"types"` + Classes []*Class `json:"classes"` + Functions []*Function `json:"functions"` +} + +type Type struct { + Name string `json:"name"` + Description string `json:"description"` + Class string `json:"class"` + Properties []*Property `json:"properties"` +} + +type Class struct { + Name string `json:"name"` + Description string `json:"description"` +} + +type FunctionType int + +const ( + FUNCTION_TYPE_UNKNOWN FunctionType = iota + FUNCTION_TYPE_COMMON + FUNCTION_TYPE_USER + FUNCTION_TYPE_BOT +) + +type Function struct { + Name string `json:"name"` + Description string `json:"description"` + Class string `json:"class"` + Properties []*Property `json:"properties"` + IsSynchronous bool `json:"is_synchronous"` + Type FunctionType `json:"type"` +} + +type Property struct { + Name string `json:"name"` + Type string `json:"type"` + Description string `json:"description"` +}