diff --git a/Makefile b/Makefile index bf3dcd6..07b4754 100644 --- a/Makefile +++ b/Makefile @@ -16,3 +16,4 @@ generate-code: -functionFile function.go \ -typeFile type.go \ -unmarshalerFile unmarshaler.go + go fmt ./client diff --git a/client/authorization.go b/client/authorization.go index c31005f..639a483 100644 --- a/client/authorization.go +++ b/client/authorization.go @@ -1,214 +1,214 @@ package client import ( - "errors" - "fmt" - "time" + "errors" + "fmt" + "time" ) var ErrNotSupportedAuthorizationState = errors.New("not supported state") type AuthorizationStateHandler interface { - Handle(client *Client, state AuthorizationState) error + Handle(client *Client, state AuthorizationState) error } func Authorize(client *Client, authorizationStateHandler AuthorizationStateHandler) error { - for { - state, err := client.GetAuthorizationState() - if err != nil { - return err - } + for { + state, err := client.GetAuthorizationState() + if err != nil { + return err + } - err = authorizationStateHandler.Handle(client, state) - if err != nil { - return err - } + err = authorizationStateHandler.Handle(client, state) + if err != nil { + return err + } - if state.AuthorizationStateType() == TypeAuthorizationStateReady { - // dirty hack for db flush after authorization - time.Sleep(1 * time.Second) - return nil - } - } + if state.AuthorizationStateType() == TypeAuthorizationStateReady { + // dirty hack for db flush after authorization + time.Sleep(1 * time.Second) + return nil + } + } } type clientAuthorizer struct { - TdlibParameters chan *TdlibParameters - PhoneNumber chan string - Code chan string - State chan AuthorizationState - FirstName chan string - LastName chan string + TdlibParameters chan *TdlibParameters + PhoneNumber chan string + Code chan string + State chan AuthorizationState + FirstName chan string + LastName 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), - FirstName: make(chan string, 1), - LastName: make(chan string, 1), - } + return &clientAuthorizer{ + TdlibParameters: make(chan *TdlibParameters, 1), + PhoneNumber: make(chan string, 1), + Code: make(chan string, 1), + State: make(chan AuthorizationState, 10), + FirstName: make(chan string, 1), + LastName: make(chan string, 1), + } } func (stateHandler *clientAuthorizer) Handle(client *Client, state AuthorizationState) error { - stateHandler.State <- state + stateHandler.State <- state - switch state.AuthorizationStateType() { - case TypeAuthorizationStateWaitTdlibParameters: - _, err := client.SetTdlibParameters(&SetTdlibParametersRequest{ - Parameters: <-stateHandler.TdlibParameters, - }) - return err + switch state.AuthorizationStateType() { + case TypeAuthorizationStateWaitTdlibParameters: + _, err := client.SetTdlibParameters(&SetTdlibParametersRequest{ + Parameters: <-stateHandler.TdlibParameters, + }) + return err - case TypeAuthorizationStateWaitEncryptionKey: - _, err := client.CheckDatabaseEncryptionKey(&CheckDatabaseEncryptionKeyRequest{}) - return err + case TypeAuthorizationStateWaitEncryptionKey: + _, err := client.CheckDatabaseEncryptionKey(&CheckDatabaseEncryptionKeyRequest{}) + return err - case TypeAuthorizationStateWaitPhoneNumber: - _, err := client.SetAuthenticationPhoneNumber(&SetAuthenticationPhoneNumberRequest{ - PhoneNumber: <-stateHandler.PhoneNumber, - AllowFlashCall: false, - IsCurrentPhoneNumber: false, - }) - return err + case TypeAuthorizationStateWaitPhoneNumber: + _, err := client.SetAuthenticationPhoneNumber(&SetAuthenticationPhoneNumberRequest{ + PhoneNumber: <-stateHandler.PhoneNumber, + AllowFlashCall: false, + IsCurrentPhoneNumber: false, + }) + return err - case TypeAuthorizationStateWaitCode: - _, err := client.CheckAuthenticationCode(&CheckAuthenticationCodeRequest{ - Code: <-stateHandler.Code, - FirstName: <-stateHandler.FirstName, - LastName: <-stateHandler.LastName, - }) - return err + case TypeAuthorizationStateWaitCode: + _, err := client.CheckAuthenticationCode(&CheckAuthenticationCodeRequest{ + Code: <-stateHandler.Code, + FirstName: <-stateHandler.FirstName, + LastName: <-stateHandler.LastName, + }) + return err - case TypeAuthorizationStateWaitPassword: - return ErrNotSupportedAuthorizationState + case TypeAuthorizationStateWaitPassword: + return ErrNotSupportedAuthorizationState - case TypeAuthorizationStateReady: - close(stateHandler.TdlibParameters) - close(stateHandler.PhoneNumber) - close(stateHandler.Code) - close(stateHandler.State) - close(stateHandler.FirstName) - close(stateHandler.LastName) + case TypeAuthorizationStateReady: + close(stateHandler.TdlibParameters) + close(stateHandler.PhoneNumber) + close(stateHandler.Code) + close(stateHandler.State) + close(stateHandler.FirstName) + close(stateHandler.LastName) - return nil + return nil - case TypeAuthorizationStateLoggingOut: - return ErrNotSupportedAuthorizationState + case TypeAuthorizationStateLoggingOut: + return ErrNotSupportedAuthorizationState - case TypeAuthorizationStateClosing: - return ErrNotSupportedAuthorizationState + case TypeAuthorizationStateClosing: + return ErrNotSupportedAuthorizationState - case TypeAuthorizationStateClosed: - return ErrNotSupportedAuthorizationState - } + case TypeAuthorizationStateClosed: + return ErrNotSupportedAuthorizationState + } - return ErrNotSupportedAuthorizationState + return ErrNotSupportedAuthorizationState } func CliInteractor(clientAuthorizer *clientAuthorizer) { - for { - select { - case state := <-clientAuthorizer.State: - switch state.AuthorizationStateType() { - case TypeAuthorizationStateWaitPhoneNumber: - fmt.Println("Enter phone number: ") - var phoneNumber string - fmt.Scanln(&phoneNumber) + for { + select { + case state := <-clientAuthorizer.State: + switch state.AuthorizationStateType() { + case TypeAuthorizationStateWaitPhoneNumber: + fmt.Println("Enter phone number: ") + var phoneNumber string + fmt.Scanln(&phoneNumber) - clientAuthorizer.PhoneNumber <- phoneNumber + clientAuthorizer.PhoneNumber <- phoneNumber - case TypeAuthorizationStateWaitCode: - var code string - var firstName string - var lastName string + case TypeAuthorizationStateWaitCode: + var code string + var firstName string + var lastName string - fmt.Println("Enter code: ") - fmt.Scanln(&code) + fmt.Println("Enter code: ") + fmt.Scanln(&code) - if !state.(*AuthorizationStateWaitCode).IsRegistered { - fmt.Println("Phone number is not registered.") + if !state.(*AuthorizationStateWaitCode).IsRegistered { + fmt.Println("Phone number is not registered.") - fmt.Println("Enter first name: ") - fmt.Scanln(&firstName) + fmt.Println("Enter first name: ") + fmt.Scanln(&firstName) - fmt.Println("Enter last name: ") - fmt.Scanln(&lastName) - } + fmt.Println("Enter last name: ") + fmt.Scanln(&lastName) + } - clientAuthorizer.Code <- code - clientAuthorizer.FirstName <- firstName - clientAuthorizer.LastName <- lastName + clientAuthorizer.Code <- code + clientAuthorizer.FirstName <- firstName + clientAuthorizer.LastName <- lastName - case TypeAuthorizationStateReady: - return - } - } - } + case TypeAuthorizationStateReady: + return + } + } + } } type botAuthorizer struct { - TdlibParameters chan *TdlibParameters - Token chan string - State chan AuthorizationState + 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 := &botAuthorizer{ + TdlibParameters: make(chan *TdlibParameters, 1), + Token: make(chan string, 1), + State: make(chan AuthorizationState, 10), + } - botAuthorizer.Token <- token + botAuthorizer.Token <- token - return botAuthorizer + return botAuthorizer } func (stateHandler *botAuthorizer) Handle(client *Client, state AuthorizationState) error { - stateHandler.State <- state + stateHandler.State <- state - switch state.AuthorizationStateType() { - case TypeAuthorizationStateWaitTdlibParameters: - _, err := client.SetTdlibParameters(&SetTdlibParametersRequest{ - Parameters: <-stateHandler.TdlibParameters, - }) - return err + switch state.AuthorizationStateType() { + case TypeAuthorizationStateWaitTdlibParameters: + _, err := client.SetTdlibParameters(&SetTdlibParametersRequest{ + Parameters: <-stateHandler.TdlibParameters, + }) + return err - case TypeAuthorizationStateWaitEncryptionKey: - _, err := client.CheckDatabaseEncryptionKey(&CheckDatabaseEncryptionKeyRequest{}) - return err + case TypeAuthorizationStateWaitEncryptionKey: + _, err := client.CheckDatabaseEncryptionKey(&CheckDatabaseEncryptionKeyRequest{}) + return err - case TypeAuthorizationStateWaitPhoneNumber: - _, err := client.CheckAuthenticationBotToken(&CheckAuthenticationBotTokenRequest{ - Token: <-stateHandler.Token, - }) - return err + case TypeAuthorizationStateWaitPhoneNumber: + _, err := client.CheckAuthenticationBotToken(&CheckAuthenticationBotTokenRequest{ + Token: <-stateHandler.Token, + }) + return err - case TypeAuthorizationStateWaitCode: - return ErrNotSupportedAuthorizationState + case TypeAuthorizationStateWaitCode: + return ErrNotSupportedAuthorizationState - case TypeAuthorizationStateWaitPassword: - return ErrNotSupportedAuthorizationState + case TypeAuthorizationStateWaitPassword: + return ErrNotSupportedAuthorizationState - case TypeAuthorizationStateReady: - close(stateHandler.TdlibParameters) - close(stateHandler.Token) - close(stateHandler.State) + case TypeAuthorizationStateReady: + close(stateHandler.TdlibParameters) + close(stateHandler.Token) + close(stateHandler.State) - return nil + return nil - case TypeAuthorizationStateLoggingOut: - return ErrNotSupportedAuthorizationState + case TypeAuthorizationStateLoggingOut: + return ErrNotSupportedAuthorizationState - case TypeAuthorizationStateClosing: - return ErrNotSupportedAuthorizationState + case TypeAuthorizationStateClosing: + return ErrNotSupportedAuthorizationState - case TypeAuthorizationStateClosed: - return ErrNotSupportedAuthorizationState - } + case TypeAuthorizationStateClosed: + return ErrNotSupportedAuthorizationState + } - return ErrNotSupportedAuthorizationState + return ErrNotSupportedAuthorizationState } diff --git a/client/client.go b/client/client.go index c98f39b..c4f8d6e 100644 --- a/client/client.go +++ b/client/client.go @@ -1,145 +1,145 @@ package client import ( - "errors" - "sync" - "time" + "errors" + "sync" + "time" ) type Client struct { - jsonClient *JsonClient - extraGenerator ExtraGenerator - catcher chan *Response - listenerStore *listenerStore - catchersStore *sync.Map - updatesTimeout time.Duration - catchTimeout time.Duration + 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 - } + return func(client *Client) { + client.extraGenerator = extraGenerator + } } func WithCatchTimeout(timeout time.Duration) Option { - return func(client *Client) { - client.catchTimeout = timeout - } + return func(client *Client) { + client.catchTimeout = timeout + } } func WithUpdatesTimeout(timeout time.Duration) Option { - return func(client *Client) { - client.updatesTimeout = timeout - } + return func(client *Client) { + client.updatesTimeout = timeout + } } func NewClient(authorizationStateHandler AuthorizationStateHandler, options ...Option) (*Client, error) { - catchersListener := make(chan *Response, 1000) + catchersListener := make(chan *Response, 1000) - client := &Client{ - jsonClient: NewJsonClient(), - catcher: catchersListener, - listenerStore: newListenerStore(), - catchersStore: &sync.Map{}, - } + client := &Client{ + jsonClient: NewJsonClient(), + catcher: catchersListener, + listenerStore: newListenerStore(), + catchersStore: &sync.Map{}, + } - for _, option := range options { - option(client) - } + for _, option := range options { + option(client) + } - if client.extraGenerator == nil { - client.extraGenerator = UuidV4Generator() - } + if client.extraGenerator == nil { + client.extraGenerator = UuidV4Generator() + } - if client.catchTimeout == 0 { - client.catchTimeout = 60 * time.Second - } + if client.catchTimeout == 0 { + client.catchTimeout = 60 * time.Second + } - if client.updatesTimeout == 0 { - client.updatesTimeout = 60 * time.Second - } + if client.updatesTimeout == 0 { + client.updatesTimeout = 60 * time.Second + } - go client.receive() - go client.catch(catchersListener) + go client.receive() + go client.catch(catchersListener) - err := Authorize(client, authorizationStateHandler) - if err != nil { - return nil, err - } + err := Authorize(client, authorizationStateHandler) + if err != nil { + return nil, err + } - return client, nil + return client, nil } func (client *Client) receive() { - for { - resp, err := client.jsonClient.Receive(client.updatesTimeout) - if err != nil { - continue - } - client.catcher <- resp + for { + resp, err := client.jsonClient.Receive(client.updatesTimeout) + if err != nil { + continue + } + client.catcher <- resp - typ, err := UnmarshalType(resp.Data) - if err != nil { - continue - } + 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() - } - } + 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 - } - } - } + 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() + req.Extra = client.extraGenerator() - catcher := make(chan *Response, 1) + catcher := make(chan *Response, 1) - client.catchersStore.Store(req.Extra, catcher) + client.catchersStore.Store(req.Extra, catcher) - defer func() { - close(catcher) - client.catchersStore.Delete(req.Extra) - }() + defer func() { + close(catcher) + client.catchersStore.Delete(req.Extra) + }() - client.jsonClient.Send(req) + client.jsonClient.Send(req) - select { - case response := <-catcher: - return response, nil + select { + case response := <-catcher: + return response, nil - case <-time.After(client.catchTimeout): - return nil, errors.New("response catching timeout") - } + 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) + listener := &Listener{ + isActive: true, + Updates: make(chan Type, 1000), + } + client.listenerStore.Add(listener) - return listener + return listener } diff --git a/client/extra.go b/client/extra.go index b77e6b6..bccd2c8 100644 --- a/client/extra.go +++ b/client/extra.go @@ -1,20 +1,20 @@ package client import ( - "fmt" - "math/rand" + "fmt" + "math/rand" ) type ExtraGenerator func() string func UuidV4Generator() ExtraGenerator { - return func() string { - var uuid [16]byte - rand.Read(uuid[:]) + return func() string { + var uuid [16]byte + rand.Read(uuid[:]) - uuid[6] = (uuid[6] & 0x0f) | 0x40 - uuid[8] = (uuid[8] & 0x3f) | 0x80 + 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:]) - } + 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 index 2092db0..8401d7d 100755 --- a/client/function.go +++ b/client/function.go @@ -3,8726 +3,8726 @@ package client import ( - "errors" + "errors" ) // Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - switch result.Type { - case TypeAuthorizationStateWaitTdlibParameters: - return UnmarshalAuthorizationStateWaitTdlibParameters(result.Data) + switch result.Type { + case TypeAuthorizationStateWaitTdlibParameters: + return UnmarshalAuthorizationStateWaitTdlibParameters(result.Data) - case TypeAuthorizationStateWaitEncryptionKey: - return UnmarshalAuthorizationStateWaitEncryptionKey(result.Data) + case TypeAuthorizationStateWaitEncryptionKey: + return UnmarshalAuthorizationStateWaitEncryptionKey(result.Data) - case TypeAuthorizationStateWaitPhoneNumber: - return UnmarshalAuthorizationStateWaitPhoneNumber(result.Data) + case TypeAuthorizationStateWaitPhoneNumber: + return UnmarshalAuthorizationStateWaitPhoneNumber(result.Data) - case TypeAuthorizationStateWaitCode: - return UnmarshalAuthorizationStateWaitCode(result.Data) + case TypeAuthorizationStateWaitCode: + return UnmarshalAuthorizationStateWaitCode(result.Data) - case TypeAuthorizationStateWaitPassword: - return UnmarshalAuthorizationStateWaitPassword(result.Data) + case TypeAuthorizationStateWaitPassword: + return UnmarshalAuthorizationStateWaitPassword(result.Data) - case TypeAuthorizationStateReady: - return UnmarshalAuthorizationStateReady(result.Data) + case TypeAuthorizationStateReady: + return UnmarshalAuthorizationStateReady(result.Data) - case TypeAuthorizationStateLoggingOut: - return UnmarshalAuthorizationStateLoggingOut(result.Data) + case TypeAuthorizationStateLoggingOut: + return UnmarshalAuthorizationStateLoggingOut(result.Data) - case TypeAuthorizationStateClosing: - return UnmarshalAuthorizationStateClosing(result.Data) + case TypeAuthorizationStateClosing: + return UnmarshalAuthorizationStateClosing(result.Data) - case TypeAuthorizationStateClosed: - return UnmarshalAuthorizationStateClosed(result.Data) + case TypeAuthorizationStateClosed: + return UnmarshalAuthorizationStateClosed(result.Data) - default: - return nil, errors.New("invalid type") - } + default: + return nil, errors.New("invalid type") + } } -type SetTdlibParametersRequest struct { - // Parameters - Parameters *TdlibParameters `json:"parameters"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type CheckDatabaseEncryptionKeyRequest struct { - // Encryption key to check or set up - EncryptionKey []byte `json:"encryption_key"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetAuthenticationPhoneNumberRequest struct { - // The phone number of the user, in international format - PhoneNumber string `json:"phone_number"` - // 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 phone number is used on the current device. Ignored if allow_flash_call is false - IsCurrentPhoneNumber bool `json:"is_current_phone_number"` +type SetAuthenticationPhoneNumberRequest struct { + // The phone number of the user, in international format + PhoneNumber string `json:"phone_number"` + // 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 phone number is used on the current device. Ignored if allow_flash_call is false + IsCurrentPhoneNumber bool `json:"is_current_phone_number"` } // Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber 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, - "allow_flash_call": req.AllowFlashCall, - "is_current_phone_number": req.IsCurrentPhoneNumber, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "setAuthenticationPhoneNumber", + }, + Data: map[string]interface{}{ + "phone_number": req.PhoneNumber, + "allow_flash_call": req.AllowFlashCall, + "is_current_phone_number": req.IsCurrentPhoneNumber, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` - // If the user is not yet registered, the first name of the user; 1-255 characters - FirstName string `json:"first_name"` - // If the user is not yet registered; the last name of the user; optional; 0-255 characters - LastName string `json:"last_name"` +type CheckAuthenticationCodeRequest struct { + // The verification code received via SMS, Telegram message, phone call, or flash call + Code string `json:"code"` + // If the user is not yet registered, the first name of the user; 1-255 characters + FirstName string `json:"first_name"` + // If the user is not yet registered; the last name of the user; optional; 0-255 characters + LastName string `json:"last_name"` } // 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, - "first_name": req.FirstName, - "last_name": req.LastName, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "checkAuthenticationCode", + }, + Data: map[string]interface{}{ + "code": req.Code, + "first_name": req.FirstName, + "last_name": req.LastName, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type CheckAuthenticationPasswordRequest struct { - // The password to check - Password string `json:"password"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type RecoverAuthenticationPasswordRequest struct { - // Recovery code to check - RecoveryCode string `json:"recovery_code"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type CheckAuthenticationBotTokenRequest struct { - // The bot token - Token string `json:"token"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetDatabaseEncryptionKeyRequest struct { - // New encryption key - NewEncryptionKey []byte `json:"new_encryption_key"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalPasswordState(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"` +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 error EMAIL_UNCONFIRMED is returned and the password change will not be applied until the new recovery email address has been confirmed. The application should periodically call getPasswordState to check whether the new email address has been 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalPasswordState(result.Data) + return UnmarshalPasswordState(result.Data) } -type GetRecoveryEmailAddressRequest struct { - // The password for the current user - Password string `json:"password"` +type GetRecoveryEmailAddressRequest struct { + // The password for the current user + Password string `json:"password"` } // Returns a 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalRecoveryEmailAddress(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"` +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 recovery email address of the user. If a new recovery email address is specified, then the error EMAIL_UNCONFIRMED is returned and the email address will not be changed until the new email has been confirmed. The application should periodically call getPasswordState to check whether the email address has been 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalPasswordState(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalEmailAddressAuthenticationCodeInfo(result.Data) + return UnmarshalEmailAddressAuthenticationCodeInfo(result.Data) } -type RecoverPasswordRequest struct { - // Recovery code to check - RecoveryCode string `json:"recovery_code"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalPasswordState(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalTemporaryPasswordState(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalTemporaryPasswordState(result.Data) + return UnmarshalTemporaryPasswordState(result.Data) } -type ProcessDcUpdateRequest struct { - // Value of the "dc" parameter of the notification - Dc string `json:"dc"` - // Value of the "addr" parameter of the notification - Addr string `json:"addr"` +type ProcessDcUpdateRequest struct { + // Value of the "dc" parameter of the notification + Dc string `json:"dc"` + // Value of the "addr" parameter of the notification + Addr string `json:"addr"` } // Handles a DC_UPDATE push service notification. Can be called before authorization func (client *Client) ProcessDcUpdate(req *ProcessDcUpdateRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "processDcUpdate", - }, - Data: map[string]interface{}{ - "dc": req.Dc, - "addr": req.Addr, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "processDcUpdate", + }, + Data: map[string]interface{}{ + "dc": req.Dc, + "addr": req.Addr, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalUser(result.Data) + return UnmarshalUser(result.Data) } -type GetUserRequest struct { - // User identifier - UserId int32 `json:"user_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalUser(result.Data) + return UnmarshalUser(result.Data) } -type GetUserFullInfoRequest struct { - // User identifier - UserId int32 `json:"user_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalUserFullInfo(result.Data) + return UnmarshalUserFullInfo(result.Data) } -type GetBasicGroupRequest struct { - // Basic group identifier - BasicGroupId int32 `json:"basic_group_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalBasicGroup(result.Data) + return UnmarshalBasicGroup(result.Data) } -type GetBasicGroupFullInfoRequest struct { - // Basic group identifier - BasicGroupId int32 `json:"basic_group_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalBasicGroupFullInfo(result.Data) + return UnmarshalBasicGroupFullInfo(result.Data) } -type GetSupergroupRequest struct { - // Supergroup or channel identifier - SupergroupId int32 `json:"supergroup_id"` +type GetSupergroupRequest struct { + // Supergroup or channel identifier + SupergroupId int32 `json:"supergroup_id"` } // Returns information about a supergroup or 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalSupergroup(result.Data) + return UnmarshalSupergroup(result.Data) } -type GetSupergroupFullInfoRequest struct { - // Supergroup or channel identifier - SupergroupId int32 `json:"supergroup_id"` +type GetSupergroupFullInfoRequest struct { + // Supergroup or channel identifier + SupergroupId int32 `json:"supergroup_id"` } // Returns full information about a supergroup or 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalSupergroupFullInfo(result.Data) + return UnmarshalSupergroupFullInfo(result.Data) } -type GetSecretChatRequest struct { - // Secret chat identifier - SecretChatId int32 `json:"secret_chat_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalSecretChat(result.Data) + return UnmarshalSecretChat(result.Data) } -type GetChatRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChat(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(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 get - MessageId int64 `json:"message_id"` +type GetRepliedMessageRequest struct { + // Identifier of the chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message reply to which get + MessageId int64 `json:"message_id"` } // Returns information about a message that is replied by given message 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(result.Data) + return UnmarshalMessage(result.Data) } -type GetChatPinnedMessageRequest struct { - // Identifier of the chat the message belongs to - ChatId int64 `json:"chat_id"` +type GetChatPinnedMessageRequest struct { + // Identifier of the chat the message belongs to + ChatId int64 `json:"chat_id"` } // Returns information about a pinned chat message 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessages(result.Data) + return UnmarshalMessages(result.Data) } -type GetFileRequest struct { - // Identifier of the file to get - FileId int32 `json:"file_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalFile(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"` +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 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalFile(result.Data) + return UnmarshalFile(result.Data) } -type GetChatsRequest struct { - // 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"` +type GetChatsRequest struct { + // 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. Chats are sorted by the pair (order, chat_id) in decreasing order. (For example, to get a list of chats from the beginning, the offset_order should be equal to 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{}{ - "offset_order": req.OffsetOrder, - "offset_chat_id": req.OffsetChatId, - "limit": req.Limit, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "getChats", + }, + Data: map[string]interface{}{ + "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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChats(result.Data) + return UnmarshalChats(result.Data) } -type SearchPublicChatRequest struct { - // Username to be resolved - Username string `json:"username"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChat(result.Data) + return UnmarshalChat(result.Data) } -type SearchPublicChatsRequest struct { - // Query to search for - Query string `json:"query"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChats(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"` - // Maximum number of chats to be returned - Limit int32 `json:"limit"` +type SearchChatsRequest struct { + // Query to search for. If the query is empty, returns up to 20 recently found chats + Query string `json:"query"` + // 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 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChats(result.Data) + return UnmarshalChats(result.Data) } -type SearchChatsOnServerRequest struct { - // Query to search for - Query string `json:"query"` - // Maximum number of chats to be returned - Limit int32 `json:"limit"` +type SearchChatsOnServerRequest struct { + // Query to search for + Query string `json:"query"` + // 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 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChats(result.Data) + return UnmarshalChats(result.Data) } -type GetTopChatsRequest struct { - // Category of chats to be returned - Category TopChatCategory `json:"category"` - // Maximum number of chats to be returned; up to 30 - Limit int32 `json:"limit"` +type GetTopChatsRequest struct { + // Category of chats to be returned + Category TopChatCategory `json:"category"` + // 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChats(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type AddRecentlyFoundChatRequest struct { - // Identifier of the chat to add - ChatId int64 `json:"chat_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type RemoveRecentlyFoundChatRequest struct { - // Identifier of the chat to be removed - ChatId int64 `json:"chat_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 JsonInt64 `json:"chat_id"` - // Username to be checked - Username string `json:"username"` +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 JsonInt64 `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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - switch result.Type { - case TypeCheckChatUsernameResultOk: - return UnmarshalCheckChatUsernameResultOk(result.Data) + switch result.Type { + case TypeCheckChatUsernameResultOk: + return UnmarshalCheckChatUsernameResultOk(result.Data) - case TypeCheckChatUsernameResultUsernameInvalid: - return UnmarshalCheckChatUsernameResultUsernameInvalid(result.Data) + case TypeCheckChatUsernameResultUsernameInvalid: + return UnmarshalCheckChatUsernameResultUsernameInvalid(result.Data) - case TypeCheckChatUsernameResultUsernameOccupied: - return UnmarshalCheckChatUsernameResultUsernameOccupied(result.Data) + case TypeCheckChatUsernameResultUsernameOccupied: + return UnmarshalCheckChatUsernameResultUsernameOccupied(result.Data) - case TypeCheckChatUsernameResultPublicChatsTooMuch: - return UnmarshalCheckChatUsernameResultPublicChatsTooMuch(result.Data) + case TypeCheckChatUsernameResultPublicChatsTooMuch: + return UnmarshalCheckChatUsernameResultPublicChatsTooMuch(result.Data) - case TypeCheckChatUsernameResultPublicGroupsUnavailable: - return UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(result.Data) + case TypeCheckChatUsernameResultPublicGroupsUnavailable: + return UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(result.Data) - default: - return nil, errors.New("invalid type") - } + default: + return nil, errors.New("invalid type") + } } // Returns a list of public chats created by the user func (client *Client) GetCreatedPublicChats() (*Chats, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getCreatedPublicChats", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "getCreatedPublicChats", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChats(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"` - // Maximum number of chats to be returned; up to 100 - Limit int32 `json:"limit"` +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"` + // Maximum number of chats to be returned; up to 100 + Limit int32 `json:"limit"` } // Returns a list of common 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChats(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 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"` - // If true, returns only messages that are available locally without sending network requests - OnlyLocal bool `json:"only_local"` +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 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"` + // 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessages(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 chats list - RemoveFromChatList bool `json:"remove_from_chat_list"` +type DeleteChatHistoryRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Pass true if the chat should be removed from the chats list + RemoveFromChatList bool `json:"remove_from_chat_list"` } // Deletes all messages in the chat only for the user. Cannot be used in channels and public supergroups 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, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteChatHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "remove_from_chat_list": req.RemoveFromChatList, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 0, only messages sent by the specified user will be returned. Not supported in secret chats - SenderUserId int32 `json:"sender_user_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 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"` +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 0, only messages sent by the specified user will be returned. Not supported in secret chats + SenderUserId int32 `json:"sender_user_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 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"` } // 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_user_id": req.SenderUserId, - "from_message_id": req.FromMessageId, - "offset": req.Offset, - "limit": req.Limit, - "filter": req.Filter, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "searchChatMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "query": req.Query, + "sender_user_id": req.SenderUserId, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + "filter": req.Filter, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessages(result.Data) + return UnmarshalMessages(result.Data) } -type SearchMessagesRequest struct { - // 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"` +type SearchMessagesRequest struct { + // 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"` } // 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{}{ - "query": req.Query, - "offset_date": req.OffsetDate, - "offset_chat_id": req.OffsetChatId, - "offset_message_id": req.OffsetMessageId, - "limit": req.Limit, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "searchMessages", + }, + Data: map[string]interface{}{ + "query": req.Query, + "offset_date": req.OffsetDate, + "offset_chat_id": req.OffsetChatId, + "offset_message_id": req.OffsetMessageId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessages(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"` - // The identifier from the result of a previous request, use 0 to get results from the last message - FromSearchId JsonInt64 `json:"from_search_id"` - // 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 the content of messages in the search results - Filter SearchMessagesFilter `json:"filter"` +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"` + // The identifier from the result of a previous request, use 0 to get results from the last message + FromSearchId JsonInt64 `json:"from_search_id"` + // 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 the content of messages 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, - "from_search_id": req.FromSearchId, - "limit": req.Limit, - "filter": req.Filter, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "searchSecretMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "query": req.Query, + "from_search_id": req.FromSearchId, + "limit": req.Limit, + "filter": req.Filter, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalFoundMessages(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessages(result.Data) + return UnmarshalMessages(result.Data) } -type SearchChatRecentLocationMessagesRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // Maximum number of messages to be returned - Limit int32 `json:"limit"` +type SearchChatRecentLocationMessagesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessages(result.Data) + return UnmarshalMessages(result.Data) } // Returns all active live locations that should be updated by the client. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessages(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalCount(result.Data) + return UnmarshalCount(result.Data) } -type GetPublicMessageLinkRequest 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 if a link for a whole media album should be returned - ForAlbum bool `json:"for_album"` +type GetPublicMessageLinkRequest 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 if a link for a whole media album should be returned + ForAlbum bool `json:"for_album"` } // Returns a public HTTPS link to a message. Available only for messages in public supergroups and channels func (client *Client) GetPublicMessageLink(req *GetPublicMessageLinkRequest) (*PublicMessageLink, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getPublicMessageLink", - }, - Data: map[string]interface{}{ - "chat_id": req.ChatId, - "message_id": req.MessageId, - "for_album": req.ForAlbum, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "getPublicMessageLink", + }, + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalPublicMessageLink(result.Data) + return UnmarshalPublicMessageLink(result.Data) } -type SendMessageRequest struct { - // Target chat - ChatId int64 `json:"chat_id"` - // Identifier of the message to reply to or 0 - ReplyToMessageId int64 `json:"reply_to_message_id"` - // Pass true to disable notification for the message. Not supported in secret chats - DisableNotification bool `json:"disable_notification"` - // Pass true if the message is sent from the background - FromBackground bool `json:"from_background"` - // 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"` +type SendMessageRequest struct { + // Target chat + ChatId int64 `json:"chat_id"` + // Identifier of the message to reply to or 0 + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Pass true to disable notification for the message. Not supported in secret chats + DisableNotification bool `json:"disable_notification"` + // Pass true if the message is sent from the background + FromBackground bool `json:"from_background"` + // 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, - "reply_to_message_id": req.ReplyToMessageId, - "disable_notification": req.DisableNotification, - "from_background": req.FromBackground, - "reply_markup": req.ReplyMarkup, - "input_message_content": req.InputMessageContent, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "sendMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "reply_to_message_id": req.ReplyToMessageId, + "disable_notification": req.DisableNotification, + "from_background": req.FromBackground, + "reply_markup": req.ReplyMarkup, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(result.Data) + return UnmarshalMessage(result.Data) } -type SendMessageAlbumRequest struct { - // Target chat - ChatId int64 `json:"chat_id"` - // Identifier of a message to reply to or 0 - ReplyToMessageId int64 `json:"reply_to_message_id"` - // Pass true to disable notification for the messages. Not supported in secret chats - DisableNotification bool `json:"disable_notification"` - // Pass true if the messages are sent from the background - FromBackground bool `json:"from_background"` - // Contents of messages to be sent - InputMessageContents []InputMessageContent `json:"input_message_contents"` +type SendMessageAlbumRequest struct { + // Target chat + ChatId int64 `json:"chat_id"` + // Identifier of a message to reply to or 0 + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Pass true to disable notification for the messages. Not supported in secret chats + DisableNotification bool `json:"disable_notification"` + // Pass true if the messages are sent from the background + FromBackground bool `json:"from_background"` + // Contents of messages to be sent + InputMessageContents []InputMessageContent `json:"input_message_contents"` } // Sends messages grouped together into an album. Currently only photo and video messages can be grouped into an album. 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, - "reply_to_message_id": req.ReplyToMessageId, - "disable_notification": req.DisableNotification, - "from_background": req.FromBackground, - "input_message_contents": req.InputMessageContents, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "sendMessageAlbum", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "reply_to_message_id": req.ReplyToMessageId, + "disable_notification": req.DisableNotification, + "from_background": req.FromBackground, + "input_message_contents": req.InputMessageContents, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessages(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://api.telegram.org/bots#deep-linking) - Parameter string `json:"parameter"` +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://api.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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(result.Data) + return UnmarshalMessage(result.Data) } -type SendInlineQueryResultMessageRequest struct { - // Target chat - ChatId int64 `json:"chat_id"` - // Identifier of a message to reply to or 0 - ReplyToMessageId int64 `json:"reply_to_message_id"` - // Pass true to disable notification for the message. Not supported in secret chats - DisableNotification bool `json:"disable_notification"` - // Pass true if the message is sent from background - FromBackground bool `json:"from_background"` - // Identifier of the inline query - QueryId JsonInt64 `json:"query_id"` - // Identifier of the inline result - ResultId string `json:"result_id"` +type SendInlineQueryResultMessageRequest struct { + // Target chat + ChatId int64 `json:"chat_id"` + // Identifier of a message to reply to or 0 + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Pass true to disable notification for the message. Not supported in secret chats + DisableNotification bool `json:"disable_notification"` + // Pass true if the message is sent from background + FromBackground bool `json:"from_background"` + // Identifier of the inline query + QueryId JsonInt64 `json:"query_id"` + // Identifier of the inline result + ResultId string `json:"result_id"` } // 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, - "reply_to_message_id": req.ReplyToMessageId, - "disable_notification": req.DisableNotification, - "from_background": req.FromBackground, - "query_id": req.QueryId, - "result_id": req.ResultId, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "sendInlineQueryResultMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "reply_to_message_id": req.ReplyToMessageId, + "disable_notification": req.DisableNotification, + "from_background": req.FromBackground, + "query_id": req.QueryId, + "result_id": req.ResultId, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(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 - MessageIds []int64 `json:"message_ids"` - // Pass true to disable notification for the message, doesn't work if messages are forwarded to a secret chat - DisableNotification bool `json:"disable_notification"` - // Pass true if the message is sent from the background - FromBackground bool `json:"from_background"` - // True, if the messages should be grouped into an album after forwarding. For this to work, no more than 10 messages may be forwarded, and all of them must be photo or video messages - AsAlbum bool `json:"as_album"` +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 + MessageIds []int64 `json:"message_ids"` + // Pass true to disable notification for the message, doesn't work if messages are forwarded to a secret chat + DisableNotification bool `json:"disable_notification"` + // Pass true if the message is sent from the background + FromBackground bool `json:"from_background"` + // True, if the messages should be grouped into an album after forwarding. For this to work, no more than 10 messages may be forwarded, and all of them must be photo or video messages + AsAlbum bool `json:"as_album"` } // 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, - "disable_notification": req.DisableNotification, - "from_background": req.FromBackground, - "as_album": req.AsAlbum, - }, - }) - if err != nil { - return nil, err - } + 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, + "disable_notification": req.DisableNotification, + "from_background": req.FromBackground, + "as_album": req.AsAlbum, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessages(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(result.Data) + return UnmarshalMessage(result.Data) } -type SendChatScreenshotTakenNotificationRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type AddLocalMessageRequest struct { - // Target chat - ChatId int64 `json:"chat_id"` - // Identifier of the user who will be shown as the sender of the message; may be 0 for channel posts - SenderUserId int32 `json:"sender_user_id"` - // 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"` +type AddLocalMessageRequest struct { + // Target chat + ChatId int64 `json:"chat_id"` + // Identifier of the user who will be shown as the sender of the message; may be 0 for channel posts + SenderUserId int32 `json:"sender_user_id"` + // 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_user_id": req.SenderUserId, - "reply_to_message_id": req.ReplyToMessageId, - "disable_notification": req.DisableNotification, - "input_message_content": req.InputMessageContent, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "addLocalMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "sender_user_id": req.SenderUserId, + "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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(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 outgoing messages for all chat members (may fail if messages are too old). Always true for supergroups, channels and secret chats - Revoke bool `json:"revoke"` +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 outgoing messages for all chat members (may fail if messages are too old). 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type DeleteChatMessagesFromUserRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // User identifier - UserId int32 `json:"user_id"` +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 in 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(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"` +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"` } // 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, - }, - }) - if err != nil { - return nil, err - } + 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, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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"` } // 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, - }, - }) - if err != nil { - return nil, err - } + 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, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetTextEntitiesRequest struct { - // The text in which to look for entites - Text string `json:"text"` +type GetTextEntitiesRequest struct { + // The text in which to look for entites + Text string `json:"text"` } // Returns all entities (mentions, hashtags, cashtags, bot commands, URLs, and email addresses) contained in the text. This is an offline method. Can be called before authorization. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalTextEntities(result.Data) + return UnmarshalTextEntities(result.Data) } -type ParseTextEntitiesRequest struct { - // The text which should be parsed - Text string `json:"text"` - // Text parse mode - ParseMode TextParseMode `json:"parse_mode"` +type ParseTextEntitiesRequest struct { + // The text which should be parsed + Text string `json:"text"` + // Text parse mode + ParseMode TextParseMode `json:"parse_mode"` } // Parses Bold, Italic, Code, Pre, PreCode and TextUrl entities contained in the text. This is an offline method. Can be called before authorization. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalFormattedText(result.Data) + return UnmarshalFormattedText(result.Data) } -type GetFileMimeTypeRequest struct { - // The name of the file or path to the file - FileName string `json:"file_name"` +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. This is an offline method. Can be called before authorization. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalText(result.Data) + return UnmarshalText(result.Data) } -type GetFileExtensionRequest struct { - // The MIME type of the file - MimeType string `json:"mime_type"` +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. This is an offline method. Can be called before authorization. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalText(result.Data) + return UnmarshalText(result.Data) } -type CleanFileNameRequest struct { - // File name or path to the file - FileName string `json:"file_name"` +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. This is an offline method. Can be called before authorization. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalText(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"` +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. This is an offline method. Can be called before authorization. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - switch result.Type { - case TypeLanguagePackStringValueOrdinary: - return UnmarshalLanguagePackStringValueOrdinary(result.Data) + switch result.Type { + case TypeLanguagePackStringValueOrdinary: + return UnmarshalLanguagePackStringValueOrdinary(result.Data) - case TypeLanguagePackStringValuePluralized: - return UnmarshalLanguagePackStringValuePluralized(result.Data) + case TypeLanguagePackStringValuePluralized: + return UnmarshalLanguagePackStringValuePluralized(result.Data) - case TypeLanguagePackStringValueDeleted: - return UnmarshalLanguagePackStringValueDeleted(result.Data) + case TypeLanguagePackStringValueDeleted: + return UnmarshalLanguagePackStringValueDeleted(result.Data) - default: - return nil, errors.New("invalid type") - } + default: + return nil, errors.New("invalid type") + } } -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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalInlineQueryResults(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalCallbackQueryAnswer(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetGameScoreRequest struct { - // The chat to which the message with the game - 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"` +type SetGameScoreRequest struct { + // The chat to which the message with the game + 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalMessage(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalGameHighScores(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalGameHighScores(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SendChatActionRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // The action description - Action ChatAction `json:"action"` +type SendChatActionRequest struct { + // Chat identifier + ChatId int64 `json:"chat_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, - "action": req.Action, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "sendChatAction", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "action": req.Action, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type OpenChatRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` +type OpenChatRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` } // This method should be called if 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type CloseChatRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` +type CloseChatRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` } // This method should be called if 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type ViewMessagesRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // The identifiers of the messages being viewed - MessageIds []int64 `json:"message_ids"` - // True, if messages in closed chats should be marked as read - ForceRead bool `json:"force_read"` +type ViewMessagesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // The identifiers of the messages being viewed + MessageIds []int64 `json:"message_ids"` + // True, if messages in closed chats should be marked as read + ForceRead bool `json:"force_read"` } // This method should be called if 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_ids": req.MessageIds, - "force_read": req.ForceRead, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "viewMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_ids": req.MessageIds, + "force_read": req.ForceRead, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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"` } // This method should be called if 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type ReadAllChatMentionsRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChat(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChat(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChat(result.Data) + return UnmarshalChat(result.Data) } -type CreateSecretChatRequest struct { - // Secret chat identifier - SecretChatId int32 `json:"secret_chat_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChat(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-255 characters - Title string `json:"title"` +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-255 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChat(result.Data) + return UnmarshalChat(result.Data) } -type CreateNewSupergroupChatRequest struct { - // Title of the new chat; 1-255 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"` +type CreateNewSupergroupChatRequest struct { + // Title of the new chat; 1-255 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"` } // 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, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "createNewSupergroupChat", + }, + Data: map[string]interface{}{ + "title": req.Title, + "is_channel": req.IsChannel, + "description": req.Description, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChat(result.Data) + return UnmarshalChat(result.Data) } -type CreateNewSecretChatRequest struct { - // Identifier of the target user - UserId int32 `json:"user_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChat(result.Data) + return UnmarshalChat(result.Data) } -type UpgradeBasicGroupChatToSupergroupChatRequest struct { - // Identifier of the chat to upgrade - ChatId int64 `json:"chat_id"` +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. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChat(result.Data) + return UnmarshalChat(result.Data) } -type SetChatTitleRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // New title of the chat; 1-255 characters - Title string `json:"title"` +type SetChatTitleRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New title of the chat; 1-255 characters + Title string `json:"title"` } // Changes the chat title. Supported only for basic groups, supergroups and channels. Requires administrator rights in basic groups and the appropriate administrator rights in supergroups and channels. The title will not be changed until the request to the server has been completed 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetChatPhotoRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // New chat photo. You can use a zero InputFileId to delete the chat photo. Files that are accessible only by HTTP URL are not acceptable - Photo InputFile `json:"photo"` +type SetChatPhotoRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New chat photo. You can use a zero InputFileId to delete the chat photo. Files that are accessible only by HTTP URL are not acceptable + Photo InputFile `json:"photo"` } // Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires administrator rights in basic groups and the appropriate administrator rights in supergroups and channels. The photo will not be changed before request to the server has been completed 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetChatDraftMessageRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // New draft message; may be null - DraftMessage *DraftMessage `json:"draft_message"` +type SetChatDraftMessageRequest struct { + // Chat identifier + ChatId int64 `json:"chat_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, - "draft_message": req.DraftMessage, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatDraftMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "draft_message": req.DraftMessage, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetChatNotificationSettingsRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // New notification settings for the chat - NotificationSettings *ChatNotificationSettings `json:"notification_settings"` +type SetChatNotificationSettingsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New notification settings for the chat + NotificationSettings *ChatNotificationSettings `json:"notification_settings"` } // Changes the notification settings of a chat 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type ToggleChatIsPinnedRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // New value of is_pinned - IsPinned bool `json:"is_pinned"` +type ToggleChatIsPinnedRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of is_pinned + IsPinned bool `json:"is_pinned"` } // Changes the pinned state of a chat. You can pin up to GetOption("pinned_chat_count_max") non-secret chats and the same number of secret chats func (client *Client) ToggleChatIsPinned(req *ToggleChatIsPinnedRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "toggleChatIsPinned", - }, - Data: map[string]interface{}{ - "chat_id": req.ChatId, - "is_pinned": req.IsPinned, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatIsPinned", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_pinned": req.IsPinned, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +type SetChatClientDataRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of client_data + ClientData string `json:"client_data"` } // Changes client 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type JoinChatRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type LeaveChatRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 300. Ignored for supergroups and channels - ForwardLimit int32 `json:"forward_limit"` +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 300. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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; instead, use addChatMember. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetChatMemberRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // User identifier - UserId int32 `json:"user_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChatMember(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChatMembers(result.Data) + return UnmarshalChatMembers(result.Data) } -type GetChatAdministratorsRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` +type GetChatAdministratorsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` } // Returns a list of users who are administrators of the chat func (client *Client) GetChatAdministrators(req *GetChatAdministratorsRequest) (*Users, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getChatAdministrators", - }, - Data: map[string]interface{}{ - "chat_id": req.ChatId, - }, - }) - if err != nil { - return nil, err - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalUsers(result.Data) + return UnmarshalUsers(result.Data) } -type ClearAllDraftMessagesRequest struct { - // If true, local draft messages in secret chats will not be cleared - ExcludeSecretChats bool `json:"exclude_secret_chats"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetScopeNotificationSettingsRequest struct { - // Types of chats for which to return the notification settings information - Scope NotificationSettingsScope `json:"scope"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalScopeNotificationSettings(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetPinnedChatsRequest struct { - // The new list of pinned chats - ChatIds []int64 `json:"chat_ids"` +type SetPinnedChatsRequest struct { + // 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_ids": req.ChatIds, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "setPinnedChats", + }, + Data: map[string]interface{}{ + "chat_ids": req.ChatIds, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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"` } // Asynchronously downloads a file from the cloud. updateFile will be used to notify about the download progress and successful completion of the download. Returns file state just after the download has been started 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, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "downloadFile", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + "priority": req.Priority, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalFile(result.Data) + return UnmarshalFile(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalFile(result.Data) + return UnmarshalFile(result.Data) } -type CancelUploadFileRequest struct { - // Identifier of the file to stop uploading - FileId int32 `json:"file_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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"` } // The next part of a file was generated 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type DeleteFileRequest struct { - // Identifier of the file to delete - FileId int32 `json:"file_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GenerateChatInviteLinkRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` +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. In basic groups this can be called only by the group's creator; in supergroups and channels this requires appropriate administrator rights 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChatInviteLink(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChatInviteLinkInfo(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChat(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 client - Protocol *CallProtocol `json:"protocol"` +type CreateCallRequest struct { + // Identifier of the user to be called + UserId int32 `json:"user_id"` + // Description of the call protocols supported by the client + Protocol *CallProtocol `json:"protocol"` } // 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, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "createCall", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "protocol": req.Protocol, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalCallId(result.Data) + return UnmarshalCallId(result.Data) } -type AcceptCallRequest struct { - // Call identifier - CallId int32 `json:"call_id"` - // Description of the call protocols supported by the client - Protocol *CallProtocol `json:"protocol"` +type AcceptCallRequest struct { + // Call identifier + CallId int32 `json:"call_id"` + // Description of the call protocols supported by the client + 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` - // Identifier of the connection used during the call - ConnectionId JsonInt64 `json:"connection_id"` +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"` + // 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, - "connection_id": req.ConnectionId, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "discardCall", + }, + Data: map[string]interface{}{ + "call_id": req.CallId, + "is_disconnected": req.IsDisconnected, + "duration": req.Duration, + "connection_id": req.ConnectionId, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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"` } // 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, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "sendCallRating", + }, + Data: map[string]interface{}{ + "call_id": req.CallId, + "rating": req.Rating, + "comment": req.Comment, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type BlockUserRequest struct { - // User identifier - UserId int32 `json:"user_id"` +type BlockUserRequest struct { + // User identifier + UserId int32 `json:"user_id"` } // Adds a user to the blacklist func (client *Client) BlockUser(req *BlockUserRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "blockUser", - }, - Data: map[string]interface{}{ - "user_id": req.UserId, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "blockUser", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type UnblockUserRequest struct { - // User identifier - UserId int32 `json:"user_id"` +type UnblockUserRequest struct { + // User identifier + UserId int32 `json:"user_id"` } // Removes a user from the blacklist func (client *Client) UnblockUser(req *UnblockUserRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "unblockUser", - }, - Data: map[string]interface{}{ - "user_id": req.UserId, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "unblockUser", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetBlockedUsersRequest struct { - // Number of users to skip in the result; must be non-negative - Offset int32 `json:"offset"` - // Maximum number of users to return; up to 100 - Limit int32 `json:"limit"` +type GetBlockedUsersRequest struct { + // Number of users to skip in the result; must be non-negative + Offset int32 `json:"offset"` + // Maximum number of users to return; up to 100 + Limit int32 `json:"limit"` } // Returns users that were blocked by the current user func (client *Client) GetBlockedUsers(req *GetBlockedUsersRequest) (*Users, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getBlockedUsers", - }, - Data: map[string]interface{}{ - "offset": req.Offset, - "limit": req.Limit, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "getBlockedUsers", + }, + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalUsers(result.Data) + return UnmarshalUsers(result.Data) } -type ImportContactsRequest struct { - // The list of contacts to import or edit, contact's vCard are ignored and are not imported - Contacts []*Contact `json:"contacts"` +type ImportContactsRequest struct { + // The list of contacts to import or edit, contact's vCard are ignored and are not imported + Contacts []*Contact `json:"contacts"` } // Adds new contacts or edits existing contacts; 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalImportedContacts(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalUsers(result.Data) + return UnmarshalUsers(result.Data) } -type SearchContactsRequest struct { - // Query to search for; can be empty to return all contacts - Query string `json:"query"` - // Maximum number of users to be returned - Limit int32 `json:"limit"` +type SearchContactsRequest struct { + // Query to search for; can be empty to return all contacts + Query string `json:"query"` + // 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalUsers(result.Data) + return UnmarshalUsers(result.Data) } -type RemoveContactsRequest struct { - // Identifiers of users to be deleted - UserIds []int32 `json:"user_ids"` +type RemoveContactsRequest struct { + // Identifiers of users to be deleted + UserIds []int32 `json:"user_ids"` } // Removes users from the contacts 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalCount(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalImportedContacts(result.Data) + return UnmarshalImportedContacts(result.Data) } // Clears all imported contacts, contacts 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` - // Maximum number of photos to be returned; up to 100 - Limit int32 `json:"limit"` +type GetUserProfilePhotosRequest struct { + // User identifier + UserId int32 `json:"user_id"` + // The number of photos to skip; must be non-negative + Offset int32 `json:"offset"` + // 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) (*UserProfilePhotos, 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalUserProfilePhotos(result.Data) + return UnmarshalUserProfilePhotos(result.Data) } -type GetStickersRequest struct { - // String representation of emoji. If empty, returns all known installed stickers - Emoji string `json:"emoji"` - // Maximum number of stickers to be returned - Limit int32 `json:"limit"` +type GetStickersRequest struct { + // String representation of emoji. If empty, returns all known installed stickers + Emoji string `json:"emoji"` + // 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickers(result.Data) + return UnmarshalStickers(result.Data) } -type SearchStickersRequest struct { - // String representation of emoji; must be non-empty - Emoji string `json:"emoji"` - // Maximum number of stickers to be returned - Limit int32 `json:"limit"` +type SearchStickersRequest struct { + // String representation of emoji; must be non-empty + Emoji string `json:"emoji"` + // 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickers(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickerSets(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"` - // Maximum number of sticker sets to return - Limit int32 `json:"limit"` +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"` + // 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickerSets(result.Data) + return UnmarshalStickerSets(result.Data) } // Returns a list of trending sticker sets func (client *Client) GetTrendingStickerSets() (*StickerSets, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getTrendingStickerSets", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "getTrendingStickerSets", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickerSets(result.Data) + return UnmarshalStickerSets(result.Data) } -type GetAttachedStickerSetsRequest struct { - // File identifier - FileId int32 `json:"file_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickerSets(result.Data) + return UnmarshalStickerSets(result.Data) } -type GetStickerSetRequest struct { - // Identifier of the sticker set - SetId JsonInt64 `json:"set_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickerSet(result.Data) + return UnmarshalStickerSet(result.Data) } -type SearchStickerSetRequest struct { - // Name of the sticker set - Name string `json:"name"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickerSet(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"` - // Maximum number of sticker sets to return - Limit int32 `json:"limit"` +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"` + // 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickerSets(result.Data) + return UnmarshalStickerSets(result.Data) } -type SearchStickerSetsRequest struct { - // Query to search for - Query string `json:"query"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickerSets(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type ViewTrendingStickerSetsRequest struct { - // Identifiers of viewed trending sticker sets - StickerSetIds []JsonInt64 `json:"sticker_set_ids"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickers(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickers(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickers(result.Data) + return UnmarshalStickers(result.Data) } -type AddFavoriteStickerRequest struct { - // Sticker file to add - Sticker InputFile `json:"sticker"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type RemoveFavoriteStickerRequest struct { - // Sticker file to delete from the list - Sticker InputFile `json:"sticker"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetStickerEmojisRequest struct { - // Sticker file identifier - Sticker InputFile `json:"sticker"` +type GetStickerEmojisRequest struct { + // Sticker file identifier + Sticker InputFile `json:"sticker"` } // Returns emoji corresponding to a sticker func (client *Client) GetStickerEmojis(req *GetStickerEmojisRequest) (*StickerEmojis, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getStickerEmojis", - }, - Data: map[string]interface{}{ - "sticker": req.Sticker, - }, - }) - if err != nil { - return nil, err - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickerEmojis(result.Data) + return UnmarshalStickerEmojis(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalAnimations(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type RemoveSavedAnimationRequest struct { - // Animation file to be removed - Animation InputFile `json:"animation"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalUsers(result.Data) + return UnmarshalUsers(result.Data) } -type SearchHashtagsRequest struct { - // Hashtag prefix to search for - Prefix string `json:"prefix"` - // Maximum number of hashtags to be returned - Limit int32 `json:"limit"` +type SearchHashtagsRequest struct { + // Hashtag prefix to search for + Prefix string `json:"prefix"` + // 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalHashtags(result.Data) + return UnmarshalHashtags(result.Data) } -type RemoveRecentHashtagRequest struct { - // Hashtag to delete - Hashtag string `json:"hashtag"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetWebPagePreviewRequest struct { - // Message text with formatting - Text *FormattedText `json:"text"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalWebPage(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalWebPageInstantView(result.Data) + return UnmarshalWebPageInstantView(result.Data) } -type SetProfilePhotoRequest struct { - // Profile photo to set. inputFileId and inputFileRemote may still be unsupported - Photo InputFile `json:"photo"` +type SetProfilePhotoRequest struct { + // Profile photo to set. inputFileId and inputFileRemote may still be unsupported + Photo InputFile `json:"photo"` } // Uploads a new profile photo for the current user. If something changes, updateUser will be sent 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type DeleteProfilePhotoRequest struct { - // Identifier of the profile photo to delete - ProfilePhotoId JsonInt64 `json:"profile_photo_id"` +type DeleteProfilePhotoRequest struct { + // Identifier of the profile photo to delete + ProfilePhotoId JsonInt64 `json:"profile_photo_id"` } // Deletes a profile photo. If something changes, updateUser will be sent 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetNameRequest struct { - // The new value of the first name for the user; 1-255 characters - FirstName string `json:"first_name"` - // The new value of the optional last name for the user; 0-255 characters - LastName string `json:"last_name"` +type SetNameRequest struct { + // The new value of the first name for the user; 1-255 characters + FirstName string `json:"first_name"` + // The new value of the optional last name for the user; 0-255 characters + LastName string `json:"last_name"` } // Changes the first and last name of the current user. If something changes, updateUser will be sent 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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. If something changes, updateUser will be sent 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type ChangePhoneNumberRequest struct { - // The new phone number of the user in international format - PhoneNumber string `json:"phone_number"` - // Pass true if the code can be sent via flash call to the specified phone number - AllowFlashCall bool `json:"allow_flash_call"` - // Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false - IsCurrentPhoneNumber bool `json:"is_current_phone_number"` +type ChangePhoneNumberRequest struct { + // The new phone number of the user in international format + PhoneNumber string `json:"phone_number"` + // Pass true if the code can be sent via flash call to the specified phone number + AllowFlashCall bool `json:"allow_flash_call"` + // Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false + IsCurrentPhoneNumber bool `json:"is_current_phone_number"` } // 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, - "allow_flash_call": req.AllowFlashCall, - "is_current_phone_number": req.IsCurrentPhoneNumber, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "changePhoneNumber", + }, + Data: map[string]interface{}{ + "phone_number": req.PhoneNumber, + "allow_flash_call": req.AllowFlashCall, + "is_current_phone_number": req.IsCurrentPhoneNumber, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalAuthenticationCodeInfo(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalAuthenticationCodeInfo(result.Data) + return UnmarshalAuthenticationCodeInfo(result.Data) } -type CheckChangePhoneNumberCodeRequest struct { - // Verification code received by SMS, phone call or flash call - Code string `json:"code"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalSessions(result.Data) + return UnmarshalSessions(result.Data) } -type TerminateSessionRequest struct { - // Session identifier - SessionId JsonInt64 `json:"session_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalConnectedWebsites(result.Data) + return UnmarshalConnectedWebsites(result.Data) } -type DisconnectWebsiteRequest struct { - // Website identifier - WebsiteId JsonInt64 `json:"website_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type ToggleBasicGroupAdministratorsRequest struct { - // Identifier of the basic group - BasicGroupId int32 `json:"basic_group_id"` - // New value of everyone_is_administrator - EveryoneIsAdministrator bool `json:"everyone_is_administrator"` +type ToggleBasicGroupAdministratorsRequest struct { + // Identifier of the basic group + BasicGroupId int32 `json:"basic_group_id"` + // New value of everyone_is_administrator + EveryoneIsAdministrator bool `json:"everyone_is_administrator"` } // Toggles the "All members are admins" setting in basic groups; requires creator privileges in the group func (client *Client) ToggleBasicGroupAdministrators(req *ToggleBasicGroupAdministratorsRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "toggleBasicGroupAdministrators", - }, - Data: map[string]interface{}{ - "basic_group_id": req.BasicGroupId, - "everyone_is_administrator": req.EveryoneIsAdministrator, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleBasicGroupAdministrators", + }, + Data: map[string]interface{}{ + "basic_group_id": req.BasicGroupId, + "everyone_is_administrator": req.EveryoneIsAdministrator, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 creator 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 appropriate rights in the supergroup 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type ToggleSupergroupInvitesRequest struct { - // Identifier of the supergroup - SupergroupId int32 `json:"supergroup_id"` - // New value of anyone_can_invite - AnyoneCanInvite bool `json:"anyone_can_invite"` +type ToggleSupergroupInvitesRequest struct { + // Identifier of the supergroup + SupergroupId int32 `json:"supergroup_id"` + // New value of anyone_can_invite + AnyoneCanInvite bool `json:"anyone_can_invite"` } // Toggles whether all members of a supergroup can add new members; requires appropriate administrator rights in the supergroup. func (client *Client) ToggleSupergroupInvites(req *ToggleSupergroupInvitesRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "toggleSupergroupInvites", - }, - Data: map[string]interface{}{ - "supergroup_id": req.SupergroupId, - "anyone_can_invite": req.AnyoneCanInvite, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSupergroupInvites", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "anyone_can_invite": req.AnyoneCanInvite, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 appropriate administrator rights in the channel. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 appropriate administrator rights in the supergroup. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetSupergroupDescriptionRequest struct { - // Identifier of the supergroup or channel - SupergroupId int32 `json:"supergroup_id"` - // New supergroup or channel description; 0-255 characters - Description string `json:"description"` +type SetSupergroupDescriptionRequest struct { + // Identifier of the supergroup or channel + SupergroupId int32 `json:"supergroup_id"` + // New supergroup or channel description; 0-255 characters + Description string `json:"description"` } // Changes information about a supergroup or channel; requires appropriate administrator rights func (client *Client) SetSupergroupDescription(req *SetSupergroupDescriptionRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "setSupergroupDescription", - }, - Data: map[string]interface{}{ - "supergroup_id": req.SupergroupId, - "description": req.Description, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "setSupergroupDescription", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "description": req.Description, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type PinSupergroupMessageRequest struct { - // Identifier of the supergroup or channel - SupergroupId int32 `json:"supergroup_id"` - // Identifier of the new pinned message - MessageId int64 `json:"message_id"` - // True, if there should be no notification about the pinned message - DisableNotification bool `json:"disable_notification"` +type PinSupergroupMessageRequest struct { + // Identifier of the supergroup or channel + SupergroupId int32 `json:"supergroup_id"` + // Identifier of the new pinned message + MessageId int64 `json:"message_id"` + // True, if there should be no notification about the pinned message + DisableNotification bool `json:"disable_notification"` } // Pins a message in a supergroup or channel; requires appropriate administrator rights in the supergroup or channel func (client *Client) PinSupergroupMessage(req *PinSupergroupMessageRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "pinSupergroupMessage", - }, - Data: map[string]interface{}{ - "supergroup_id": req.SupergroupId, - "message_id": req.MessageId, - "disable_notification": req.DisableNotification, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "pinSupergroupMessage", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "message_id": req.MessageId, + "disable_notification": req.DisableNotification, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type UnpinSupergroupMessageRequest struct { - // Identifier of the supergroup or channel - SupergroupId int32 `json:"supergroup_id"` +type UnpinSupergroupMessageRequest struct { + // Identifier of the supergroup or channel + SupergroupId int32 `json:"supergroup_id"` } // Removes the pinned message from a supergroup or channel; requires appropriate administrator rights in the supergroup or channel func (client *Client) UnpinSupergroupMessage(req *UnpinSupergroupMessageRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "unpinSupergroupMessage", - }, - Data: map[string]interface{}{ - "supergroup_id": req.SupergroupId, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "unpinSupergroupMessage", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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, supergroupMembersRecent - 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"` +type GetSupergroupMembersRequest struct { + // Identifier of the supergroup or channel + SupergroupId int32 `json:"supergroup_id"` + // The type of users to return. By default, supergroupMembersRecent + 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChatMembers(result.Data) + return UnmarshalChatMembers(result.Data) } -type DeleteSupergroupRequest struct { - // Identifier of the supergroup or channel - SupergroupId int32 `json:"supergroup_id"` +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 creator 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type CloseSecretChatRequest struct { - // Secret chat identifier - SecretChatId int32 `json:"secret_chat_id"` +type CloseSecretChatRequest struct { + // Secret chat identifier + SecretChatId int32 `json:"secret_chat_id"` } // Closes a secret chat, effectively transfering 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` - // 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"` +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"` + // 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 in 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChatEvents(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalPaymentForm(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalValidatedOrderInfo(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalPaymentResult(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalPaymentReceipt(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOrderInfo(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalUser(result.Data) + return UnmarshalUser(result.Data) } // Returns background wallpapers func (client *Client) GetWallpapers() (*Wallpapers, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getWallpapers", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "getWallpapers", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalWallpapers(result.Data) + return UnmarshalWallpapers(result.Data) } -type GetLocalizationTargetInfoRequest struct { - // If true, returns only locally available information without sending network requests - OnlyLocal bool `json:"only_local"` +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 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalLocalizationTargetInfo(result.Data) + return UnmarshalLocalizationTargetInfo(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"` +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 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalLanguagePackStrings(result.Data) + return UnmarshalLanguagePackStrings(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 - Info *LanguagePackInfo `json:"info"` - // Strings of the new language pack - Strings []*LanguagePackString `json:"strings"` +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 + Info *LanguagePackInfo `json:"info"` + // Strings of the new language pack + Strings []*LanguagePackString `json:"strings"` } // Adds or changes a custom 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type EditCustomLanguagePackInfoRequest struct { - // New information about the custom language pack - Info *LanguagePackInfo `json:"info"` +type EditCustomLanguagePackInfoRequest struct { + // New information about the custom language pack + Info *LanguagePackInfo `json:"info"` } // Edits information about a custom language pack in the current localization target 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetCustomLanguagePackStringRequest struct { - // Identifier of a previously added custom language pack in the current localization target - LanguagePackId string `json:"language_pack_id"` - // New language pack string - NewString *LanguagePackString `json:"new_string"` +type SetCustomLanguagePackStringRequest struct { + // Identifier of a previously added custom 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 language pack 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type DeleteLanguagePackRequest struct { - // Identifier of the language pack to delete - LanguagePackId string `json:"language_pack_id"` +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 that is currently in use can't be deleted 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type RegisterDeviceRequest struct { - // Device token - DeviceToken DeviceToken `json:"device_token"` - // List of at most 100 user identifiers of other users currently using the client - OtherUserIds []int32 `json:"other_user_ids"` +type RegisterDeviceRequest struct { + // Device token + DeviceToken DeviceToken `json:"device_token"` + // List of at most 100 user identifiers of other users currently using the client + OtherUserIds []int32 `json:"other_user_ids"` } // Registers the currently used device for receiving push notifications func (client *Client) RegisterDevice(req *RegisterDeviceRequest) (*Ok, 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetRecentlyVisitedTMeUrlsRequest struct { - // Google Play referrer to identify the user - Referrer string `json:"referrer"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalTMeUrls(result.Data) + return UnmarshalTMeUrls(result.Data) } -type SetUserPrivacySettingRulesRequest struct { - // The privacy setting - Setting UserPrivacySetting `json:"setting"` - // The new privacy rules - Rules *UserPrivacySettingRules `json:"rules"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetUserPrivacySettingRulesRequest struct { - // The privacy setting - Setting UserPrivacySetting `json:"setting"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalUserPrivacySettingRules(result.Data) + return UnmarshalUserPrivacySettingRules(result.Data) } -type GetOptionRequest struct { - // The name of the option - Name string `json:"name"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - switch result.Type { - case TypeOptionValueBoolean: - return UnmarshalOptionValueBoolean(result.Data) + switch result.Type { + case TypeOptionValueBoolean: + return UnmarshalOptionValueBoolean(result.Data) - case TypeOptionValueEmpty: - return UnmarshalOptionValueEmpty(result.Data) + case TypeOptionValueEmpty: + return UnmarshalOptionValueEmpty(result.Data) - case TypeOptionValueInteger: - return UnmarshalOptionValueInteger(result.Data) + case TypeOptionValueInteger: + return UnmarshalOptionValueInteger(result.Data) - case TypeOptionValueString: - return UnmarshalOptionValueString(result.Data) + case TypeOptionValueString: + return UnmarshalOptionValueString(result.Data) - default: - return nil, errors.New("invalid type") - } + 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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetAccountTtlRequest struct { - // New account TTL - Ttl *AccountTtl `json:"ttl"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalAccountTtl(result.Data) + return UnmarshalAccountTtl(result.Data) } -type DeleteAccountRequest struct { - // The reason why the account was deleted; optional - Reason string `json:"reason"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetChatReportSpamStateRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` +type GetChatReportSpamStateRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` } // Returns information on whether the current chat can be reported as spam func (client *Client) GetChatReportSpamState(req *GetChatReportSpamStateRequest) (*ChatReportSpamState, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getChatReportSpamState", - }, - Data: map[string]interface{}{ - "chat_id": req.ChatId, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatReportSpamState", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalChatReportSpamState(result.Data) + return UnmarshalChatReportSpamState(result.Data) } -type ChangeChatReportSpamStateRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // If true, the chat will be reported as spam; otherwise it will be marked as not spam - IsSpamChat bool `json:"is_spam_chat"` +type ChangeChatReportSpamStateRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // If true, the chat will be reported as spam; otherwise it will be marked as not spam + IsSpamChat bool `json:"is_spam_chat"` } // Used to let the server know whether a chat is spam or not. Can be used only if ChatReportSpamState.can_report_spam is true. After this request, ChatReportSpamState.can_report_spam becomes false forever func (client *Client) ChangeChatReportSpamState(req *ChangeChatReportSpamStateRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "changeChatReportSpamState", - }, - Data: map[string]interface{}{ - "chat_id": req.ChatId, - "is_spam_chat": req.IsSpamChat, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "changeChatReportSpamState", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_spam_chat": req.IsSpamChat, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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. Supported only for supergroups, channels, or private chats with bots, 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetStorageStatisticsRequest struct { - // 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"` +type GetStorageStatisticsRequest struct { + // 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 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStorageStatistics(result.Data) + return UnmarshalStorageStatistics(result.Data) } // Quickly returns approximate storage usage statistics 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStorageStatisticsFast(result.Data) + return UnmarshalStorageStatisticsFast(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"` - // Same as in getStorageStatistics. Affects only returned statistics - ChatLimit int32 `json:"chat_limit"` +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"` + // 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, - "chat_limit": req.ChatLimit, - }, - }) - if err != nil { - return nil, err - } + 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, + "chat_limit": req.ChatLimit, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStorageStatistics(result.Data) + return UnmarshalStorageStatistics(result.Data) } -type SetNetworkTypeRequest struct { - // The new network type. By default, networkTypeOther - Type NetworkType `json:"type"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetNetworkStatisticsRequest struct { - // If true, returns only data for the current library launch - OnlyCurrent bool `json:"only_current"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalNetworkStatistics(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetPassportElementRequest struct { - // Telegram Passport element type - Type PassportElementType `json:"type"` - // Password of the current user - Password string `json:"password"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - switch result.Type { - case TypePassportElementPersonalDetails: - return UnmarshalPassportElementPersonalDetails(result.Data) + switch result.Type { + case TypePassportElementPersonalDetails: + return UnmarshalPassportElementPersonalDetails(result.Data) - case TypePassportElementPassport: - return UnmarshalPassportElementPassport(result.Data) + case TypePassportElementPassport: + return UnmarshalPassportElementPassport(result.Data) - case TypePassportElementDriverLicense: - return UnmarshalPassportElementDriverLicense(result.Data) + case TypePassportElementDriverLicense: + return UnmarshalPassportElementDriverLicense(result.Data) - case TypePassportElementIdentityCard: - return UnmarshalPassportElementIdentityCard(result.Data) + case TypePassportElementIdentityCard: + return UnmarshalPassportElementIdentityCard(result.Data) - case TypePassportElementInternalPassport: - return UnmarshalPassportElementInternalPassport(result.Data) + case TypePassportElementInternalPassport: + return UnmarshalPassportElementInternalPassport(result.Data) - case TypePassportElementAddress: - return UnmarshalPassportElementAddress(result.Data) + case TypePassportElementAddress: + return UnmarshalPassportElementAddress(result.Data) - case TypePassportElementUtilityBill: - return UnmarshalPassportElementUtilityBill(result.Data) + case TypePassportElementUtilityBill: + return UnmarshalPassportElementUtilityBill(result.Data) - case TypePassportElementBankStatement: - return UnmarshalPassportElementBankStatement(result.Data) + case TypePassportElementBankStatement: + return UnmarshalPassportElementBankStatement(result.Data) - case TypePassportElementRentalAgreement: - return UnmarshalPassportElementRentalAgreement(result.Data) + case TypePassportElementRentalAgreement: + return UnmarshalPassportElementRentalAgreement(result.Data) - case TypePassportElementPassportRegistration: - return UnmarshalPassportElementPassportRegistration(result.Data) + case TypePassportElementPassportRegistration: + return UnmarshalPassportElementPassportRegistration(result.Data) - case TypePassportElementTemporaryRegistration: - return UnmarshalPassportElementTemporaryRegistration(result.Data) + case TypePassportElementTemporaryRegistration: + return UnmarshalPassportElementTemporaryRegistration(result.Data) - case TypePassportElementPhoneNumber: - return UnmarshalPassportElementPhoneNumber(result.Data) + case TypePassportElementPhoneNumber: + return UnmarshalPassportElementPhoneNumber(result.Data) - case TypePassportElementEmailAddress: - return UnmarshalPassportElementEmailAddress(result.Data) + case TypePassportElementEmailAddress: + return UnmarshalPassportElementEmailAddress(result.Data) - default: - return nil, errors.New("invalid type") - } + default: + return nil, errors.New("invalid type") + } } -type GetAllPassportElementsRequest struct { - // Password of the current user - Password string `json:"password"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalPassportElements(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - switch result.Type { - case TypePassportElementPersonalDetails: - return UnmarshalPassportElementPersonalDetails(result.Data) + switch result.Type { + case TypePassportElementPersonalDetails: + return UnmarshalPassportElementPersonalDetails(result.Data) - case TypePassportElementPassport: - return UnmarshalPassportElementPassport(result.Data) + case TypePassportElementPassport: + return UnmarshalPassportElementPassport(result.Data) - case TypePassportElementDriverLicense: - return UnmarshalPassportElementDriverLicense(result.Data) + case TypePassportElementDriverLicense: + return UnmarshalPassportElementDriverLicense(result.Data) - case TypePassportElementIdentityCard: - return UnmarshalPassportElementIdentityCard(result.Data) + case TypePassportElementIdentityCard: + return UnmarshalPassportElementIdentityCard(result.Data) - case TypePassportElementInternalPassport: - return UnmarshalPassportElementInternalPassport(result.Data) + case TypePassportElementInternalPassport: + return UnmarshalPassportElementInternalPassport(result.Data) - case TypePassportElementAddress: - return UnmarshalPassportElementAddress(result.Data) + case TypePassportElementAddress: + return UnmarshalPassportElementAddress(result.Data) - case TypePassportElementUtilityBill: - return UnmarshalPassportElementUtilityBill(result.Data) + case TypePassportElementUtilityBill: + return UnmarshalPassportElementUtilityBill(result.Data) - case TypePassportElementBankStatement: - return UnmarshalPassportElementBankStatement(result.Data) + case TypePassportElementBankStatement: + return UnmarshalPassportElementBankStatement(result.Data) - case TypePassportElementRentalAgreement: - return UnmarshalPassportElementRentalAgreement(result.Data) + case TypePassportElementRentalAgreement: + return UnmarshalPassportElementRentalAgreement(result.Data) - case TypePassportElementPassportRegistration: - return UnmarshalPassportElementPassportRegistration(result.Data) + case TypePassportElementPassportRegistration: + return UnmarshalPassportElementPassportRegistration(result.Data) - case TypePassportElementTemporaryRegistration: - return UnmarshalPassportElementTemporaryRegistration(result.Data) + case TypePassportElementTemporaryRegistration: + return UnmarshalPassportElementTemporaryRegistration(result.Data) - case TypePassportElementPhoneNumber: - return UnmarshalPassportElementPhoneNumber(result.Data) + case TypePassportElementPhoneNumber: + return UnmarshalPassportElementPhoneNumber(result.Data) - case TypePassportElementEmailAddress: - return UnmarshalPassportElementEmailAddress(result.Data) + case TypePassportElementEmailAddress: + return UnmarshalPassportElementEmailAddress(result.Data) - default: - return nil, errors.New("invalid type") - } + default: + return nil, errors.New("invalid type") + } } -type DeletePassportElementRequest struct { - // Element type - Type PassportElementType `json:"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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetPassportElementErrorsRequest struct { - // User identifier - UserId int32 `json:"user_id"` - // The errors - Errors []*InputPassportElementError `json:"errors"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type GetPreferredCountryLanguageRequest struct { - // A two-letter ISO 3166-1 alpha-2 country code - CountryCode string `json:"country_code"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalText(result.Data) + return UnmarshalText(result.Data) } -type SendPhoneNumberVerificationCodeRequest struct { - // The phone number of the user, in international format - PhoneNumber string `json:"phone_number"` - // 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 phone number is used on the current device. Ignored if allow_flash_call is false - IsCurrentPhoneNumber bool `json:"is_current_phone_number"` +type SendPhoneNumberVerificationCodeRequest struct { + // The phone number of the user, in international format + PhoneNumber string `json:"phone_number"` + // 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 phone number is used on the current device. Ignored if allow_flash_call is false + IsCurrentPhoneNumber bool `json:"is_current_phone_number"` } // 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, - "allow_flash_call": req.AllowFlashCall, - "is_current_phone_number": req.IsCurrentPhoneNumber, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "sendPhoneNumberVerificationCode", + }, + Data: map[string]interface{}{ + "phone_number": req.PhoneNumber, + "allow_flash_call": req.AllowFlashCall, + "is_current_phone_number": req.IsCurrentPhoneNumber, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalAuthenticationCodeInfo(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalAuthenticationCodeInfo(result.Data) + return UnmarshalAuthenticationCodeInfo(result.Data) } -type CheckPhoneNumberVerificationCodeRequest struct { - // Verification code - Code string `json:"code"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SendEmailAddressVerificationCodeRequest struct { - // Email address - EmailAddress string `json:"email_address"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalEmailAddressAuthenticationCodeInfo(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalEmailAddressAuthenticationCodeInfo(result.Data) + return UnmarshalEmailAddressAuthenticationCodeInfo(result.Data) } -type CheckEmailAddressVerificationCodeRequest struct { - // Verification code - Code string `json:"code"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` - // Password of the current user - Password string `json:"password"` +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"` + // Password of the current user + Password string `json:"password"` } // 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, - "password": req.Password, - }, - }) - if err != nil { - return nil, err - } + 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, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalPassportAuthorizationForm(result.Data) + return UnmarshalPassportAuthorizationForm(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"` +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 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` - // 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 phone number is used on the current device. Ignored if allow_flash_call is false - IsCurrentPhoneNumber bool `json:"is_current_phone_number"` +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"` + // 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 phone number is used on the current device. Ignored if allow_flash_call is false + IsCurrentPhoneNumber bool `json:"is_current_phone_number"` } // 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, - "allow_flash_call": req.AllowFlashCall, - "is_current_phone_number": req.IsCurrentPhoneNumber, - }, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "sendPhoneNumberConfirmationCode", + }, + Data: map[string]interface{}{ + "hash": req.Hash, + "phone_number": req.PhoneNumber, + "allow_flash_call": req.AllowFlashCall, + "is_current_phone_number": req.IsCurrentPhoneNumber, + }, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalAuthenticationCodeInfo(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalAuthenticationCodeInfo(result.Data) + return UnmarshalAuthenticationCodeInfo(result.Data) } -type CheckPhoneNumberConfirmationCodeRequest struct { - // The phone number confirmation code - Code string `json:"code"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalFile(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 - IsMasks bool `json:"is_masks"` - // List of stickers to be added to the set - Stickers []*InputSticker `json:"stickers"` +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 + IsMasks bool `json:"is_masks"` + // List of stickers to be added to the set + 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickerSet(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalStickerSet(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type RemoveStickerFromSetRequest struct { - // Sticker - Sticker InputFile `json:"sticker"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalFile(result.Data) + return UnmarshalFile(result.Data) } -type AcceptTermsOfServiceRequest struct { - // Terms of service identifier - TermsOfServiceId string `json:"terms_of_service_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SendCustomRequestRequest struct { - // The method name - Method string `json:"method"` - // JSON-serialized method parameters - Parameters string `json:"parameters"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalCustomRequestResult(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type SetAlarmRequest struct { - // Number of seconds before the function returns - Seconds float64 `json:"seconds"` +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 authorization. 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } // Uses current user IP to found his 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalText(result.Data) + return UnmarshalText(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalText(result.Data) + return UnmarshalText(result.Data) } -type GetDeepLinkInfoRequest struct { - // The link - Link string `json:"link"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalDeepLinkInfo(result.Data) + return UnmarshalDeepLinkInfo(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalProxy(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalProxy(result.Data) + return UnmarshalProxy(result.Data) } -type EnableProxyRequest struct { - // Proxy identifier - ProxyId int32 `json:"proxy_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type RemoveProxyRequest struct { - // Proxy identifier - ProxyId int32 `json:"proxy_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalProxies(result.Data) + return UnmarshalProxies(result.Data) } -type GetProxyLinkRequest struct { - // Proxy identifier - ProxyId int32 `json:"proxy_id"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalText(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"` +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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalSeconds(result.Data) + return UnmarshalSeconds(result.Data) } // Does nothing; for testing only 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } -type TestCallStringRequest struct { - // String to return - X string `json:"x"` +type TestCallStringRequest struct { + // String to return + X string `json:"x"` } // Returns the received string; for testing only 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalTestString(result.Data) + return UnmarshalTestString(result.Data) } -type TestCallBytesRequest struct { - // Bytes to return - X []byte `json:"x"` +type TestCallBytesRequest struct { + // Bytes to return + X []byte `json:"x"` } // Returns the received bytes; for testing only 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalTestBytes(result.Data) + return UnmarshalTestBytes(result.Data) } -type TestCallVectorIntRequest struct { - // Vector of numbers to return - X []int32 `json:"x"` +type TestCallVectorIntRequest struct { + // Vector of numbers to return + X []int32 `json:"x"` } // Returns the received vector of numbers; for testing only 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalTestVectorInt(result.Data) + return UnmarshalTestVectorInt(result.Data) } -type TestCallVectorIntObjectRequest struct { - // Vector of objects to return - X []*TestInt `json:"x"` +type TestCallVectorIntObjectRequest struct { + // Vector of objects to return + X []*TestInt `json:"x"` } // Returns the received vector of objects containing a number; for testing only 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalTestVectorIntObject(result.Data) + return UnmarshalTestVectorIntObject(result.Data) } -type TestCallVectorStringRequest struct { - // Vector of strings to return - X []string `json:"x"` +type TestCallVectorStringRequest struct { + // Vector of strings to return + X []string `json:"x"` } // For testing only request. Returns the received vector of strings; for testing only 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalTestVectorString(result.Data) + return UnmarshalTestVectorString(result.Data) } -type TestCallVectorStringObjectRequest struct { - // Vector of objects to return - X []*TestString `json:"x"` +type TestCallVectorStringObjectRequest struct { + // Vector of objects to return + X []*TestString `json:"x"` } // Returns the received vector of objects containing a string; for testing only 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalTestVectorStringObject(result.Data) + return UnmarshalTestVectorStringObject(result.Data) } -type TestSquareIntRequest struct { - // Number to square - X int32 `json:"x"` +type TestSquareIntRequest struct { + // Number to square + X int32 `json:"x"` } // Returns the squared received number; for testing only 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalTestInt(result.Data) + return UnmarshalTestInt(result.Data) } // Sends a simple network request to the Telegram servers; for testing only 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalOk(result.Data) + return UnmarshalOk(result.Data) } // Does nothing and ensures that the Update object is used; for testing only 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 - } + 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) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - switch result.Type { - case TypeUpdateAuthorizationState: - return UnmarshalUpdateAuthorizationState(result.Data) + switch result.Type { + case TypeUpdateAuthorizationState: + return UnmarshalUpdateAuthorizationState(result.Data) - case TypeUpdateNewMessage: - return UnmarshalUpdateNewMessage(result.Data) + case TypeUpdateNewMessage: + return UnmarshalUpdateNewMessage(result.Data) - case TypeUpdateMessageSendAcknowledged: - return UnmarshalUpdateMessageSendAcknowledged(result.Data) + case TypeUpdateMessageSendAcknowledged: + return UnmarshalUpdateMessageSendAcknowledged(result.Data) - case TypeUpdateMessageSendSucceeded: - return UnmarshalUpdateMessageSendSucceeded(result.Data) + case TypeUpdateMessageSendSucceeded: + return UnmarshalUpdateMessageSendSucceeded(result.Data) - case TypeUpdateMessageSendFailed: - return UnmarshalUpdateMessageSendFailed(result.Data) + case TypeUpdateMessageSendFailed: + return UnmarshalUpdateMessageSendFailed(result.Data) - case TypeUpdateMessageContent: - return UnmarshalUpdateMessageContent(result.Data) + case TypeUpdateMessageContent: + return UnmarshalUpdateMessageContent(result.Data) - case TypeUpdateMessageEdited: - return UnmarshalUpdateMessageEdited(result.Data) + case TypeUpdateMessageEdited: + return UnmarshalUpdateMessageEdited(result.Data) - case TypeUpdateMessageViews: - return UnmarshalUpdateMessageViews(result.Data) + case TypeUpdateMessageViews: + return UnmarshalUpdateMessageViews(result.Data) - case TypeUpdateMessageContentOpened: - return UnmarshalUpdateMessageContentOpened(result.Data) + case TypeUpdateMessageContentOpened: + return UnmarshalUpdateMessageContentOpened(result.Data) - case TypeUpdateMessageMentionRead: - return UnmarshalUpdateMessageMentionRead(result.Data) + case TypeUpdateMessageMentionRead: + return UnmarshalUpdateMessageMentionRead(result.Data) - case TypeUpdateNewChat: - return UnmarshalUpdateNewChat(result.Data) + case TypeUpdateNewChat: + return UnmarshalUpdateNewChat(result.Data) - case TypeUpdateChatTitle: - return UnmarshalUpdateChatTitle(result.Data) + case TypeUpdateChatTitle: + return UnmarshalUpdateChatTitle(result.Data) - case TypeUpdateChatPhoto: - return UnmarshalUpdateChatPhoto(result.Data) + case TypeUpdateChatPhoto: + return UnmarshalUpdateChatPhoto(result.Data) - case TypeUpdateChatLastMessage: - return UnmarshalUpdateChatLastMessage(result.Data) + case TypeUpdateChatLastMessage: + return UnmarshalUpdateChatLastMessage(result.Data) - case TypeUpdateChatOrder: - return UnmarshalUpdateChatOrder(result.Data) + case TypeUpdateChatOrder: + return UnmarshalUpdateChatOrder(result.Data) - case TypeUpdateChatIsPinned: - return UnmarshalUpdateChatIsPinned(result.Data) + case TypeUpdateChatIsPinned: + return UnmarshalUpdateChatIsPinned(result.Data) - case TypeUpdateChatIsMarkedAsUnread: - return UnmarshalUpdateChatIsMarkedAsUnread(result.Data) + case TypeUpdateChatIsMarkedAsUnread: + return UnmarshalUpdateChatIsMarkedAsUnread(result.Data) - case TypeUpdateChatIsSponsored: - return UnmarshalUpdateChatIsSponsored(result.Data) + case TypeUpdateChatIsSponsored: + return UnmarshalUpdateChatIsSponsored(result.Data) - case TypeUpdateChatDefaultDisableNotification: - return UnmarshalUpdateChatDefaultDisableNotification(result.Data) + case TypeUpdateChatDefaultDisableNotification: + return UnmarshalUpdateChatDefaultDisableNotification(result.Data) - case TypeUpdateChatReadInbox: - return UnmarshalUpdateChatReadInbox(result.Data) + case TypeUpdateChatReadInbox: + return UnmarshalUpdateChatReadInbox(result.Data) - case TypeUpdateChatReadOutbox: - return UnmarshalUpdateChatReadOutbox(result.Data) + case TypeUpdateChatReadOutbox: + return UnmarshalUpdateChatReadOutbox(result.Data) - case TypeUpdateChatUnreadMentionCount: - return UnmarshalUpdateChatUnreadMentionCount(result.Data) + case TypeUpdateChatUnreadMentionCount: + return UnmarshalUpdateChatUnreadMentionCount(result.Data) - case TypeUpdateChatNotificationSettings: - return UnmarshalUpdateChatNotificationSettings(result.Data) + case TypeUpdateChatNotificationSettings: + return UnmarshalUpdateChatNotificationSettings(result.Data) - case TypeUpdateScopeNotificationSettings: - return UnmarshalUpdateScopeNotificationSettings(result.Data) + case TypeUpdateScopeNotificationSettings: + return UnmarshalUpdateScopeNotificationSettings(result.Data) - case TypeUpdateChatReplyMarkup: - return UnmarshalUpdateChatReplyMarkup(result.Data) + case TypeUpdateChatReplyMarkup: + return UnmarshalUpdateChatReplyMarkup(result.Data) - case TypeUpdateChatDraftMessage: - return UnmarshalUpdateChatDraftMessage(result.Data) + case TypeUpdateChatDraftMessage: + return UnmarshalUpdateChatDraftMessage(result.Data) - case TypeUpdateDeleteMessages: - return UnmarshalUpdateDeleteMessages(result.Data) + case TypeUpdateDeleteMessages: + return UnmarshalUpdateDeleteMessages(result.Data) - case TypeUpdateUserChatAction: - return UnmarshalUpdateUserChatAction(result.Data) + case TypeUpdateUserChatAction: + return UnmarshalUpdateUserChatAction(result.Data) - case TypeUpdateUserStatus: - return UnmarshalUpdateUserStatus(result.Data) + case TypeUpdateUserStatus: + return UnmarshalUpdateUserStatus(result.Data) - case TypeUpdateUser: - return UnmarshalUpdateUser(result.Data) + case TypeUpdateUser: + return UnmarshalUpdateUser(result.Data) - case TypeUpdateBasicGroup: - return UnmarshalUpdateBasicGroup(result.Data) + case TypeUpdateBasicGroup: + return UnmarshalUpdateBasicGroup(result.Data) - case TypeUpdateSupergroup: - return UnmarshalUpdateSupergroup(result.Data) + case TypeUpdateSupergroup: + return UnmarshalUpdateSupergroup(result.Data) - case TypeUpdateSecretChat: - return UnmarshalUpdateSecretChat(result.Data) + case TypeUpdateSecretChat: + return UnmarshalUpdateSecretChat(result.Data) - case TypeUpdateUserFullInfo: - return UnmarshalUpdateUserFullInfo(result.Data) + case TypeUpdateUserFullInfo: + return UnmarshalUpdateUserFullInfo(result.Data) - case TypeUpdateBasicGroupFullInfo: - return UnmarshalUpdateBasicGroupFullInfo(result.Data) + case TypeUpdateBasicGroupFullInfo: + return UnmarshalUpdateBasicGroupFullInfo(result.Data) - case TypeUpdateSupergroupFullInfo: - return UnmarshalUpdateSupergroupFullInfo(result.Data) + case TypeUpdateSupergroupFullInfo: + return UnmarshalUpdateSupergroupFullInfo(result.Data) - case TypeUpdateServiceNotification: - return UnmarshalUpdateServiceNotification(result.Data) + case TypeUpdateServiceNotification: + return UnmarshalUpdateServiceNotification(result.Data) - case TypeUpdateFile: - return UnmarshalUpdateFile(result.Data) + case TypeUpdateFile: + return UnmarshalUpdateFile(result.Data) - case TypeUpdateFileGenerationStart: - return UnmarshalUpdateFileGenerationStart(result.Data) + case TypeUpdateFileGenerationStart: + return UnmarshalUpdateFileGenerationStart(result.Data) - case TypeUpdateFileGenerationStop: - return UnmarshalUpdateFileGenerationStop(result.Data) + case TypeUpdateFileGenerationStop: + return UnmarshalUpdateFileGenerationStop(result.Data) - case TypeUpdateCall: - return UnmarshalUpdateCall(result.Data) + case TypeUpdateCall: + return UnmarshalUpdateCall(result.Data) - case TypeUpdateUserPrivacySettingRules: - return UnmarshalUpdateUserPrivacySettingRules(result.Data) + case TypeUpdateUserPrivacySettingRules: + return UnmarshalUpdateUserPrivacySettingRules(result.Data) - case TypeUpdateUnreadMessageCount: - return UnmarshalUpdateUnreadMessageCount(result.Data) + case TypeUpdateUnreadMessageCount: + return UnmarshalUpdateUnreadMessageCount(result.Data) - case TypeUpdateUnreadChatCount: - return UnmarshalUpdateUnreadChatCount(result.Data) + case TypeUpdateUnreadChatCount: + return UnmarshalUpdateUnreadChatCount(result.Data) - case TypeUpdateOption: - return UnmarshalUpdateOption(result.Data) + case TypeUpdateOption: + return UnmarshalUpdateOption(result.Data) - case TypeUpdateInstalledStickerSets: - return UnmarshalUpdateInstalledStickerSets(result.Data) + case TypeUpdateInstalledStickerSets: + return UnmarshalUpdateInstalledStickerSets(result.Data) - case TypeUpdateTrendingStickerSets: - return UnmarshalUpdateTrendingStickerSets(result.Data) + case TypeUpdateTrendingStickerSets: + return UnmarshalUpdateTrendingStickerSets(result.Data) - case TypeUpdateRecentStickers: - return UnmarshalUpdateRecentStickers(result.Data) + case TypeUpdateRecentStickers: + return UnmarshalUpdateRecentStickers(result.Data) - case TypeUpdateFavoriteStickers: - return UnmarshalUpdateFavoriteStickers(result.Data) + case TypeUpdateFavoriteStickers: + return UnmarshalUpdateFavoriteStickers(result.Data) - case TypeUpdateSavedAnimations: - return UnmarshalUpdateSavedAnimations(result.Data) + case TypeUpdateSavedAnimations: + return UnmarshalUpdateSavedAnimations(result.Data) - case TypeUpdateLanguagePackStrings: - return UnmarshalUpdateLanguagePackStrings(result.Data) + case TypeUpdateLanguagePackStrings: + return UnmarshalUpdateLanguagePackStrings(result.Data) - case TypeUpdateConnectionState: - return UnmarshalUpdateConnectionState(result.Data) + case TypeUpdateConnectionState: + return UnmarshalUpdateConnectionState(result.Data) - case TypeUpdateTermsOfService: - return UnmarshalUpdateTermsOfService(result.Data) + case TypeUpdateTermsOfService: + return UnmarshalUpdateTermsOfService(result.Data) - case TypeUpdateNewInlineQuery: - return UnmarshalUpdateNewInlineQuery(result.Data) + case TypeUpdateNewInlineQuery: + return UnmarshalUpdateNewInlineQuery(result.Data) - case TypeUpdateNewChosenInlineResult: - return UnmarshalUpdateNewChosenInlineResult(result.Data) + case TypeUpdateNewChosenInlineResult: + return UnmarshalUpdateNewChosenInlineResult(result.Data) - case TypeUpdateNewCallbackQuery: - return UnmarshalUpdateNewCallbackQuery(result.Data) + case TypeUpdateNewCallbackQuery: + return UnmarshalUpdateNewCallbackQuery(result.Data) - case TypeUpdateNewInlineCallbackQuery: - return UnmarshalUpdateNewInlineCallbackQuery(result.Data) + case TypeUpdateNewInlineCallbackQuery: + return UnmarshalUpdateNewInlineCallbackQuery(result.Data) - case TypeUpdateNewShippingQuery: - return UnmarshalUpdateNewShippingQuery(result.Data) + case TypeUpdateNewShippingQuery: + return UnmarshalUpdateNewShippingQuery(result.Data) - case TypeUpdateNewPreCheckoutQuery: - return UnmarshalUpdateNewPreCheckoutQuery(result.Data) + case TypeUpdateNewPreCheckoutQuery: + return UnmarshalUpdateNewPreCheckoutQuery(result.Data) - case TypeUpdateNewCustomEvent: - return UnmarshalUpdateNewCustomEvent(result.Data) + case TypeUpdateNewCustomEvent: + return UnmarshalUpdateNewCustomEvent(result.Data) - case TypeUpdateNewCustomQuery: - return UnmarshalUpdateNewCustomQuery(result.Data) + case TypeUpdateNewCustomQuery: + return UnmarshalUpdateNewCustomQuery(result.Data) - default: - return nil, errors.New("invalid type") - } + default: + return nil, errors.New("invalid type") + } } // Does nothing and ensures that the Error object is used; for testing only func (client *Client) TestUseError() (*Error, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "testUseError", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } + result, err := client.Send(Request{ + meta: meta{ + Type: "testUseError", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } - return UnmarshalError(result.Data) + return UnmarshalError(result.Data) } diff --git a/client/listener.go b/client/listener.go index c57b4ea..30c122e 100644 --- a/client/listener.go +++ b/client/listener.go @@ -1,66 +1,66 @@ package client import ( - "sync" + "sync" ) func newListenerStore() *listenerStore { - return &listenerStore{ - listeners: []*Listener{}, - } + return &listenerStore{ + listeners: []*Listener{}, + } } type listenerStore struct { - sync.Mutex - listeners []*Listener + sync.Mutex + listeners []*Listener } func (store *listenerStore) Add(listener *Listener) { - store.Lock() - defer store.Unlock() + store.Lock() + defer store.Unlock() - store.listeners = append(store.listeners, listener) + store.listeners = append(store.listeners, listener) } func (store *listenerStore) Listeners() []*Listener { - store.Lock() - defer store.Unlock() + store.Lock() + defer store.Unlock() - return store.listeners + return store.listeners } func (store *listenerStore) gc() { - store.Lock() - defer store.Unlock() + store.Lock() + defer store.Unlock() - oldListeners := store.listeners + oldListeners := store.listeners - store.listeners = []*Listener{} + store.listeners = []*Listener{} - for _, listener := range oldListeners { - if listener.IsActive() { - store.listeners = append(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 + mu sync.Mutex + isActive bool + Updates chan Type } func (listener *Listener) Close() { - listener.mu.Lock() - defer listener.mu.Unlock() + listener.mu.Lock() + defer listener.mu.Unlock() - listener.isActive = false - close(listener.Updates) + listener.isActive = false + close(listener.Updates) } func (listener *Listener) IsActive() bool { - listener.mu.Lock() - defer listener.mu.Unlock() + listener.mu.Lock() + defer listener.mu.Unlock() - return listener.isActive + return listener.isActive } diff --git a/client/tdlib.go b/client/tdlib.go index 0e54764..4a5f616 100644 --- a/client/tdlib.go +++ b/client/tdlib.go @@ -8,32 +8,32 @@ package client import "C" import ( - "encoding/json" - "errors" - "fmt" - "strconv" - "time" - "unsafe" + "encoding/json" + "errors" + "fmt" + "strconv" + "time" + "unsafe" ) type JsonClient struct { - jsonClient unsafe.Pointer + jsonClient unsafe.Pointer } func NewJsonClient() *JsonClient { - return &JsonClient{ - jsonClient: C.td_json_client_create(), - } + 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) + data, _ := json.Marshal(req) - query := C.CString(string(data)) - defer C.free(unsafe.Pointer(query)) + query := C.CString(string(data)) + defer C.free(unsafe.Pointer(query)) - C.td_json_client_send(jsonClient.jsonClient, 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 @@ -41,23 +41,23 @@ func (jsonClient *JsonClient) Send(req Request) { // 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") - } + 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)) + data := []byte(C.GoString(result)) - var resp Response + var resp Response - err := json.Unmarshal(data, &resp) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &resp) + if err != nil { + return nil, err + } - resp.Data = data + resp.Data = data - return &resp, nil + return &resp, nil } // Synchronously executes TDLib request. May be called from any thread. @@ -65,96 +65,96 @@ func (jsonClient *JsonClient) Receive(timeout time.Duration) (*Response, error) // 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) + data, _ := json.Marshal(req) - query := C.CString(string(data)) - defer C.free(unsafe.Pointer(query)) + 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") - } + 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)) + data = []byte(C.GoString(result)) - var resp Response + var resp Response - err := json.Unmarshal(data, &resp) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &resp) + if err != nil { + return nil, err + } - resp.Data = data + resp.Data = data - return &resp, nil + return &resp, nil } // Destroys the TDLib client instance. After this is called the client instance shouldn't be used anymore. func (jsonClient *JsonClient) DestroyInstance() { - C.td_json_client_destroy(jsonClient.jsonClient) + C.td_json_client_destroy(jsonClient.jsonClient) } // Sets the path to the file where the internal TDLib log will be written. // By default TDLib writes logs to stderr or an OS specific log. // Use this method to write the log to a file instead. func SetLogFilePath(filePath string) { - query := C.CString(filePath) - defer C.free(unsafe.Pointer(query)) + query := C.CString(filePath) + defer C.free(unsafe.Pointer(query)) - C.td_set_log_file_path(query) + C.td_set_log_file_path(query) } // Sets maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated. // Unused if log is not written to a file. Defaults to 10 MB. func SetLogMaxFileSize(maxFileSize int64) { - C.td_set_log_max_file_size(C.longlong(maxFileSize)) + C.td_set_log_max_file_size(C.longlong(maxFileSize)) } // Sets the verbosity level of the internal logging of TDLib. // By default the TDLib uses a log verbosity level of 5 func SetLogVerbosityLevel(newVerbosityLevel int) { - C.td_set_log_verbosity_level(C.int(newVerbosityLevel)) + C.td_set_log_verbosity_level(C.int(newVerbosityLevel)) } type meta struct { - Type string `json:"@type"` - Extra string `json:"@extra"` + Type string `json:"@type"` + Extra string `json:"@extra"` } type Request struct { - meta - Data map[string]interface{} + meta + Data map[string]interface{} } func (req Request) MarshalJSON() ([]byte, error) { - req.Data["@type"] = req.Type - req.Data["@extra"] = req.Extra + req.Data["@type"] = req.Type + req.Data["@extra"] = req.Extra - return json.Marshal(req.Data) + return json.Marshal(req.Data) } type Response struct { - meta - Data json.RawMessage + meta + Data json.RawMessage } type ResponseError struct { - Err *Error + Err *Error } func (responseError ResponseError) Error() string { - return fmt.Sprintf("%d %s", responseError.Err.Code, responseError.Err.Message) + 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 - } + respErr, err := UnmarshalError(data) + if err != nil { + return err + } - return ResponseError{ - Err: respErr, - } + return ResponseError{ + Err: respErr, + } } // JsonInt64 alias for int64, in order to deal with json big number problem @@ -162,22 +162,22 @@ type JsonInt64 int64 // MarshalJSON marshals to json func (jsonInt64 *JsonInt64) MarshalJSON() ([]byte, error) { - return []byte(strconv.FormatInt(int64(*jsonInt64), 10)), nil + return []byte(strconv.FormatInt(int64(*jsonInt64), 10)), nil } // UnmarshalJSON unmarshals from json func (jsonInt64 *JsonInt64) UnmarshalJSON(data []byte) error { - jsonBigInt, err := strconv.ParseInt(string(data[1:len(data)-1]), 10, 64) - if err != nil { - return err - } + jsonBigInt, err := strconv.ParseInt(string(data[1:len(data)-1]), 10, 64) + if err != nil { + return err + } - *jsonInt64 = JsonInt64(jsonBigInt) + *jsonInt64 = JsonInt64(jsonBigInt) - return nil + return nil } type Type interface { - GetType() string - GetClass() string + GetType() string + GetClass() string } diff --git a/client/type.go b/client/type.go index 9bbf15c..e6c4ed3 100755 --- a/client/type.go +++ b/client/type.go @@ -3,20351 +3,20350 @@ package client import ( - "encoding/json" + "encoding/json" ) const ( - ClassAuthenticationCodeType = "AuthenticationCodeType" - ClassAuthorizationState = "AuthorizationState" - ClassInputFile = "InputFile" - ClassMaskPoint = "MaskPoint" - ClassLinkState = "LinkState" - ClassUserType = "UserType" - ClassChatMemberStatus = "ChatMemberStatus" - ClassChatMembersFilter = "ChatMembersFilter" - ClassSupergroupMembersFilter = "SupergroupMembersFilter" - ClassSecretChatState = "SecretChatState" - ClassMessageForwardInfo = "MessageForwardInfo" - ClassMessageSendingState = "MessageSendingState" - ClassNotificationSettingsScope = "NotificationSettingsScope" - ClassChatType = "ChatType" - ClassKeyboardButtonType = "KeyboardButtonType" - ClassInlineKeyboardButtonType = "InlineKeyboardButtonType" - ClassReplyMarkup = "ReplyMarkup" - ClassRichText = "RichText" - ClassPageBlock = "PageBlock" - ClassInputCredentials = "InputCredentials" - ClassPassportElementType = "PassportElementType" - ClassPassportElement = "PassportElement" - ClassInputPassportElement = "InputPassportElement" - ClassPassportElementErrorSource = "PassportElementErrorSource" - ClassInputPassportElementErrorSource = "InputPassportElementErrorSource" - ClassMessageContent = "MessageContent" - ClassTextEntityType = "TextEntityType" - ClassInputMessageContent = "InputMessageContent" - ClassSearchMessagesFilter = "SearchMessagesFilter" - ClassChatAction = "ChatAction" - ClassUserStatus = "UserStatus" - ClassCallDiscardReason = "CallDiscardReason" - ClassCallState = "CallState" - ClassInputInlineQueryResult = "InputInlineQueryResult" - ClassInlineQueryResult = "InlineQueryResult" - ClassCallbackQueryPayload = "CallbackQueryPayload" - ClassChatEventAction = "ChatEventAction" - ClassLanguagePackStringValue = "LanguagePackStringValue" - ClassDeviceToken = "DeviceToken" - ClassCheckChatUsernameResult = "CheckChatUsernameResult" - ClassOptionValue = "OptionValue" - ClassUserPrivacySettingRule = "UserPrivacySettingRule" - ClassUserPrivacySetting = "UserPrivacySetting" - ClassChatReportReason = "ChatReportReason" - ClassFileType = "FileType" - ClassNetworkType = "NetworkType" - ClassNetworkStatisticsEntry = "NetworkStatisticsEntry" - ClassConnectionState = "ConnectionState" - ClassTopChatCategory = "TopChatCategory" - ClassTMeUrlType = "TMeUrlType" - ClassTextParseMode = "TextParseMode" - ClassProxyType = "ProxyType" - ClassUpdate = "Update" - 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" - ClassMaskPosition = "MaskPosition" - ClassAnimation = "Animation" - ClassAudio = "Audio" - ClassDocument = "Document" - ClassPhoto = "Photo" - ClassSticker = "Sticker" - ClassVideo = "Video" - ClassVideoNote = "VideoNote" - ClassVoiceNote = "VoiceNote" - ClassContact = "Contact" - ClassLocation = "Location" - ClassVenue = "Venue" - ClassGame = "Game" - ClassProfilePhoto = "ProfilePhoto" - ClassChatPhoto = "ChatPhoto" - ClassBotCommand = "BotCommand" - ClassBotInfo = "BotInfo" - ClassUser = "User" - ClassUserFullInfo = "UserFullInfo" - ClassUserProfilePhotos = "UserProfilePhotos" - ClassUsers = "Users" - ClassChatMember = "ChatMember" - ClassChatMembers = "ChatMembers" - ClassBasicGroup = "BasicGroup" - ClassBasicGroupFullInfo = "BasicGroupFullInfo" - ClassSupergroup = "Supergroup" - ClassSupergroupFullInfo = "SupergroupFullInfo" - ClassSecretChat = "SecretChat" - ClassMessage = "Message" - ClassMessages = "Messages" - ClassFoundMessages = "FoundMessages" - ClassChatNotificationSettings = "ChatNotificationSettings" - ClassScopeNotificationSettings = "ScopeNotificationSettings" - ClassDraftMessage = "DraftMessage" - ClassChat = "Chat" - ClassChats = "Chats" - ClassChatInviteLink = "ChatInviteLink" - ClassChatInviteLinkInfo = "ChatInviteLinkInfo" - ClassKeyboardButton = "KeyboardButton" - ClassInlineKeyboardButton = "InlineKeyboardButton" - ClassWebPageInstantView = "WebPageInstantView" - ClassWebPage = "WebPage" - ClassAddress = "Address" - ClassLabeledPricePart = "LabeledPricePart" - ClassInvoice = "Invoice" - ClassOrderInfo = "OrderInfo" - ClassShippingOption = "ShippingOption" - ClassSavedCredentials = "SavedCredentials" - ClassPaymentsProviderStripe = "PaymentsProviderStripe" - ClassPaymentForm = "PaymentForm" - ClassValidatedOrderInfo = "ValidatedOrderInfo" - ClassPaymentResult = "PaymentResult" - ClassPaymentReceipt = "PaymentReceipt" - ClassDatedFile = "DatedFile" - ClassDate = "Date" - ClassPersonalDetails = "PersonalDetails" - ClassIdentityDocument = "IdentityDocument" - ClassInputIdentityDocument = "InputIdentityDocument" - ClassPersonalDocument = "PersonalDocument" - ClassInputPersonalDocument = "InputPersonalDocument" - ClassPassportElements = "PassportElements" - ClassPassportElementError = "PassportElementError" - ClassPassportSuitableElement = "PassportSuitableElement" - ClassPassportRequiredElement = "PassportRequiredElement" - ClassPassportAuthorizationForm = "PassportAuthorizationForm" - ClassEncryptedCredentials = "EncryptedCredentials" - ClassEncryptedPassportElement = "EncryptedPassportElement" - ClassInputPassportElementError = "InputPassportElementError" - ClassInputThumbnail = "InputThumbnail" - ClassStickers = "Stickers" - ClassStickerEmojis = "StickerEmojis" - ClassStickerSet = "StickerSet" - ClassStickerSetInfo = "StickerSetInfo" - ClassStickerSets = "StickerSets" - ClassCallProtocol = "CallProtocol" - ClassCallConnection = "CallConnection" - ClassCallId = "CallId" - ClassCall = "Call" - ClassAnimations = "Animations" - ClassImportedContacts = "ImportedContacts" - ClassInlineQueryResults = "InlineQueryResults" - ClassCallbackQueryAnswer = "CallbackQueryAnswer" - ClassCustomRequestResult = "CustomRequestResult" - ClassGameHighScore = "GameHighScore" - ClassGameHighScores = "GameHighScores" - ClassChatEvent = "ChatEvent" - ClassChatEvents = "ChatEvents" - ClassChatEventLogFilters = "ChatEventLogFilters" - ClassLanguagePackString = "LanguagePackString" - ClassLanguagePackStrings = "LanguagePackStrings" - ClassLanguagePackInfo = "LanguagePackInfo" - ClassLocalizationTargetInfo = "LocalizationTargetInfo" - ClassWallpaper = "Wallpaper" - ClassWallpapers = "Wallpapers" - ClassHashtags = "Hashtags" - ClassUserPrivacySettingRules = "UserPrivacySettingRules" - ClassAccountTtl = "AccountTtl" - ClassSession = "Session" - ClassSessions = "Sessions" - ClassConnectedWebsite = "ConnectedWebsite" - ClassConnectedWebsites = "ConnectedWebsites" - ClassChatReportSpamState = "ChatReportSpamState" - ClassPublicMessageLink = "PublicMessageLink" - ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" - ClassStorageStatisticsByChat = "StorageStatisticsByChat" - ClassStorageStatistics = "StorageStatistics" - ClassStorageStatisticsFast = "StorageStatisticsFast" - ClassNetworkStatistics = "NetworkStatistics" - ClassTMeUrl = "TMeUrl" - ClassTMeUrls = "TMeUrls" - ClassCount = "Count" - ClassText = "Text" - ClassSeconds = "Seconds" - ClassDeepLinkInfo = "DeepLinkInfo" - ClassProxy = "Proxy" - ClassProxies = "Proxies" - ClassInputSticker = "InputSticker" - ClassTestInt = "TestInt" - ClassTestString = "TestString" - ClassTestBytes = "TestBytes" - ClassTestVectorInt = "TestVectorInt" - ClassTestVectorIntObject = "TestVectorIntObject" - ClassTestVectorString = "TestVectorString" - ClassTestVectorStringObject = "TestVectorStringObject" + ClassAuthenticationCodeType = "AuthenticationCodeType" + ClassAuthorizationState = "AuthorizationState" + ClassInputFile = "InputFile" + ClassMaskPoint = "MaskPoint" + ClassLinkState = "LinkState" + ClassUserType = "UserType" + ClassChatMemberStatus = "ChatMemberStatus" + ClassChatMembersFilter = "ChatMembersFilter" + ClassSupergroupMembersFilter = "SupergroupMembersFilter" + ClassSecretChatState = "SecretChatState" + ClassMessageForwardInfo = "MessageForwardInfo" + ClassMessageSendingState = "MessageSendingState" + ClassNotificationSettingsScope = "NotificationSettingsScope" + ClassChatType = "ChatType" + ClassKeyboardButtonType = "KeyboardButtonType" + ClassInlineKeyboardButtonType = "InlineKeyboardButtonType" + ClassReplyMarkup = "ReplyMarkup" + ClassRichText = "RichText" + ClassPageBlock = "PageBlock" + ClassInputCredentials = "InputCredentials" + ClassPassportElementType = "PassportElementType" + ClassPassportElement = "PassportElement" + ClassInputPassportElement = "InputPassportElement" + ClassPassportElementErrorSource = "PassportElementErrorSource" + ClassInputPassportElementErrorSource = "InputPassportElementErrorSource" + ClassMessageContent = "MessageContent" + ClassTextEntityType = "TextEntityType" + ClassInputMessageContent = "InputMessageContent" + ClassSearchMessagesFilter = "SearchMessagesFilter" + ClassChatAction = "ChatAction" + ClassUserStatus = "UserStatus" + ClassCallDiscardReason = "CallDiscardReason" + ClassCallState = "CallState" + ClassInputInlineQueryResult = "InputInlineQueryResult" + ClassInlineQueryResult = "InlineQueryResult" + ClassCallbackQueryPayload = "CallbackQueryPayload" + ClassChatEventAction = "ChatEventAction" + ClassLanguagePackStringValue = "LanguagePackStringValue" + ClassDeviceToken = "DeviceToken" + ClassCheckChatUsernameResult = "CheckChatUsernameResult" + ClassOptionValue = "OptionValue" + ClassUserPrivacySettingRule = "UserPrivacySettingRule" + ClassUserPrivacySetting = "UserPrivacySetting" + ClassChatReportReason = "ChatReportReason" + ClassFileType = "FileType" + ClassNetworkType = "NetworkType" + ClassNetworkStatisticsEntry = "NetworkStatisticsEntry" + ClassConnectionState = "ConnectionState" + ClassTopChatCategory = "TopChatCategory" + ClassTMeUrlType = "TMeUrlType" + ClassTextParseMode = "TextParseMode" + ClassProxyType = "ProxyType" + ClassUpdate = "Update" + 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" + ClassMaskPosition = "MaskPosition" + ClassAnimation = "Animation" + ClassAudio = "Audio" + ClassDocument = "Document" + ClassPhoto = "Photo" + ClassSticker = "Sticker" + ClassVideo = "Video" + ClassVideoNote = "VideoNote" + ClassVoiceNote = "VoiceNote" + ClassContact = "Contact" + ClassLocation = "Location" + ClassVenue = "Venue" + ClassGame = "Game" + ClassProfilePhoto = "ProfilePhoto" + ClassChatPhoto = "ChatPhoto" + ClassBotCommand = "BotCommand" + ClassBotInfo = "BotInfo" + ClassUser = "User" + ClassUserFullInfo = "UserFullInfo" + ClassUserProfilePhotos = "UserProfilePhotos" + ClassUsers = "Users" + ClassChatMember = "ChatMember" + ClassChatMembers = "ChatMembers" + ClassBasicGroup = "BasicGroup" + ClassBasicGroupFullInfo = "BasicGroupFullInfo" + ClassSupergroup = "Supergroup" + ClassSupergroupFullInfo = "SupergroupFullInfo" + ClassSecretChat = "SecretChat" + ClassMessage = "Message" + ClassMessages = "Messages" + ClassFoundMessages = "FoundMessages" + ClassChatNotificationSettings = "ChatNotificationSettings" + ClassScopeNotificationSettings = "ScopeNotificationSettings" + ClassDraftMessage = "DraftMessage" + ClassChat = "Chat" + ClassChats = "Chats" + ClassChatInviteLink = "ChatInviteLink" + ClassChatInviteLinkInfo = "ChatInviteLinkInfo" + ClassKeyboardButton = "KeyboardButton" + ClassInlineKeyboardButton = "InlineKeyboardButton" + ClassWebPageInstantView = "WebPageInstantView" + ClassWebPage = "WebPage" + ClassAddress = "Address" + ClassLabeledPricePart = "LabeledPricePart" + ClassInvoice = "Invoice" + ClassOrderInfo = "OrderInfo" + ClassShippingOption = "ShippingOption" + ClassSavedCredentials = "SavedCredentials" + ClassPaymentsProviderStripe = "PaymentsProviderStripe" + ClassPaymentForm = "PaymentForm" + ClassValidatedOrderInfo = "ValidatedOrderInfo" + ClassPaymentResult = "PaymentResult" + ClassPaymentReceipt = "PaymentReceipt" + ClassDatedFile = "DatedFile" + ClassDate = "Date" + ClassPersonalDetails = "PersonalDetails" + ClassIdentityDocument = "IdentityDocument" + ClassInputIdentityDocument = "InputIdentityDocument" + ClassPersonalDocument = "PersonalDocument" + ClassInputPersonalDocument = "InputPersonalDocument" + ClassPassportElements = "PassportElements" + ClassPassportElementError = "PassportElementError" + ClassPassportSuitableElement = "PassportSuitableElement" + ClassPassportRequiredElement = "PassportRequiredElement" + ClassPassportAuthorizationForm = "PassportAuthorizationForm" + ClassEncryptedCredentials = "EncryptedCredentials" + ClassEncryptedPassportElement = "EncryptedPassportElement" + ClassInputPassportElementError = "InputPassportElementError" + ClassInputThumbnail = "InputThumbnail" + ClassStickers = "Stickers" + ClassStickerEmojis = "StickerEmojis" + ClassStickerSet = "StickerSet" + ClassStickerSetInfo = "StickerSetInfo" + ClassStickerSets = "StickerSets" + ClassCallProtocol = "CallProtocol" + ClassCallConnection = "CallConnection" + ClassCallId = "CallId" + ClassCall = "Call" + ClassAnimations = "Animations" + ClassImportedContacts = "ImportedContacts" + ClassInlineQueryResults = "InlineQueryResults" + ClassCallbackQueryAnswer = "CallbackQueryAnswer" + ClassCustomRequestResult = "CustomRequestResult" + ClassGameHighScore = "GameHighScore" + ClassGameHighScores = "GameHighScores" + ClassChatEvent = "ChatEvent" + ClassChatEvents = "ChatEvents" + ClassChatEventLogFilters = "ChatEventLogFilters" + ClassLanguagePackString = "LanguagePackString" + ClassLanguagePackStrings = "LanguagePackStrings" + ClassLanguagePackInfo = "LanguagePackInfo" + ClassLocalizationTargetInfo = "LocalizationTargetInfo" + ClassWallpaper = "Wallpaper" + ClassWallpapers = "Wallpapers" + ClassHashtags = "Hashtags" + ClassUserPrivacySettingRules = "UserPrivacySettingRules" + ClassAccountTtl = "AccountTtl" + ClassSession = "Session" + ClassSessions = "Sessions" + ClassConnectedWebsite = "ConnectedWebsite" + ClassConnectedWebsites = "ConnectedWebsites" + ClassChatReportSpamState = "ChatReportSpamState" + ClassPublicMessageLink = "PublicMessageLink" + ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" + ClassStorageStatisticsByChat = "StorageStatisticsByChat" + ClassStorageStatistics = "StorageStatistics" + ClassStorageStatisticsFast = "StorageStatisticsFast" + ClassNetworkStatistics = "NetworkStatistics" + ClassTMeUrl = "TMeUrl" + ClassTMeUrls = "TMeUrls" + ClassCount = "Count" + ClassText = "Text" + ClassSeconds = "Seconds" + ClassDeepLinkInfo = "DeepLinkInfo" + ClassProxy = "Proxy" + ClassProxies = "Proxies" + ClassInputSticker = "InputSticker" + 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" - 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" - TypeMaskPointForehead = "maskPointForehead" - TypeMaskPointEyes = "maskPointEyes" - TypeMaskPointMouth = "maskPointMouth" - TypeMaskPointChin = "maskPointChin" - TypeMaskPosition = "maskPosition" - TypeAnimation = "animation" - TypeAudio = "audio" - TypeDocument = "document" - TypePhoto = "photo" - TypeSticker = "sticker" - TypeVideo = "video" - TypeVideoNote = "videoNote" - TypeVoiceNote = "voiceNote" - TypeContact = "contact" - TypeLocation = "location" - TypeVenue = "venue" - TypeGame = "game" - TypeProfilePhoto = "profilePhoto" - TypeChatPhoto = "chatPhoto" - TypeLinkStateNone = "linkStateNone" - TypeLinkStateKnowsPhoneNumber = "linkStateKnowsPhoneNumber" - TypeLinkStateIsContact = "linkStateIsContact" - TypeUserTypeRegular = "userTypeRegular" - TypeUserTypeDeleted = "userTypeDeleted" - TypeUserTypeBot = "userTypeBot" - TypeUserTypeUnknown = "userTypeUnknown" - TypeBotCommand = "botCommand" - TypeBotInfo = "botInfo" - TypeUser = "user" - TypeUserFullInfo = "userFullInfo" - TypeUserProfilePhotos = "userProfilePhotos" - TypeUsers = "users" - TypeChatMemberStatusCreator = "chatMemberStatusCreator" - TypeChatMemberStatusAdministrator = "chatMemberStatusAdministrator" - TypeChatMemberStatusMember = "chatMemberStatusMember" - TypeChatMemberStatusRestricted = "chatMemberStatusRestricted" - TypeChatMemberStatusLeft = "chatMemberStatusLeft" - TypeChatMemberStatusBanned = "chatMemberStatusBanned" - TypeChatMember = "chatMember" - TypeChatMembers = "chatMembers" - TypeChatMembersFilterAdministrators = "chatMembersFilterAdministrators" - TypeChatMembersFilterMembers = "chatMembersFilterMembers" - TypeChatMembersFilterRestricted = "chatMembersFilterRestricted" - TypeChatMembersFilterBanned = "chatMembersFilterBanned" - TypeChatMembersFilterBots = "chatMembersFilterBots" - TypeSupergroupMembersFilterRecent = "supergroupMembersFilterRecent" - TypeSupergroupMembersFilterAdministrators = "supergroupMembersFilterAdministrators" - TypeSupergroupMembersFilterSearch = "supergroupMembersFilterSearch" - TypeSupergroupMembersFilterRestricted = "supergroupMembersFilterRestricted" - TypeSupergroupMembersFilterBanned = "supergroupMembersFilterBanned" - TypeSupergroupMembersFilterBots = "supergroupMembersFilterBots" - TypeBasicGroup = "basicGroup" - TypeBasicGroupFullInfo = "basicGroupFullInfo" - TypeSupergroup = "supergroup" - TypeSupergroupFullInfo = "supergroupFullInfo" - TypeSecretChatStatePending = "secretChatStatePending" - TypeSecretChatStateReady = "secretChatStateReady" - TypeSecretChatStateClosed = "secretChatStateClosed" - TypeSecretChat = "secretChat" - TypeMessageForwardedFromUser = "messageForwardedFromUser" - TypeMessageForwardedPost = "messageForwardedPost" - TypeMessageSendingStatePending = "messageSendingStatePending" - TypeMessageSendingStateFailed = "messageSendingStateFailed" - TypeMessage = "message" - TypeMessages = "messages" - TypeFoundMessages = "foundMessages" - TypeNotificationSettingsScopePrivateChats = "notificationSettingsScopePrivateChats" - TypeNotificationSettingsScopeGroupChats = "notificationSettingsScopeGroupChats" - TypeChatNotificationSettings = "chatNotificationSettings" - TypeScopeNotificationSettings = "scopeNotificationSettings" - TypeDraftMessage = "draftMessage" - TypeChatTypePrivate = "chatTypePrivate" - TypeChatTypeBasicGroup = "chatTypeBasicGroup" - TypeChatTypeSupergroup = "chatTypeSupergroup" - TypeChatTypeSecret = "chatTypeSecret" - TypeChat = "chat" - TypeChats = "chats" - TypeChatInviteLink = "chatInviteLink" - TypeChatInviteLinkInfo = "chatInviteLinkInfo" - TypeKeyboardButtonTypeText = "keyboardButtonTypeText" - TypeKeyboardButtonTypeRequestPhoneNumber = "keyboardButtonTypeRequestPhoneNumber" - TypeKeyboardButtonTypeRequestLocation = "keyboardButtonTypeRequestLocation" - TypeKeyboardButton = "keyboardButton" - TypeInlineKeyboardButtonTypeUrl = "inlineKeyboardButtonTypeUrl" - TypeInlineKeyboardButtonTypeCallback = "inlineKeyboardButtonTypeCallback" - TypeInlineKeyboardButtonTypeCallbackGame = "inlineKeyboardButtonTypeCallbackGame" - TypeInlineKeyboardButtonTypeSwitchInline = "inlineKeyboardButtonTypeSwitchInline" - TypeInlineKeyboardButtonTypeBuy = "inlineKeyboardButtonTypeBuy" - TypeInlineKeyboardButton = "inlineKeyboardButton" - TypeReplyMarkupRemoveKeyboard = "replyMarkupRemoveKeyboard" - TypeReplyMarkupForceReply = "replyMarkupForceReply" - TypeReplyMarkupShowKeyboard = "replyMarkupShowKeyboard" - TypeReplyMarkupInlineKeyboard = "replyMarkupInlineKeyboard" - TypeRichTextPlain = "richTextPlain" - TypeRichTextBold = "richTextBold" - TypeRichTextItalic = "richTextItalic" - TypeRichTextUnderline = "richTextUnderline" - TypeRichTextStrikethrough = "richTextStrikethrough" - TypeRichTextFixed = "richTextFixed" - TypeRichTextUrl = "richTextUrl" - TypeRichTextEmailAddress = "richTextEmailAddress" - TypeRichTexts = "richTexts" - TypePageBlockTitle = "pageBlockTitle" - TypePageBlockSubtitle = "pageBlockSubtitle" - TypePageBlockAuthorDate = "pageBlockAuthorDate" - TypePageBlockHeader = "pageBlockHeader" - TypePageBlockSubheader = "pageBlockSubheader" - TypePageBlockParagraph = "pageBlockParagraph" - TypePageBlockPreformatted = "pageBlockPreformatted" - TypePageBlockFooter = "pageBlockFooter" - TypePageBlockDivider = "pageBlockDivider" - TypePageBlockAnchor = "pageBlockAnchor" - TypePageBlockList = "pageBlockList" - TypePageBlockBlockQuote = "pageBlockBlockQuote" - TypePageBlockPullQuote = "pageBlockPullQuote" - TypePageBlockAnimation = "pageBlockAnimation" - TypePageBlockAudio = "pageBlockAudio" - TypePageBlockPhoto = "pageBlockPhoto" - TypePageBlockVideo = "pageBlockVideo" - TypePageBlockCover = "pageBlockCover" - TypePageBlockEmbedded = "pageBlockEmbedded" - TypePageBlockEmbeddedPost = "pageBlockEmbeddedPost" - TypePageBlockCollage = "pageBlockCollage" - TypePageBlockSlideshow = "pageBlockSlideshow" - TypePageBlockChatLink = "pageBlockChatLink" - TypeWebPageInstantView = "webPageInstantView" - TypeWebPage = "webPage" - TypeAddress = "address" - TypeLabeledPricePart = "labeledPricePart" - TypeInvoice = "invoice" - TypeOrderInfo = "orderInfo" - TypeShippingOption = "shippingOption" - TypeSavedCredentials = "savedCredentials" - TypeInputCredentialsSaved = "inputCredentialsSaved" - TypeInputCredentialsNew = "inputCredentialsNew" - TypeInputCredentialsAndroidPay = "inputCredentialsAndroidPay" - TypeInputCredentialsApplePay = "inputCredentialsApplePay" - TypePaymentsProviderStripe = "paymentsProviderStripe" - TypePaymentForm = "paymentForm" - TypeValidatedOrderInfo = "validatedOrderInfo" - TypePaymentResult = "paymentResult" - TypePaymentReceipt = "paymentReceipt" - TypeDatedFile = "datedFile" - TypePassportElementTypePersonalDetails = "passportElementTypePersonalDetails" - TypePassportElementTypePassport = "passportElementTypePassport" - TypePassportElementTypeDriverLicense = "passportElementTypeDriverLicense" - TypePassportElementTypeIdentityCard = "passportElementTypeIdentityCard" - TypePassportElementTypeInternalPassport = "passportElementTypeInternalPassport" - TypePassportElementTypeAddress = "passportElementTypeAddress" - TypePassportElementTypeUtilityBill = "passportElementTypeUtilityBill" - TypePassportElementTypeBankStatement = "passportElementTypeBankStatement" - TypePassportElementTypeRentalAgreement = "passportElementTypeRentalAgreement" - TypePassportElementTypePassportRegistration = "passportElementTypePassportRegistration" - TypePassportElementTypeTemporaryRegistration = "passportElementTypeTemporaryRegistration" - TypePassportElementTypePhoneNumber = "passportElementTypePhoneNumber" - TypePassportElementTypeEmailAddress = "passportElementTypeEmailAddress" - TypeDate = "date" - TypePersonalDetails = "personalDetails" - TypeIdentityDocument = "identityDocument" - TypeInputIdentityDocument = "inputIdentityDocument" - TypePersonalDocument = "personalDocument" - TypeInputPersonalDocument = "inputPersonalDocument" - TypePassportElementPersonalDetails = "passportElementPersonalDetails" - TypePassportElementPassport = "passportElementPassport" - TypePassportElementDriverLicense = "passportElementDriverLicense" - TypePassportElementIdentityCard = "passportElementIdentityCard" - TypePassportElementInternalPassport = "passportElementInternalPassport" - TypePassportElementAddress = "passportElementAddress" - TypePassportElementUtilityBill = "passportElementUtilityBill" - TypePassportElementBankStatement = "passportElementBankStatement" - TypePassportElementRentalAgreement = "passportElementRentalAgreement" - TypePassportElementPassportRegistration = "passportElementPassportRegistration" - TypePassportElementTemporaryRegistration = "passportElementTemporaryRegistration" - TypePassportElementPhoneNumber = "passportElementPhoneNumber" - TypePassportElementEmailAddress = "passportElementEmailAddress" - TypeInputPassportElementPersonalDetails = "inputPassportElementPersonalDetails" - TypeInputPassportElementPassport = "inputPassportElementPassport" - TypeInputPassportElementDriverLicense = "inputPassportElementDriverLicense" - TypeInputPassportElementIdentityCard = "inputPassportElementIdentityCard" - TypeInputPassportElementInternalPassport = "inputPassportElementInternalPassport" - TypeInputPassportElementAddress = "inputPassportElementAddress" - TypeInputPassportElementUtilityBill = "inputPassportElementUtilityBill" - TypeInputPassportElementBankStatement = "inputPassportElementBankStatement" - TypeInputPassportElementRentalAgreement = "inputPassportElementRentalAgreement" - TypeInputPassportElementPassportRegistration = "inputPassportElementPassportRegistration" - TypeInputPassportElementTemporaryRegistration = "inputPassportElementTemporaryRegistration" - TypeInputPassportElementPhoneNumber = "inputPassportElementPhoneNumber" - TypeInputPassportElementEmailAddress = "inputPassportElementEmailAddress" - TypePassportElements = "passportElements" - TypePassportElementErrorSourceUnspecified = "passportElementErrorSourceUnspecified" - TypePassportElementErrorSourceDataField = "passportElementErrorSourceDataField" - TypePassportElementErrorSourceFrontSide = "passportElementErrorSourceFrontSide" - TypePassportElementErrorSourceReverseSide = "passportElementErrorSourceReverseSide" - TypePassportElementErrorSourceSelfie = "passportElementErrorSourceSelfie" - TypePassportElementErrorSourceTranslationFile = "passportElementErrorSourceTranslationFile" - TypePassportElementErrorSourceTranslationFiles = "passportElementErrorSourceTranslationFiles" - TypePassportElementErrorSourceFile = "passportElementErrorSourceFile" - TypePassportElementErrorSourceFiles = "passportElementErrorSourceFiles" - TypePassportElementError = "passportElementError" - TypePassportSuitableElement = "passportSuitableElement" - TypePassportRequiredElement = "passportRequiredElement" - TypePassportAuthorizationForm = "passportAuthorizationForm" - TypeEncryptedCredentials = "encryptedCredentials" - TypeEncryptedPassportElement = "encryptedPassportElement" - TypeInputPassportElementErrorSourceUnspecified = "inputPassportElementErrorSourceUnspecified" - TypeInputPassportElementErrorSourceDataField = "inputPassportElementErrorSourceDataField" - TypeInputPassportElementErrorSourceFrontSide = "inputPassportElementErrorSourceFrontSide" - TypeInputPassportElementErrorSourceReverseSide = "inputPassportElementErrorSourceReverseSide" - TypeInputPassportElementErrorSourceSelfie = "inputPassportElementErrorSourceSelfie" - TypeInputPassportElementErrorSourceTranslationFile = "inputPassportElementErrorSourceTranslationFile" - TypeInputPassportElementErrorSourceTranslationFiles = "inputPassportElementErrorSourceTranslationFiles" - TypeInputPassportElementErrorSourceFile = "inputPassportElementErrorSourceFile" - TypeInputPassportElementErrorSourceFiles = "inputPassportElementErrorSourceFiles" - TypeInputPassportElementError = "inputPassportElementError" - TypeMessageText = "messageText" - TypeMessageAnimation = "messageAnimation" - TypeMessageAudio = "messageAudio" - TypeMessageDocument = "messageDocument" - TypeMessagePhoto = "messagePhoto" - TypeMessageExpiredPhoto = "messageExpiredPhoto" - TypeMessageSticker = "messageSticker" - TypeMessageVideo = "messageVideo" - TypeMessageExpiredVideo = "messageExpiredVideo" - TypeMessageVideoNote = "messageVideoNote" - TypeMessageVoiceNote = "messageVoiceNote" - TypeMessageLocation = "messageLocation" - TypeMessageVenue = "messageVenue" - TypeMessageContact = "messageContact" - TypeMessageGame = "messageGame" - TypeMessageInvoice = "messageInvoice" - TypeMessageCall = "messageCall" - TypeMessageBasicGroupChatCreate = "messageBasicGroupChatCreate" - TypeMessageSupergroupChatCreate = "messageSupergroupChatCreate" - TypeMessageChatChangeTitle = "messageChatChangeTitle" - TypeMessageChatChangePhoto = "messageChatChangePhoto" - TypeMessageChatDeletePhoto = "messageChatDeletePhoto" - TypeMessageChatAddMembers = "messageChatAddMembers" - TypeMessageChatJoinByLink = "messageChatJoinByLink" - TypeMessageChatDeleteMember = "messageChatDeleteMember" - TypeMessageChatUpgradeTo = "messageChatUpgradeTo" - TypeMessageChatUpgradeFrom = "messageChatUpgradeFrom" - TypeMessagePinMessage = "messagePinMessage" - TypeMessageScreenshotTaken = "messageScreenshotTaken" - TypeMessageChatSetTtl = "messageChatSetTtl" - TypeMessageCustomServiceAction = "messageCustomServiceAction" - TypeMessageGameScore = "messageGameScore" - TypeMessagePaymentSuccessful = "messagePaymentSuccessful" - TypeMessagePaymentSuccessfulBot = "messagePaymentSuccessfulBot" - TypeMessageContactRegistered = "messageContactRegistered" - TypeMessageWebsiteConnected = "messageWebsiteConnected" - TypeMessagePassportDataSent = "messagePassportDataSent" - TypeMessagePassportDataReceived = "messagePassportDataReceived" - TypeMessageUnsupported = "messageUnsupported" - TypeTextEntityTypeMention = "textEntityTypeMention" - TypeTextEntityTypeHashtag = "textEntityTypeHashtag" - TypeTextEntityTypeCashtag = "textEntityTypeCashtag" - TypeTextEntityTypeBotCommand = "textEntityTypeBotCommand" - TypeTextEntityTypeUrl = "textEntityTypeUrl" - TypeTextEntityTypeEmailAddress = "textEntityTypeEmailAddress" - TypeTextEntityTypeBold = "textEntityTypeBold" - TypeTextEntityTypeItalic = "textEntityTypeItalic" - TypeTextEntityTypeCode = "textEntityTypeCode" - TypeTextEntityTypePre = "textEntityTypePre" - TypeTextEntityTypePreCode = "textEntityTypePreCode" - TypeTextEntityTypeTextUrl = "textEntityTypeTextUrl" - TypeTextEntityTypeMentionName = "textEntityTypeMentionName" - TypeTextEntityTypePhoneNumber = "textEntityTypePhoneNumber" - TypeInputThumbnail = "inputThumbnail" - TypeInputMessageText = "inputMessageText" - TypeInputMessageAnimation = "inputMessageAnimation" - TypeInputMessageAudio = "inputMessageAudio" - TypeInputMessageDocument = "inputMessageDocument" - TypeInputMessagePhoto = "inputMessagePhoto" - TypeInputMessageSticker = "inputMessageSticker" - TypeInputMessageVideo = "inputMessageVideo" - TypeInputMessageVideoNote = "inputMessageVideoNote" - TypeInputMessageVoiceNote = "inputMessageVoiceNote" - TypeInputMessageLocation = "inputMessageLocation" - TypeInputMessageVenue = "inputMessageVenue" - TypeInputMessageContact = "inputMessageContact" - TypeInputMessageGame = "inputMessageGame" - TypeInputMessageInvoice = "inputMessageInvoice" - TypeInputMessageForwarded = "inputMessageForwarded" - TypeSearchMessagesFilterEmpty = "searchMessagesFilterEmpty" - TypeSearchMessagesFilterAnimation = "searchMessagesFilterAnimation" - TypeSearchMessagesFilterAudio = "searchMessagesFilterAudio" - TypeSearchMessagesFilterDocument = "searchMessagesFilterDocument" - TypeSearchMessagesFilterPhoto = "searchMessagesFilterPhoto" - TypeSearchMessagesFilterVideo = "searchMessagesFilterVideo" - TypeSearchMessagesFilterVoiceNote = "searchMessagesFilterVoiceNote" - TypeSearchMessagesFilterPhotoAndVideo = "searchMessagesFilterPhotoAndVideo" - TypeSearchMessagesFilterUrl = "searchMessagesFilterUrl" - TypeSearchMessagesFilterChatPhoto = "searchMessagesFilterChatPhoto" - TypeSearchMessagesFilterCall = "searchMessagesFilterCall" - TypeSearchMessagesFilterMissedCall = "searchMessagesFilterMissedCall" - TypeSearchMessagesFilterVideoNote = "searchMessagesFilterVideoNote" - TypeSearchMessagesFilterVoiceAndVideoNote = "searchMessagesFilterVoiceAndVideoNote" - TypeSearchMessagesFilterMention = "searchMessagesFilterMention" - TypeSearchMessagesFilterUnreadMention = "searchMessagesFilterUnreadMention" - TypeChatActionTyping = "chatActionTyping" - TypeChatActionRecordingVideo = "chatActionRecordingVideo" - TypeChatActionUploadingVideo = "chatActionUploadingVideo" - TypeChatActionRecordingVoiceNote = "chatActionRecordingVoiceNote" - TypeChatActionUploadingVoiceNote = "chatActionUploadingVoiceNote" - TypeChatActionUploadingPhoto = "chatActionUploadingPhoto" - TypeChatActionUploadingDocument = "chatActionUploadingDocument" - TypeChatActionChoosingLocation = "chatActionChoosingLocation" - TypeChatActionChoosingContact = "chatActionChoosingContact" - TypeChatActionStartPlayingGame = "chatActionStartPlayingGame" - TypeChatActionRecordingVideoNote = "chatActionRecordingVideoNote" - TypeChatActionUploadingVideoNote = "chatActionUploadingVideoNote" - TypeChatActionCancel = "chatActionCancel" - TypeUserStatusEmpty = "userStatusEmpty" - TypeUserStatusOnline = "userStatusOnline" - TypeUserStatusOffline = "userStatusOffline" - TypeUserStatusRecently = "userStatusRecently" - TypeUserStatusLastWeek = "userStatusLastWeek" - TypeUserStatusLastMonth = "userStatusLastMonth" - TypeStickers = "stickers" - TypeStickerEmojis = "stickerEmojis" - TypeStickerSet = "stickerSet" - TypeStickerSetInfo = "stickerSetInfo" - TypeStickerSets = "stickerSets" - TypeCallDiscardReasonEmpty = "callDiscardReasonEmpty" - TypeCallDiscardReasonMissed = "callDiscardReasonMissed" - TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" - TypeCallDiscardReasonDisconnected = "callDiscardReasonDisconnected" - TypeCallDiscardReasonHungUp = "callDiscardReasonHungUp" - TypeCallProtocol = "callProtocol" - TypeCallConnection = "callConnection" - TypeCallId = "callId" - TypeCallStatePending = "callStatePending" - TypeCallStateExchangingKeys = "callStateExchangingKeys" - TypeCallStateReady = "callStateReady" - TypeCallStateHangingUp = "callStateHangingUp" - TypeCallStateDiscarded = "callStateDiscarded" - TypeCallStateError = "callStateError" - TypeCall = "call" - TypeAnimations = "animations" - TypeImportedContacts = "importedContacts" - TypeInputInlineQueryResultAnimatedGif = "inputInlineQueryResultAnimatedGif" - TypeInputInlineQueryResultAnimatedMpeg4 = "inputInlineQueryResultAnimatedMpeg4" - TypeInputInlineQueryResultArticle = "inputInlineQueryResultArticle" - TypeInputInlineQueryResultAudio = "inputInlineQueryResultAudio" - TypeInputInlineQueryResultContact = "inputInlineQueryResultContact" - TypeInputInlineQueryResultDocument = "inputInlineQueryResultDocument" - TypeInputInlineQueryResultGame = "inputInlineQueryResultGame" - TypeInputInlineQueryResultLocation = "inputInlineQueryResultLocation" - TypeInputInlineQueryResultPhoto = "inputInlineQueryResultPhoto" - TypeInputInlineQueryResultSticker = "inputInlineQueryResultSticker" - TypeInputInlineQueryResultVenue = "inputInlineQueryResultVenue" - TypeInputInlineQueryResultVideo = "inputInlineQueryResultVideo" - TypeInputInlineQueryResultVoiceNote = "inputInlineQueryResultVoiceNote" - TypeInlineQueryResultArticle = "inlineQueryResultArticle" - TypeInlineQueryResultContact = "inlineQueryResultContact" - TypeInlineQueryResultLocation = "inlineQueryResultLocation" - TypeInlineQueryResultVenue = "inlineQueryResultVenue" - TypeInlineQueryResultGame = "inlineQueryResultGame" - TypeInlineQueryResultAnimation = "inlineQueryResultAnimation" - TypeInlineQueryResultAudio = "inlineQueryResultAudio" - TypeInlineQueryResultDocument = "inlineQueryResultDocument" - TypeInlineQueryResultPhoto = "inlineQueryResultPhoto" - TypeInlineQueryResultSticker = "inlineQueryResultSticker" - TypeInlineQueryResultVideo = "inlineQueryResultVideo" - TypeInlineQueryResultVoiceNote = "inlineQueryResultVoiceNote" - TypeInlineQueryResults = "inlineQueryResults" - TypeCallbackQueryPayloadData = "callbackQueryPayloadData" - TypeCallbackQueryPayloadGame = "callbackQueryPayloadGame" - TypeCallbackQueryAnswer = "callbackQueryAnswer" - TypeCustomRequestResult = "customRequestResult" - TypeGameHighScore = "gameHighScore" - TypeGameHighScores = "gameHighScores" - TypeChatEventMessageEdited = "chatEventMessageEdited" - TypeChatEventMessageDeleted = "chatEventMessageDeleted" - TypeChatEventMessagePinned = "chatEventMessagePinned" - TypeChatEventMessageUnpinned = "chatEventMessageUnpinned" - TypeChatEventMemberJoined = "chatEventMemberJoined" - TypeChatEventMemberLeft = "chatEventMemberLeft" - TypeChatEventMemberInvited = "chatEventMemberInvited" - TypeChatEventMemberPromoted = "chatEventMemberPromoted" - TypeChatEventMemberRestricted = "chatEventMemberRestricted" - TypeChatEventTitleChanged = "chatEventTitleChanged" - TypeChatEventDescriptionChanged = "chatEventDescriptionChanged" - TypeChatEventUsernameChanged = "chatEventUsernameChanged" - TypeChatEventPhotoChanged = "chatEventPhotoChanged" - TypeChatEventInvitesToggled = "chatEventInvitesToggled" - TypeChatEventSignMessagesToggled = "chatEventSignMessagesToggled" - TypeChatEventStickerSetChanged = "chatEventStickerSetChanged" - TypeChatEventIsAllHistoryAvailableToggled = "chatEventIsAllHistoryAvailableToggled" - TypeChatEvent = "chatEvent" - TypeChatEvents = "chatEvents" - TypeChatEventLogFilters = "chatEventLogFilters" - TypeLanguagePackStringValueOrdinary = "languagePackStringValueOrdinary" - TypeLanguagePackStringValuePluralized = "languagePackStringValuePluralized" - TypeLanguagePackStringValueDeleted = "languagePackStringValueDeleted" - TypeLanguagePackString = "languagePackString" - TypeLanguagePackStrings = "languagePackStrings" - TypeLanguagePackInfo = "languagePackInfo" - TypeLocalizationTargetInfo = "localizationTargetInfo" - TypeDeviceTokenGoogleCloudMessaging = "deviceTokenGoogleCloudMessaging" - TypeDeviceTokenApplePush = "deviceTokenApplePush" - TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" - TypeDeviceTokenWindowsPush = "deviceTokenWindowsPush" - TypeDeviceTokenMicrosoftPush = "deviceTokenMicrosoftPush" - TypeDeviceTokenMicrosoftPushVoIP = "deviceTokenMicrosoftPushVoIP" - TypeDeviceTokenWebPush = "deviceTokenWebPush" - TypeDeviceTokenSimplePush = "deviceTokenSimplePush" - TypeDeviceTokenUbuntuPush = "deviceTokenUbuntuPush" - TypeDeviceTokenBlackBerryPush = "deviceTokenBlackBerryPush" - TypeDeviceTokenTizenPush = "deviceTokenTizenPush" - TypeWallpaper = "wallpaper" - TypeWallpapers = "wallpapers" - TypeHashtags = "hashtags" - TypeCheckChatUsernameResultOk = "checkChatUsernameResultOk" - TypeCheckChatUsernameResultUsernameInvalid = "checkChatUsernameResultUsernameInvalid" - TypeCheckChatUsernameResultUsernameOccupied = "checkChatUsernameResultUsernameOccupied" - TypeCheckChatUsernameResultPublicChatsTooMuch = "checkChatUsernameResultPublicChatsTooMuch" - TypeCheckChatUsernameResultPublicGroupsUnavailable = "checkChatUsernameResultPublicGroupsUnavailable" - TypeOptionValueBoolean = "optionValueBoolean" - TypeOptionValueEmpty = "optionValueEmpty" - TypeOptionValueInteger = "optionValueInteger" - TypeOptionValueString = "optionValueString" - TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll" - TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts" - TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers" - TypeUserPrivacySettingRuleRestrictAll = "userPrivacySettingRuleRestrictAll" - TypeUserPrivacySettingRuleRestrictContacts = "userPrivacySettingRuleRestrictContacts" - TypeUserPrivacySettingRuleRestrictUsers = "userPrivacySettingRuleRestrictUsers" - TypeUserPrivacySettingRules = "userPrivacySettingRules" - TypeUserPrivacySettingShowStatus = "userPrivacySettingShowStatus" - TypeUserPrivacySettingAllowChatInvites = "userPrivacySettingAllowChatInvites" - TypeUserPrivacySettingAllowCalls = "userPrivacySettingAllowCalls" - TypeAccountTtl = "accountTtl" - TypeSession = "session" - TypeSessions = "sessions" - TypeConnectedWebsite = "connectedWebsite" - TypeConnectedWebsites = "connectedWebsites" - TypeChatReportSpamState = "chatReportSpamState" - TypeChatReportReasonSpam = "chatReportReasonSpam" - TypeChatReportReasonViolence = "chatReportReasonViolence" - TypeChatReportReasonPornography = "chatReportReasonPornography" - TypeChatReportReasonCopyright = "chatReportReasonCopyright" - TypeChatReportReasonCustom = "chatReportReasonCustom" - TypePublicMessageLink = "publicMessageLink" - 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" - TypeNetworkTypeNone = "networkTypeNone" - TypeNetworkTypeMobile = "networkTypeMobile" - TypeNetworkTypeMobileRoaming = "networkTypeMobileRoaming" - TypeNetworkTypeWiFi = "networkTypeWiFi" - TypeNetworkTypeOther = "networkTypeOther" - TypeNetworkStatisticsEntryFile = "networkStatisticsEntryFile" - TypeNetworkStatisticsEntryCall = "networkStatisticsEntryCall" - TypeNetworkStatistics = "networkStatistics" - TypeConnectionStateWaitingForNetwork = "connectionStateWaitingForNetwork" - TypeConnectionStateConnectingToProxy = "connectionStateConnectingToProxy" - TypeConnectionStateConnecting = "connectionStateConnecting" - TypeConnectionStateUpdating = "connectionStateUpdating" - TypeConnectionStateReady = "connectionStateReady" - TypeTopChatCategoryUsers = "topChatCategoryUsers" - TypeTopChatCategoryBots = "topChatCategoryBots" - TypeTopChatCategoryGroups = "topChatCategoryGroups" - TypeTopChatCategoryChannels = "topChatCategoryChannels" - TypeTopChatCategoryInlineBots = "topChatCategoryInlineBots" - TypeTopChatCategoryCalls = "topChatCategoryCalls" - TypeTMeUrlTypeUser = "tMeUrlTypeUser" - TypeTMeUrlTypeSupergroup = "tMeUrlTypeSupergroup" - TypeTMeUrlTypeChatInvite = "tMeUrlTypeChatInvite" - TypeTMeUrlTypeStickerSet = "tMeUrlTypeStickerSet" - TypeTMeUrl = "tMeUrl" - TypeTMeUrls = "tMeUrls" - TypeCount = "count" - TypeText = "text" - TypeSeconds = "seconds" - TypeDeepLinkInfo = "deepLinkInfo" - TypeTextParseModeMarkdown = "textParseModeMarkdown" - TypeTextParseModeHTML = "textParseModeHTML" - TypeProxyTypeSocks5 = "proxyTypeSocks5" - TypeProxyTypeHttp = "proxyTypeHttp" - TypeProxyTypeMtproto = "proxyTypeMtproto" - TypeProxy = "proxy" - TypeProxies = "proxies" - TypeInputSticker = "inputSticker" - TypeUpdateAuthorizationState = "updateAuthorizationState" - TypeUpdateNewMessage = "updateNewMessage" - TypeUpdateMessageSendAcknowledged = "updateMessageSendAcknowledged" - TypeUpdateMessageSendSucceeded = "updateMessageSendSucceeded" - TypeUpdateMessageSendFailed = "updateMessageSendFailed" - TypeUpdateMessageContent = "updateMessageContent" - TypeUpdateMessageEdited = "updateMessageEdited" - TypeUpdateMessageViews = "updateMessageViews" - TypeUpdateMessageContentOpened = "updateMessageContentOpened" - TypeUpdateMessageMentionRead = "updateMessageMentionRead" - TypeUpdateNewChat = "updateNewChat" - TypeUpdateChatTitle = "updateChatTitle" - TypeUpdateChatPhoto = "updateChatPhoto" - TypeUpdateChatLastMessage = "updateChatLastMessage" - TypeUpdateChatOrder = "updateChatOrder" - TypeUpdateChatIsPinned = "updateChatIsPinned" - TypeUpdateChatIsMarkedAsUnread = "updateChatIsMarkedAsUnread" - TypeUpdateChatIsSponsored = "updateChatIsSponsored" - TypeUpdateChatDefaultDisableNotification = "updateChatDefaultDisableNotification" - TypeUpdateChatReadInbox = "updateChatReadInbox" - TypeUpdateChatReadOutbox = "updateChatReadOutbox" - TypeUpdateChatUnreadMentionCount = "updateChatUnreadMentionCount" - TypeUpdateChatNotificationSettings = "updateChatNotificationSettings" - TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" - TypeUpdateChatReplyMarkup = "updateChatReplyMarkup" - TypeUpdateChatDraftMessage = "updateChatDraftMessage" - TypeUpdateDeleteMessages = "updateDeleteMessages" - TypeUpdateUserChatAction = "updateUserChatAction" - TypeUpdateUserStatus = "updateUserStatus" - TypeUpdateUser = "updateUser" - TypeUpdateBasicGroup = "updateBasicGroup" - TypeUpdateSupergroup = "updateSupergroup" - TypeUpdateSecretChat = "updateSecretChat" - TypeUpdateUserFullInfo = "updateUserFullInfo" - TypeUpdateBasicGroupFullInfo = "updateBasicGroupFullInfo" - TypeUpdateSupergroupFullInfo = "updateSupergroupFullInfo" - TypeUpdateServiceNotification = "updateServiceNotification" - TypeUpdateFile = "updateFile" - TypeUpdateFileGenerationStart = "updateFileGenerationStart" - TypeUpdateFileGenerationStop = "updateFileGenerationStop" - TypeUpdateCall = "updateCall" - TypeUpdateUserPrivacySettingRules = "updateUserPrivacySettingRules" - TypeUpdateUnreadMessageCount = "updateUnreadMessageCount" - TypeUpdateUnreadChatCount = "updateUnreadChatCount" - TypeUpdateOption = "updateOption" - TypeUpdateInstalledStickerSets = "updateInstalledStickerSets" - TypeUpdateTrendingStickerSets = "updateTrendingStickerSets" - TypeUpdateRecentStickers = "updateRecentStickers" - TypeUpdateFavoriteStickers = "updateFavoriteStickers" - TypeUpdateSavedAnimations = "updateSavedAnimations" - TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" - TypeUpdateConnectionState = "updateConnectionState" - TypeUpdateTermsOfService = "updateTermsOfService" - TypeUpdateNewInlineQuery = "updateNewInlineQuery" - TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult" - TypeUpdateNewCallbackQuery = "updateNewCallbackQuery" - TypeUpdateNewInlineCallbackQuery = "updateNewInlineCallbackQuery" - TypeUpdateNewShippingQuery = "updateNewShippingQuery" - TypeUpdateNewPreCheckoutQuery = "updateNewPreCheckoutQuery" - TypeUpdateNewCustomEvent = "updateNewCustomEvent" - TypeUpdateNewCustomQuery = "updateNewCustomQuery" - TypeTestInt = "testInt" - TypeTestString = "testString" - TypeTestBytes = "testBytes" - TypeTestVectorInt = "testVectorInt" - TypeTestVectorIntObject = "testVectorIntObject" - TypeTestVectorString = "testVectorString" - TypeTestVectorStringObject = "testVectorStringObject" + 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" + 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" + TypeMaskPointForehead = "maskPointForehead" + TypeMaskPointEyes = "maskPointEyes" + TypeMaskPointMouth = "maskPointMouth" + TypeMaskPointChin = "maskPointChin" + TypeMaskPosition = "maskPosition" + TypeAnimation = "animation" + TypeAudio = "audio" + TypeDocument = "document" + TypePhoto = "photo" + TypeSticker = "sticker" + TypeVideo = "video" + TypeVideoNote = "videoNote" + TypeVoiceNote = "voiceNote" + TypeContact = "contact" + TypeLocation = "location" + TypeVenue = "venue" + TypeGame = "game" + TypeProfilePhoto = "profilePhoto" + TypeChatPhoto = "chatPhoto" + TypeLinkStateNone = "linkStateNone" + TypeLinkStateKnowsPhoneNumber = "linkStateKnowsPhoneNumber" + TypeLinkStateIsContact = "linkStateIsContact" + TypeUserTypeRegular = "userTypeRegular" + TypeUserTypeDeleted = "userTypeDeleted" + TypeUserTypeBot = "userTypeBot" + TypeUserTypeUnknown = "userTypeUnknown" + TypeBotCommand = "botCommand" + TypeBotInfo = "botInfo" + TypeUser = "user" + TypeUserFullInfo = "userFullInfo" + TypeUserProfilePhotos = "userProfilePhotos" + TypeUsers = "users" + TypeChatMemberStatusCreator = "chatMemberStatusCreator" + TypeChatMemberStatusAdministrator = "chatMemberStatusAdministrator" + TypeChatMemberStatusMember = "chatMemberStatusMember" + TypeChatMemberStatusRestricted = "chatMemberStatusRestricted" + TypeChatMemberStatusLeft = "chatMemberStatusLeft" + TypeChatMemberStatusBanned = "chatMemberStatusBanned" + TypeChatMember = "chatMember" + TypeChatMembers = "chatMembers" + TypeChatMembersFilterAdministrators = "chatMembersFilterAdministrators" + TypeChatMembersFilterMembers = "chatMembersFilterMembers" + TypeChatMembersFilterRestricted = "chatMembersFilterRestricted" + TypeChatMembersFilterBanned = "chatMembersFilterBanned" + TypeChatMembersFilterBots = "chatMembersFilterBots" + TypeSupergroupMembersFilterRecent = "supergroupMembersFilterRecent" + TypeSupergroupMembersFilterAdministrators = "supergroupMembersFilterAdministrators" + TypeSupergroupMembersFilterSearch = "supergroupMembersFilterSearch" + TypeSupergroupMembersFilterRestricted = "supergroupMembersFilterRestricted" + TypeSupergroupMembersFilterBanned = "supergroupMembersFilterBanned" + TypeSupergroupMembersFilterBots = "supergroupMembersFilterBots" + TypeBasicGroup = "basicGroup" + TypeBasicGroupFullInfo = "basicGroupFullInfo" + TypeSupergroup = "supergroup" + TypeSupergroupFullInfo = "supergroupFullInfo" + TypeSecretChatStatePending = "secretChatStatePending" + TypeSecretChatStateReady = "secretChatStateReady" + TypeSecretChatStateClosed = "secretChatStateClosed" + TypeSecretChat = "secretChat" + TypeMessageForwardedFromUser = "messageForwardedFromUser" + TypeMessageForwardedPost = "messageForwardedPost" + TypeMessageSendingStatePending = "messageSendingStatePending" + TypeMessageSendingStateFailed = "messageSendingStateFailed" + TypeMessage = "message" + TypeMessages = "messages" + TypeFoundMessages = "foundMessages" + TypeNotificationSettingsScopePrivateChats = "notificationSettingsScopePrivateChats" + TypeNotificationSettingsScopeGroupChats = "notificationSettingsScopeGroupChats" + TypeChatNotificationSettings = "chatNotificationSettings" + TypeScopeNotificationSettings = "scopeNotificationSettings" + TypeDraftMessage = "draftMessage" + TypeChatTypePrivate = "chatTypePrivate" + TypeChatTypeBasicGroup = "chatTypeBasicGroup" + TypeChatTypeSupergroup = "chatTypeSupergroup" + TypeChatTypeSecret = "chatTypeSecret" + TypeChat = "chat" + TypeChats = "chats" + TypeChatInviteLink = "chatInviteLink" + TypeChatInviteLinkInfo = "chatInviteLinkInfo" + TypeKeyboardButtonTypeText = "keyboardButtonTypeText" + TypeKeyboardButtonTypeRequestPhoneNumber = "keyboardButtonTypeRequestPhoneNumber" + TypeKeyboardButtonTypeRequestLocation = "keyboardButtonTypeRequestLocation" + TypeKeyboardButton = "keyboardButton" + TypeInlineKeyboardButtonTypeUrl = "inlineKeyboardButtonTypeUrl" + TypeInlineKeyboardButtonTypeCallback = "inlineKeyboardButtonTypeCallback" + TypeInlineKeyboardButtonTypeCallbackGame = "inlineKeyboardButtonTypeCallbackGame" + TypeInlineKeyboardButtonTypeSwitchInline = "inlineKeyboardButtonTypeSwitchInline" + TypeInlineKeyboardButtonTypeBuy = "inlineKeyboardButtonTypeBuy" + TypeInlineKeyboardButton = "inlineKeyboardButton" + TypeReplyMarkupRemoveKeyboard = "replyMarkupRemoveKeyboard" + TypeReplyMarkupForceReply = "replyMarkupForceReply" + TypeReplyMarkupShowKeyboard = "replyMarkupShowKeyboard" + TypeReplyMarkupInlineKeyboard = "replyMarkupInlineKeyboard" + TypeRichTextPlain = "richTextPlain" + TypeRichTextBold = "richTextBold" + TypeRichTextItalic = "richTextItalic" + TypeRichTextUnderline = "richTextUnderline" + TypeRichTextStrikethrough = "richTextStrikethrough" + TypeRichTextFixed = "richTextFixed" + TypeRichTextUrl = "richTextUrl" + TypeRichTextEmailAddress = "richTextEmailAddress" + TypeRichTexts = "richTexts" + TypePageBlockTitle = "pageBlockTitle" + TypePageBlockSubtitle = "pageBlockSubtitle" + TypePageBlockAuthorDate = "pageBlockAuthorDate" + TypePageBlockHeader = "pageBlockHeader" + TypePageBlockSubheader = "pageBlockSubheader" + TypePageBlockParagraph = "pageBlockParagraph" + TypePageBlockPreformatted = "pageBlockPreformatted" + TypePageBlockFooter = "pageBlockFooter" + TypePageBlockDivider = "pageBlockDivider" + TypePageBlockAnchor = "pageBlockAnchor" + TypePageBlockList = "pageBlockList" + TypePageBlockBlockQuote = "pageBlockBlockQuote" + TypePageBlockPullQuote = "pageBlockPullQuote" + TypePageBlockAnimation = "pageBlockAnimation" + TypePageBlockAudio = "pageBlockAudio" + TypePageBlockPhoto = "pageBlockPhoto" + TypePageBlockVideo = "pageBlockVideo" + TypePageBlockCover = "pageBlockCover" + TypePageBlockEmbedded = "pageBlockEmbedded" + TypePageBlockEmbeddedPost = "pageBlockEmbeddedPost" + TypePageBlockCollage = "pageBlockCollage" + TypePageBlockSlideshow = "pageBlockSlideshow" + TypePageBlockChatLink = "pageBlockChatLink" + TypeWebPageInstantView = "webPageInstantView" + TypeWebPage = "webPage" + TypeAddress = "address" + TypeLabeledPricePart = "labeledPricePart" + TypeInvoice = "invoice" + TypeOrderInfo = "orderInfo" + TypeShippingOption = "shippingOption" + TypeSavedCredentials = "savedCredentials" + TypeInputCredentialsSaved = "inputCredentialsSaved" + TypeInputCredentialsNew = "inputCredentialsNew" + TypeInputCredentialsAndroidPay = "inputCredentialsAndroidPay" + TypeInputCredentialsApplePay = "inputCredentialsApplePay" + TypePaymentsProviderStripe = "paymentsProviderStripe" + TypePaymentForm = "paymentForm" + TypeValidatedOrderInfo = "validatedOrderInfo" + TypePaymentResult = "paymentResult" + TypePaymentReceipt = "paymentReceipt" + TypeDatedFile = "datedFile" + TypePassportElementTypePersonalDetails = "passportElementTypePersonalDetails" + TypePassportElementTypePassport = "passportElementTypePassport" + TypePassportElementTypeDriverLicense = "passportElementTypeDriverLicense" + TypePassportElementTypeIdentityCard = "passportElementTypeIdentityCard" + TypePassportElementTypeInternalPassport = "passportElementTypeInternalPassport" + TypePassportElementTypeAddress = "passportElementTypeAddress" + TypePassportElementTypeUtilityBill = "passportElementTypeUtilityBill" + TypePassportElementTypeBankStatement = "passportElementTypeBankStatement" + TypePassportElementTypeRentalAgreement = "passportElementTypeRentalAgreement" + TypePassportElementTypePassportRegistration = "passportElementTypePassportRegistration" + TypePassportElementTypeTemporaryRegistration = "passportElementTypeTemporaryRegistration" + TypePassportElementTypePhoneNumber = "passportElementTypePhoneNumber" + TypePassportElementTypeEmailAddress = "passportElementTypeEmailAddress" + TypeDate = "date" + TypePersonalDetails = "personalDetails" + TypeIdentityDocument = "identityDocument" + TypeInputIdentityDocument = "inputIdentityDocument" + TypePersonalDocument = "personalDocument" + TypeInputPersonalDocument = "inputPersonalDocument" + TypePassportElementPersonalDetails = "passportElementPersonalDetails" + TypePassportElementPassport = "passportElementPassport" + TypePassportElementDriverLicense = "passportElementDriverLicense" + TypePassportElementIdentityCard = "passportElementIdentityCard" + TypePassportElementInternalPassport = "passportElementInternalPassport" + TypePassportElementAddress = "passportElementAddress" + TypePassportElementUtilityBill = "passportElementUtilityBill" + TypePassportElementBankStatement = "passportElementBankStatement" + TypePassportElementRentalAgreement = "passportElementRentalAgreement" + TypePassportElementPassportRegistration = "passportElementPassportRegistration" + TypePassportElementTemporaryRegistration = "passportElementTemporaryRegistration" + TypePassportElementPhoneNumber = "passportElementPhoneNumber" + TypePassportElementEmailAddress = "passportElementEmailAddress" + TypeInputPassportElementPersonalDetails = "inputPassportElementPersonalDetails" + TypeInputPassportElementPassport = "inputPassportElementPassport" + TypeInputPassportElementDriverLicense = "inputPassportElementDriverLicense" + TypeInputPassportElementIdentityCard = "inputPassportElementIdentityCard" + TypeInputPassportElementInternalPassport = "inputPassportElementInternalPassport" + TypeInputPassportElementAddress = "inputPassportElementAddress" + TypeInputPassportElementUtilityBill = "inputPassportElementUtilityBill" + TypeInputPassportElementBankStatement = "inputPassportElementBankStatement" + TypeInputPassportElementRentalAgreement = "inputPassportElementRentalAgreement" + TypeInputPassportElementPassportRegistration = "inputPassportElementPassportRegistration" + TypeInputPassportElementTemporaryRegistration = "inputPassportElementTemporaryRegistration" + TypeInputPassportElementPhoneNumber = "inputPassportElementPhoneNumber" + TypeInputPassportElementEmailAddress = "inputPassportElementEmailAddress" + TypePassportElements = "passportElements" + TypePassportElementErrorSourceUnspecified = "passportElementErrorSourceUnspecified" + TypePassportElementErrorSourceDataField = "passportElementErrorSourceDataField" + TypePassportElementErrorSourceFrontSide = "passportElementErrorSourceFrontSide" + TypePassportElementErrorSourceReverseSide = "passportElementErrorSourceReverseSide" + TypePassportElementErrorSourceSelfie = "passportElementErrorSourceSelfie" + TypePassportElementErrorSourceTranslationFile = "passportElementErrorSourceTranslationFile" + TypePassportElementErrorSourceTranslationFiles = "passportElementErrorSourceTranslationFiles" + TypePassportElementErrorSourceFile = "passportElementErrorSourceFile" + TypePassportElementErrorSourceFiles = "passportElementErrorSourceFiles" + TypePassportElementError = "passportElementError" + TypePassportSuitableElement = "passportSuitableElement" + TypePassportRequiredElement = "passportRequiredElement" + TypePassportAuthorizationForm = "passportAuthorizationForm" + TypeEncryptedCredentials = "encryptedCredentials" + TypeEncryptedPassportElement = "encryptedPassportElement" + TypeInputPassportElementErrorSourceUnspecified = "inputPassportElementErrorSourceUnspecified" + TypeInputPassportElementErrorSourceDataField = "inputPassportElementErrorSourceDataField" + TypeInputPassportElementErrorSourceFrontSide = "inputPassportElementErrorSourceFrontSide" + TypeInputPassportElementErrorSourceReverseSide = "inputPassportElementErrorSourceReverseSide" + TypeInputPassportElementErrorSourceSelfie = "inputPassportElementErrorSourceSelfie" + TypeInputPassportElementErrorSourceTranslationFile = "inputPassportElementErrorSourceTranslationFile" + TypeInputPassportElementErrorSourceTranslationFiles = "inputPassportElementErrorSourceTranslationFiles" + TypeInputPassportElementErrorSourceFile = "inputPassportElementErrorSourceFile" + TypeInputPassportElementErrorSourceFiles = "inputPassportElementErrorSourceFiles" + TypeInputPassportElementError = "inputPassportElementError" + TypeMessageText = "messageText" + TypeMessageAnimation = "messageAnimation" + TypeMessageAudio = "messageAudio" + TypeMessageDocument = "messageDocument" + TypeMessagePhoto = "messagePhoto" + TypeMessageExpiredPhoto = "messageExpiredPhoto" + TypeMessageSticker = "messageSticker" + TypeMessageVideo = "messageVideo" + TypeMessageExpiredVideo = "messageExpiredVideo" + TypeMessageVideoNote = "messageVideoNote" + TypeMessageVoiceNote = "messageVoiceNote" + TypeMessageLocation = "messageLocation" + TypeMessageVenue = "messageVenue" + TypeMessageContact = "messageContact" + TypeMessageGame = "messageGame" + TypeMessageInvoice = "messageInvoice" + TypeMessageCall = "messageCall" + TypeMessageBasicGroupChatCreate = "messageBasicGroupChatCreate" + TypeMessageSupergroupChatCreate = "messageSupergroupChatCreate" + TypeMessageChatChangeTitle = "messageChatChangeTitle" + TypeMessageChatChangePhoto = "messageChatChangePhoto" + TypeMessageChatDeletePhoto = "messageChatDeletePhoto" + TypeMessageChatAddMembers = "messageChatAddMembers" + TypeMessageChatJoinByLink = "messageChatJoinByLink" + TypeMessageChatDeleteMember = "messageChatDeleteMember" + TypeMessageChatUpgradeTo = "messageChatUpgradeTo" + TypeMessageChatUpgradeFrom = "messageChatUpgradeFrom" + TypeMessagePinMessage = "messagePinMessage" + TypeMessageScreenshotTaken = "messageScreenshotTaken" + TypeMessageChatSetTtl = "messageChatSetTtl" + TypeMessageCustomServiceAction = "messageCustomServiceAction" + TypeMessageGameScore = "messageGameScore" + TypeMessagePaymentSuccessful = "messagePaymentSuccessful" + TypeMessagePaymentSuccessfulBot = "messagePaymentSuccessfulBot" + TypeMessageContactRegistered = "messageContactRegistered" + TypeMessageWebsiteConnected = "messageWebsiteConnected" + TypeMessagePassportDataSent = "messagePassportDataSent" + TypeMessagePassportDataReceived = "messagePassportDataReceived" + TypeMessageUnsupported = "messageUnsupported" + TypeTextEntityTypeMention = "textEntityTypeMention" + TypeTextEntityTypeHashtag = "textEntityTypeHashtag" + TypeTextEntityTypeCashtag = "textEntityTypeCashtag" + TypeTextEntityTypeBotCommand = "textEntityTypeBotCommand" + TypeTextEntityTypeUrl = "textEntityTypeUrl" + TypeTextEntityTypeEmailAddress = "textEntityTypeEmailAddress" + TypeTextEntityTypeBold = "textEntityTypeBold" + TypeTextEntityTypeItalic = "textEntityTypeItalic" + TypeTextEntityTypeCode = "textEntityTypeCode" + TypeTextEntityTypePre = "textEntityTypePre" + TypeTextEntityTypePreCode = "textEntityTypePreCode" + TypeTextEntityTypeTextUrl = "textEntityTypeTextUrl" + TypeTextEntityTypeMentionName = "textEntityTypeMentionName" + TypeTextEntityTypePhoneNumber = "textEntityTypePhoneNumber" + TypeInputThumbnail = "inputThumbnail" + TypeInputMessageText = "inputMessageText" + TypeInputMessageAnimation = "inputMessageAnimation" + TypeInputMessageAudio = "inputMessageAudio" + TypeInputMessageDocument = "inputMessageDocument" + TypeInputMessagePhoto = "inputMessagePhoto" + TypeInputMessageSticker = "inputMessageSticker" + TypeInputMessageVideo = "inputMessageVideo" + TypeInputMessageVideoNote = "inputMessageVideoNote" + TypeInputMessageVoiceNote = "inputMessageVoiceNote" + TypeInputMessageLocation = "inputMessageLocation" + TypeInputMessageVenue = "inputMessageVenue" + TypeInputMessageContact = "inputMessageContact" + TypeInputMessageGame = "inputMessageGame" + TypeInputMessageInvoice = "inputMessageInvoice" + TypeInputMessageForwarded = "inputMessageForwarded" + TypeSearchMessagesFilterEmpty = "searchMessagesFilterEmpty" + TypeSearchMessagesFilterAnimation = "searchMessagesFilterAnimation" + TypeSearchMessagesFilterAudio = "searchMessagesFilterAudio" + TypeSearchMessagesFilterDocument = "searchMessagesFilterDocument" + TypeSearchMessagesFilterPhoto = "searchMessagesFilterPhoto" + TypeSearchMessagesFilterVideo = "searchMessagesFilterVideo" + TypeSearchMessagesFilterVoiceNote = "searchMessagesFilterVoiceNote" + TypeSearchMessagesFilterPhotoAndVideo = "searchMessagesFilterPhotoAndVideo" + TypeSearchMessagesFilterUrl = "searchMessagesFilterUrl" + TypeSearchMessagesFilterChatPhoto = "searchMessagesFilterChatPhoto" + TypeSearchMessagesFilterCall = "searchMessagesFilterCall" + TypeSearchMessagesFilterMissedCall = "searchMessagesFilterMissedCall" + TypeSearchMessagesFilterVideoNote = "searchMessagesFilterVideoNote" + TypeSearchMessagesFilterVoiceAndVideoNote = "searchMessagesFilterVoiceAndVideoNote" + TypeSearchMessagesFilterMention = "searchMessagesFilterMention" + TypeSearchMessagesFilterUnreadMention = "searchMessagesFilterUnreadMention" + TypeChatActionTyping = "chatActionTyping" + TypeChatActionRecordingVideo = "chatActionRecordingVideo" + TypeChatActionUploadingVideo = "chatActionUploadingVideo" + TypeChatActionRecordingVoiceNote = "chatActionRecordingVoiceNote" + TypeChatActionUploadingVoiceNote = "chatActionUploadingVoiceNote" + TypeChatActionUploadingPhoto = "chatActionUploadingPhoto" + TypeChatActionUploadingDocument = "chatActionUploadingDocument" + TypeChatActionChoosingLocation = "chatActionChoosingLocation" + TypeChatActionChoosingContact = "chatActionChoosingContact" + TypeChatActionStartPlayingGame = "chatActionStartPlayingGame" + TypeChatActionRecordingVideoNote = "chatActionRecordingVideoNote" + TypeChatActionUploadingVideoNote = "chatActionUploadingVideoNote" + TypeChatActionCancel = "chatActionCancel" + TypeUserStatusEmpty = "userStatusEmpty" + TypeUserStatusOnline = "userStatusOnline" + TypeUserStatusOffline = "userStatusOffline" + TypeUserStatusRecently = "userStatusRecently" + TypeUserStatusLastWeek = "userStatusLastWeek" + TypeUserStatusLastMonth = "userStatusLastMonth" + TypeStickers = "stickers" + TypeStickerEmojis = "stickerEmojis" + TypeStickerSet = "stickerSet" + TypeStickerSetInfo = "stickerSetInfo" + TypeStickerSets = "stickerSets" + TypeCallDiscardReasonEmpty = "callDiscardReasonEmpty" + TypeCallDiscardReasonMissed = "callDiscardReasonMissed" + TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" + TypeCallDiscardReasonDisconnected = "callDiscardReasonDisconnected" + TypeCallDiscardReasonHungUp = "callDiscardReasonHungUp" + TypeCallProtocol = "callProtocol" + TypeCallConnection = "callConnection" + TypeCallId = "callId" + TypeCallStatePending = "callStatePending" + TypeCallStateExchangingKeys = "callStateExchangingKeys" + TypeCallStateReady = "callStateReady" + TypeCallStateHangingUp = "callStateHangingUp" + TypeCallStateDiscarded = "callStateDiscarded" + TypeCallStateError = "callStateError" + TypeCall = "call" + TypeAnimations = "animations" + TypeImportedContacts = "importedContacts" + TypeInputInlineQueryResultAnimatedGif = "inputInlineQueryResultAnimatedGif" + TypeInputInlineQueryResultAnimatedMpeg4 = "inputInlineQueryResultAnimatedMpeg4" + TypeInputInlineQueryResultArticle = "inputInlineQueryResultArticle" + TypeInputInlineQueryResultAudio = "inputInlineQueryResultAudio" + TypeInputInlineQueryResultContact = "inputInlineQueryResultContact" + TypeInputInlineQueryResultDocument = "inputInlineQueryResultDocument" + TypeInputInlineQueryResultGame = "inputInlineQueryResultGame" + TypeInputInlineQueryResultLocation = "inputInlineQueryResultLocation" + TypeInputInlineQueryResultPhoto = "inputInlineQueryResultPhoto" + TypeInputInlineQueryResultSticker = "inputInlineQueryResultSticker" + TypeInputInlineQueryResultVenue = "inputInlineQueryResultVenue" + TypeInputInlineQueryResultVideo = "inputInlineQueryResultVideo" + TypeInputInlineQueryResultVoiceNote = "inputInlineQueryResultVoiceNote" + TypeInlineQueryResultArticle = "inlineQueryResultArticle" + TypeInlineQueryResultContact = "inlineQueryResultContact" + TypeInlineQueryResultLocation = "inlineQueryResultLocation" + TypeInlineQueryResultVenue = "inlineQueryResultVenue" + TypeInlineQueryResultGame = "inlineQueryResultGame" + TypeInlineQueryResultAnimation = "inlineQueryResultAnimation" + TypeInlineQueryResultAudio = "inlineQueryResultAudio" + TypeInlineQueryResultDocument = "inlineQueryResultDocument" + TypeInlineQueryResultPhoto = "inlineQueryResultPhoto" + TypeInlineQueryResultSticker = "inlineQueryResultSticker" + TypeInlineQueryResultVideo = "inlineQueryResultVideo" + TypeInlineQueryResultVoiceNote = "inlineQueryResultVoiceNote" + TypeInlineQueryResults = "inlineQueryResults" + TypeCallbackQueryPayloadData = "callbackQueryPayloadData" + TypeCallbackQueryPayloadGame = "callbackQueryPayloadGame" + TypeCallbackQueryAnswer = "callbackQueryAnswer" + TypeCustomRequestResult = "customRequestResult" + TypeGameHighScore = "gameHighScore" + TypeGameHighScores = "gameHighScores" + TypeChatEventMessageEdited = "chatEventMessageEdited" + TypeChatEventMessageDeleted = "chatEventMessageDeleted" + TypeChatEventMessagePinned = "chatEventMessagePinned" + TypeChatEventMessageUnpinned = "chatEventMessageUnpinned" + TypeChatEventMemberJoined = "chatEventMemberJoined" + TypeChatEventMemberLeft = "chatEventMemberLeft" + TypeChatEventMemberInvited = "chatEventMemberInvited" + TypeChatEventMemberPromoted = "chatEventMemberPromoted" + TypeChatEventMemberRestricted = "chatEventMemberRestricted" + TypeChatEventTitleChanged = "chatEventTitleChanged" + TypeChatEventDescriptionChanged = "chatEventDescriptionChanged" + TypeChatEventUsernameChanged = "chatEventUsernameChanged" + TypeChatEventPhotoChanged = "chatEventPhotoChanged" + TypeChatEventInvitesToggled = "chatEventInvitesToggled" + TypeChatEventSignMessagesToggled = "chatEventSignMessagesToggled" + TypeChatEventStickerSetChanged = "chatEventStickerSetChanged" + TypeChatEventIsAllHistoryAvailableToggled = "chatEventIsAllHistoryAvailableToggled" + TypeChatEvent = "chatEvent" + TypeChatEvents = "chatEvents" + TypeChatEventLogFilters = "chatEventLogFilters" + TypeLanguagePackStringValueOrdinary = "languagePackStringValueOrdinary" + TypeLanguagePackStringValuePluralized = "languagePackStringValuePluralized" + TypeLanguagePackStringValueDeleted = "languagePackStringValueDeleted" + TypeLanguagePackString = "languagePackString" + TypeLanguagePackStrings = "languagePackStrings" + TypeLanguagePackInfo = "languagePackInfo" + TypeLocalizationTargetInfo = "localizationTargetInfo" + TypeDeviceTokenGoogleCloudMessaging = "deviceTokenGoogleCloudMessaging" + TypeDeviceTokenApplePush = "deviceTokenApplePush" + TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" + TypeDeviceTokenWindowsPush = "deviceTokenWindowsPush" + TypeDeviceTokenMicrosoftPush = "deviceTokenMicrosoftPush" + TypeDeviceTokenMicrosoftPushVoIP = "deviceTokenMicrosoftPushVoIP" + TypeDeviceTokenWebPush = "deviceTokenWebPush" + TypeDeviceTokenSimplePush = "deviceTokenSimplePush" + TypeDeviceTokenUbuntuPush = "deviceTokenUbuntuPush" + TypeDeviceTokenBlackBerryPush = "deviceTokenBlackBerryPush" + TypeDeviceTokenTizenPush = "deviceTokenTizenPush" + TypeWallpaper = "wallpaper" + TypeWallpapers = "wallpapers" + TypeHashtags = "hashtags" + TypeCheckChatUsernameResultOk = "checkChatUsernameResultOk" + TypeCheckChatUsernameResultUsernameInvalid = "checkChatUsernameResultUsernameInvalid" + TypeCheckChatUsernameResultUsernameOccupied = "checkChatUsernameResultUsernameOccupied" + TypeCheckChatUsernameResultPublicChatsTooMuch = "checkChatUsernameResultPublicChatsTooMuch" + TypeCheckChatUsernameResultPublicGroupsUnavailable = "checkChatUsernameResultPublicGroupsUnavailable" + TypeOptionValueBoolean = "optionValueBoolean" + TypeOptionValueEmpty = "optionValueEmpty" + TypeOptionValueInteger = "optionValueInteger" + TypeOptionValueString = "optionValueString" + TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll" + TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts" + TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers" + TypeUserPrivacySettingRuleRestrictAll = "userPrivacySettingRuleRestrictAll" + TypeUserPrivacySettingRuleRestrictContacts = "userPrivacySettingRuleRestrictContacts" + TypeUserPrivacySettingRuleRestrictUsers = "userPrivacySettingRuleRestrictUsers" + TypeUserPrivacySettingRules = "userPrivacySettingRules" + TypeUserPrivacySettingShowStatus = "userPrivacySettingShowStatus" + TypeUserPrivacySettingAllowChatInvites = "userPrivacySettingAllowChatInvites" + TypeUserPrivacySettingAllowCalls = "userPrivacySettingAllowCalls" + TypeAccountTtl = "accountTtl" + TypeSession = "session" + TypeSessions = "sessions" + TypeConnectedWebsite = "connectedWebsite" + TypeConnectedWebsites = "connectedWebsites" + TypeChatReportSpamState = "chatReportSpamState" + TypeChatReportReasonSpam = "chatReportReasonSpam" + TypeChatReportReasonViolence = "chatReportReasonViolence" + TypeChatReportReasonPornography = "chatReportReasonPornography" + TypeChatReportReasonCopyright = "chatReportReasonCopyright" + TypeChatReportReasonCustom = "chatReportReasonCustom" + TypePublicMessageLink = "publicMessageLink" + 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" + TypeNetworkTypeNone = "networkTypeNone" + TypeNetworkTypeMobile = "networkTypeMobile" + TypeNetworkTypeMobileRoaming = "networkTypeMobileRoaming" + TypeNetworkTypeWiFi = "networkTypeWiFi" + TypeNetworkTypeOther = "networkTypeOther" + TypeNetworkStatisticsEntryFile = "networkStatisticsEntryFile" + TypeNetworkStatisticsEntryCall = "networkStatisticsEntryCall" + TypeNetworkStatistics = "networkStatistics" + TypeConnectionStateWaitingForNetwork = "connectionStateWaitingForNetwork" + TypeConnectionStateConnectingToProxy = "connectionStateConnectingToProxy" + TypeConnectionStateConnecting = "connectionStateConnecting" + TypeConnectionStateUpdating = "connectionStateUpdating" + TypeConnectionStateReady = "connectionStateReady" + TypeTopChatCategoryUsers = "topChatCategoryUsers" + TypeTopChatCategoryBots = "topChatCategoryBots" + TypeTopChatCategoryGroups = "topChatCategoryGroups" + TypeTopChatCategoryChannels = "topChatCategoryChannels" + TypeTopChatCategoryInlineBots = "topChatCategoryInlineBots" + TypeTopChatCategoryCalls = "topChatCategoryCalls" + TypeTMeUrlTypeUser = "tMeUrlTypeUser" + TypeTMeUrlTypeSupergroup = "tMeUrlTypeSupergroup" + TypeTMeUrlTypeChatInvite = "tMeUrlTypeChatInvite" + TypeTMeUrlTypeStickerSet = "tMeUrlTypeStickerSet" + TypeTMeUrl = "tMeUrl" + TypeTMeUrls = "tMeUrls" + TypeCount = "count" + TypeText = "text" + TypeSeconds = "seconds" + TypeDeepLinkInfo = "deepLinkInfo" + TypeTextParseModeMarkdown = "textParseModeMarkdown" + TypeTextParseModeHTML = "textParseModeHTML" + TypeProxyTypeSocks5 = "proxyTypeSocks5" + TypeProxyTypeHttp = "proxyTypeHttp" + TypeProxyTypeMtproto = "proxyTypeMtproto" + TypeProxy = "proxy" + TypeProxies = "proxies" + TypeInputSticker = "inputSticker" + TypeUpdateAuthorizationState = "updateAuthorizationState" + TypeUpdateNewMessage = "updateNewMessage" + TypeUpdateMessageSendAcknowledged = "updateMessageSendAcknowledged" + TypeUpdateMessageSendSucceeded = "updateMessageSendSucceeded" + TypeUpdateMessageSendFailed = "updateMessageSendFailed" + TypeUpdateMessageContent = "updateMessageContent" + TypeUpdateMessageEdited = "updateMessageEdited" + TypeUpdateMessageViews = "updateMessageViews" + TypeUpdateMessageContentOpened = "updateMessageContentOpened" + TypeUpdateMessageMentionRead = "updateMessageMentionRead" + TypeUpdateNewChat = "updateNewChat" + TypeUpdateChatTitle = "updateChatTitle" + TypeUpdateChatPhoto = "updateChatPhoto" + TypeUpdateChatLastMessage = "updateChatLastMessage" + TypeUpdateChatOrder = "updateChatOrder" + TypeUpdateChatIsPinned = "updateChatIsPinned" + TypeUpdateChatIsMarkedAsUnread = "updateChatIsMarkedAsUnread" + TypeUpdateChatIsSponsored = "updateChatIsSponsored" + TypeUpdateChatDefaultDisableNotification = "updateChatDefaultDisableNotification" + TypeUpdateChatReadInbox = "updateChatReadInbox" + TypeUpdateChatReadOutbox = "updateChatReadOutbox" + TypeUpdateChatUnreadMentionCount = "updateChatUnreadMentionCount" + TypeUpdateChatNotificationSettings = "updateChatNotificationSettings" + TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" + TypeUpdateChatReplyMarkup = "updateChatReplyMarkup" + TypeUpdateChatDraftMessage = "updateChatDraftMessage" + TypeUpdateDeleteMessages = "updateDeleteMessages" + TypeUpdateUserChatAction = "updateUserChatAction" + TypeUpdateUserStatus = "updateUserStatus" + TypeUpdateUser = "updateUser" + TypeUpdateBasicGroup = "updateBasicGroup" + TypeUpdateSupergroup = "updateSupergroup" + TypeUpdateSecretChat = "updateSecretChat" + TypeUpdateUserFullInfo = "updateUserFullInfo" + TypeUpdateBasicGroupFullInfo = "updateBasicGroupFullInfo" + TypeUpdateSupergroupFullInfo = "updateSupergroupFullInfo" + TypeUpdateServiceNotification = "updateServiceNotification" + TypeUpdateFile = "updateFile" + TypeUpdateFileGenerationStart = "updateFileGenerationStart" + TypeUpdateFileGenerationStop = "updateFileGenerationStop" + TypeUpdateCall = "updateCall" + TypeUpdateUserPrivacySettingRules = "updateUserPrivacySettingRules" + TypeUpdateUnreadMessageCount = "updateUnreadMessageCount" + TypeUpdateUnreadChatCount = "updateUnreadChatCount" + TypeUpdateOption = "updateOption" + TypeUpdateInstalledStickerSets = "updateInstalledStickerSets" + TypeUpdateTrendingStickerSets = "updateTrendingStickerSets" + TypeUpdateRecentStickers = "updateRecentStickers" + TypeUpdateFavoriteStickers = "updateFavoriteStickers" + TypeUpdateSavedAnimations = "updateSavedAnimations" + TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" + TypeUpdateConnectionState = "updateConnectionState" + TypeUpdateTermsOfService = "updateTermsOfService" + TypeUpdateNewInlineQuery = "updateNewInlineQuery" + TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult" + TypeUpdateNewCallbackQuery = "updateNewCallbackQuery" + TypeUpdateNewInlineCallbackQuery = "updateNewInlineCallbackQuery" + TypeUpdateNewShippingQuery = "updateNewShippingQuery" + TypeUpdateNewPreCheckoutQuery = "updateNewPreCheckoutQuery" + TypeUpdateNewCustomEvent = "updateNewCustomEvent" + TypeUpdateNewCustomQuery = "updateNewCustomQuery" + 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 + AuthenticationCodeTypeType() string } // Represents the current authorization state of the client type AuthorizationState interface { - AuthorizationStateType() string + AuthorizationStateType() string } // Points to a file type InputFile interface { - InputFileType() string + InputFileType() string } // Part of the face, relative to which a mask should be placed type MaskPoint interface { - MaskPointType() string + MaskPointType() string } // Represents the relationship between user A and user B. For incoming_link, user A is the current user; for outgoing_link, user B is the current user type LinkState interface { - LinkStateType() string + LinkStateType() string } // Represents the type of the user. The following types are possible: regular users, deleted users and bots type UserType interface { - UserTypeType() string + UserTypeType() string } // Provides information about the status of a member in a chat type ChatMemberStatus interface { - ChatMemberStatusType() string + ChatMemberStatusType() string } // Specifies the kind of chat members to return in searchChatMembers type ChatMembersFilter interface { - ChatMembersFilterType() string + ChatMembersFilterType() string } // Specifies the kind of chat members to return in getSupergroupMembers type SupergroupMembersFilter interface { - SupergroupMembersFilterType() string + SupergroupMembersFilterType() string } // Describes the current secret chat state type SecretChatState interface { - SecretChatStateType() string + SecretChatStateType() string } // Contains information about the initial sender of a forwarded message type MessageForwardInfo interface { - MessageForwardInfoType() string + MessageForwardInfoType() string } // Contains information about the sending state of the message type MessageSendingState interface { - MessageSendingStateType() string + MessageSendingStateType() string } // Describes the types of chats to which notification settings are applied type NotificationSettingsScope interface { - NotificationSettingsScopeType() string + NotificationSettingsScopeType() string } // Describes the type of a chat type ChatType interface { - ChatTypeType() string + ChatTypeType() string } // Describes a keyboard button type type KeyboardButtonType interface { - KeyboardButtonTypeType() string + KeyboardButtonTypeType() string } // Describes the type of an inline keyboard button type InlineKeyboardButtonType interface { - InlineKeyboardButtonTypeType() string + 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 + ReplyMarkupType() string } // Describes a text object inside an instant-view web page type RichText interface { - RichTextType() string + RichTextType() string } // Describes a block of an instant view web page type PageBlock interface { - PageBlockType() string + PageBlockType() string } // Contains information about the payment method chosen by the user type InputCredentials interface { - InputCredentialsType() string + InputCredentialsType() string } // Contains the type of a Telegram Passport element type PassportElementType interface { - PassportElementTypeType() string + PassportElementTypeType() string } // Contains information about a Telegram Passport element type PassportElement interface { - PassportElementType() string + PassportElementType() string } // Contains information about a Telegram Passport element to be saved type InputPassportElement interface { - InputPassportElementType() string + InputPassportElementType() string } // Contains the description of an error in a Telegram Passport element type PassportElementErrorSource interface { - PassportElementErrorSourceType() string + PassportElementErrorSourceType() string } // Contains the description of an error in a Telegram Passport element; for bots only type InputPassportElementErrorSource interface { - InputPassportElementErrorSourceType() string + InputPassportElementErrorSourceType() string } // Contains the content of a message type MessageContent interface { - MessageContentType() string + MessageContentType() string } // Represents a part of the text which must be formatted differently type TextEntityType interface { - TextEntityTypeType() string + TextEntityTypeType() string } // The content of a message to send type InputMessageContent interface { - InputMessageContentType() string + InputMessageContentType() string } // Represents a filter for message search results type SearchMessagesFilter interface { - SearchMessagesFilterType() string + SearchMessagesFilterType() string } // Describes the different types of activity in a chat type ChatAction interface { - ChatActionType() string + ChatActionType() string } // Describes the last time the user was online type UserStatus interface { - UserStatusType() string + UserStatusType() string } // Describes the reason why a call was discarded type CallDiscardReason interface { - CallDiscardReasonType() string + CallDiscardReasonType() string } // Describes the current call state type CallState interface { - CallStateType() string + CallStateType() string } // Represents a single result of an inline query; for bots only type InputInlineQueryResult interface { - InputInlineQueryResultType() string + InputInlineQueryResultType() string } // Represents a single result of an inline query type InlineQueryResult interface { - InlineQueryResultType() string + InlineQueryResultType() string } // Represents a payload of a callback query type CallbackQueryPayload interface { - CallbackQueryPayloadType() string + CallbackQueryPayloadType() string } // Represents a chat event type ChatEventAction interface { - ChatEventActionType() string + ChatEventActionType() string } // Represents the value of a string in a language pack type LanguagePackStringValue interface { - LanguagePackStringValueType() string + LanguagePackStringValueType() string } // Represents a data needed to subscribe for push notifications. To use specific push notification service, you must specify the correct application platform and upload valid server authentication data at https://my.telegram.org type DeviceToken interface { - DeviceTokenType() string + DeviceTokenType() string } // Represents result of checking whether a username can be set for a chat type CheckChatUsernameResult interface { - CheckChatUsernameResultType() string + CheckChatUsernameResultType() string } // Represents the value of an option type OptionValue interface { - OptionValueType() string + OptionValueType() string } // Represents a single rule for managing privacy settings type UserPrivacySettingRule interface { - UserPrivacySettingRuleType() string + UserPrivacySettingRuleType() string } // Describes available user privacy settings type UserPrivacySetting interface { - UserPrivacySettingType() string + UserPrivacySettingType() string } // Describes the reason why a chat is reported type ChatReportReason interface { - ChatReportReasonType() string + ChatReportReasonType() string } // Represents the type of a file type FileType interface { - FileTypeType() string + FileTypeType() string } // Represents the type of a network type NetworkType interface { - NetworkTypeType() string + NetworkTypeType() string } // Contains statistics about network usage type NetworkStatisticsEntry interface { - NetworkStatisticsEntryType() string + NetworkStatisticsEntryType() string } // Describes the current state of the connection to Telegram servers type ConnectionState interface { - ConnectionStateType() string + ConnectionStateType() string } // Represents the categories of chats for which a list of frequently used chats can be retrieved type TopChatCategory interface { - TopChatCategoryType() string + TopChatCategoryType() string } // Describes the type of a URL linking to an internal Telegram entity type TMeUrlType interface { - TMeUrlTypeType() string + TMeUrlTypeType() string } // Describes the way the text should be parsed for TextEntities type TextParseMode interface { - TextParseModeType() string + TextParseModeType() string } // Describes the type of the proxy server type ProxyType interface { - ProxyTypeType() string + ProxyTypeType() string } // Contains notifications about data changes type Update interface { - UpdateType() string + UpdateType() 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"` + 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() + entity.meta.Type = entity.GetType() - type stub Error + type stub Error - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Error) GetClass() string { - return ClassError + return ClassError } func (*Error) GetType() string { - return TypeError + return TypeError } // An object of this type is returned on a successful function call for certain functions -type Ok struct{ - meta +type Ok struct { + meta } func (entity *Ok) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Ok + type stub Ok - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Ok) GetClass() string { - return ClassOk + return ClassOk } func (*Ok) GetType() string { - return TypeOk + 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; must be non-empty - SystemVersion string `json:"system_version"` - // Application version; must be non-empty - ApplicationVersion string `json:"application_version"` - // If set to true, old files will automatically be deleted - EnableStorageOptimizer bool `json:"enable_storage_optimizer"` - // If set to true, original file names will be ignored. Otherwise, downloaded files will be saved under names as close as possible to the original name - IgnoreFileNames bool `json:"ignore_file_names"` + meta + // If set to true, the Telegram test environment will be used instead of the production environment + UseTestDc bool `json:"use_test_dc"` + // The path to the directory for the persistent database; if empty, the current working directory will be used + DatabaseDirectory string `json:"database_directory"` + // The path to the directory for storing files; if empty, database_directory will be used + FilesDirectory string `json:"files_directory"` + // If set to true, information about downloaded and uploaded files will be saved between application restarts + UseFileDatabase bool `json:"use_file_database"` + // If set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. Implies use_file_database + UseChatInfoDatabase bool `json:"use_chat_info_database"` + // If set to true, the library will maintain a cache of chats and messages. Implies use_chat_info_database + UseMessageDatabase bool `json:"use_message_database"` + // If set to true, support for secret chats will be enabled + UseSecretChats bool `json:"use_secret_chats"` + // Application identifier for Telegram API access, which can be obtained at https://my.telegram.org + ApiId int32 `json:"api_id"` + // Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org + ApiHash string `json:"api_hash"` + // IETF language tag of the user's operating system language; must be non-empty + SystemLanguageCode string `json:"system_language_code"` + // Model of the device the application is being run on; must be non-empty + DeviceModel string `json:"device_model"` + // Version of the operating system the application is being run on; must be non-empty + SystemVersion string `json:"system_version"` + // Application version; must be non-empty + ApplicationVersion string `json:"application_version"` + // If set to true, old files will automatically be deleted + EnableStorageOptimizer bool `json:"enable_storage_optimizer"` + // If set to true, original file names will be ignored. Otherwise, downloaded files will be saved under names as close as possible to the original name + IgnoreFileNames bool `json:"ignore_file_names"` } func (entity *TdlibParameters) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TdlibParameters + type stub TdlibParameters - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TdlibParameters) GetClass() string { - return ClassTdlibParameters + return ClassTdlibParameters } func (*TdlibParameters) GetType() string { - return TypeTdlibParameters + return TypeTdlibParameters } // An authentication code is delivered via a private Telegram message, which can be viewed in another client type AuthenticationCodeTypeTelegramMessage struct { - meta - // Length of the code - Length int32 `json:"length"` + meta + // Length of the code + Length int32 `json:"length"` } func (entity *AuthenticationCodeTypeTelegramMessage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthenticationCodeTypeTelegramMessage + type stub AuthenticationCodeTypeTelegramMessage - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthenticationCodeTypeTelegramMessage) GetClass() string { - return ClassAuthenticationCodeType + return ClassAuthenticationCodeType } func (*AuthenticationCodeTypeTelegramMessage) GetType() string { - return TypeAuthenticationCodeTypeTelegramMessage + return TypeAuthenticationCodeTypeTelegramMessage } func (*AuthenticationCodeTypeTelegramMessage) AuthenticationCodeTypeType() string { - return TypeAuthenticationCodeTypeTelegramMessage + 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"` + meta + // Length of the code + Length int32 `json:"length"` } func (entity *AuthenticationCodeTypeSms) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthenticationCodeTypeSms + type stub AuthenticationCodeTypeSms - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthenticationCodeTypeSms) GetClass() string { - return ClassAuthenticationCodeType + return ClassAuthenticationCodeType } func (*AuthenticationCodeTypeSms) GetType() string { - return TypeAuthenticationCodeTypeSms + return TypeAuthenticationCodeTypeSms } func (*AuthenticationCodeTypeSms) AuthenticationCodeTypeType() string { - return TypeAuthenticationCodeTypeSms + 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"` + meta + // Length of the code + Length int32 `json:"length"` } func (entity *AuthenticationCodeTypeCall) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthenticationCodeTypeCall + type stub AuthenticationCodeTypeCall - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthenticationCodeTypeCall) GetClass() string { - return ClassAuthenticationCodeType + return ClassAuthenticationCodeType } func (*AuthenticationCodeTypeCall) GetType() string { - return TypeAuthenticationCodeTypeCall + return TypeAuthenticationCodeTypeCall } func (*AuthenticationCodeTypeCall) AuthenticationCodeTypeType() string { - return TypeAuthenticationCodeTypeCall + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub AuthenticationCodeTypeFlashCall + type stub AuthenticationCodeTypeFlashCall - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthenticationCodeTypeFlashCall) GetClass() string { - return ClassAuthenticationCodeType + return ClassAuthenticationCodeType } func (*AuthenticationCodeTypeFlashCall) GetType() string { - return TypeAuthenticationCodeTypeFlashCall + return TypeAuthenticationCodeTypeFlashCall } func (*AuthenticationCodeTypeFlashCall) AuthenticationCodeTypeType() string { - return TypeAuthenticationCodeTypeFlashCall + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub AuthenticationCodeInfo + type stub AuthenticationCodeInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthenticationCodeInfo) GetClass() string { - return ClassAuthenticationCodeInfo + return ClassAuthenticationCodeInfo } func (*AuthenticationCodeInfo) GetType() string { - return TypeAuthenticationCodeInfo + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - authenticationCodeInfo.PhoneNumber = tmp.PhoneNumber - authenticationCodeInfo.Timeout = tmp.Timeout + authenticationCodeInfo.PhoneNumber = tmp.PhoneNumber + authenticationCodeInfo.Timeout = tmp.Timeout - fieldType, _ := UnmarshalAuthenticationCodeType(tmp.Type) - authenticationCodeInfo.Type = fieldType + fieldType, _ := UnmarshalAuthenticationCodeType(tmp.Type) + authenticationCodeInfo.Type = fieldType - fieldNextType, _ := UnmarshalAuthenticationCodeType(tmp.NextType) - authenticationCodeInfo.NextType = fieldNextType + fieldNextType, _ := UnmarshalAuthenticationCodeType(tmp.NextType) + authenticationCodeInfo.NextType = fieldNextType - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub EmailAddressAuthenticationCodeInfo + type stub EmailAddressAuthenticationCodeInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*EmailAddressAuthenticationCodeInfo) GetClass() string { - return ClassEmailAddressAuthenticationCodeInfo + return ClassEmailAddressAuthenticationCodeInfo } func (*EmailAddressAuthenticationCodeInfo) GetType() string { - return TypeEmailAddressAuthenticationCodeInfo + 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 points - Offset int32 `json:"offset"` - // Length of the entity, in UTF-16 code points - Length int32 `json:"length"` - // Type of the entity - Type TextEntityType `json:"type"` + meta + // Offset of the entity in UTF-16 code points + Offset int32 `json:"offset"` + // Length of the entity, in UTF-16 code points + Length int32 `json:"length"` + // Type of the entity + Type TextEntityType `json:"type"` } func (entity *TextEntity) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntity + type stub TextEntity - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntity) GetClass() string { - return ClassTextEntity + return ClassTextEntity } func (*TextEntity) GetType() string { - return TypeTextEntity + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - textEntity.Offset = tmp.Offset - textEntity.Length = tmp.Length + textEntity.Offset = tmp.Offset + textEntity.Length = tmp.Length - fieldType, _ := UnmarshalTextEntityType(tmp.Type) - textEntity.Type = fieldType + fieldType, _ := UnmarshalTextEntityType(tmp.Type) + textEntity.Type = fieldType - return nil + return nil } // Contains a list of text entities type TextEntities struct { - meta - // List of text entities - Entities []*TextEntity `json:"entities"` + meta + // List of text entities + Entities []*TextEntity `json:"entities"` } func (entity *TextEntities) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntities + type stub TextEntities - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntities) GetClass() string { - return ClassTextEntities + return ClassTextEntities } func (*TextEntities) GetType() string { - return TypeTextEntities + return TypeTextEntities } // A text with some entities type FormattedText struct { - meta - // The text - Text string `json:"text"` - // Entities contained in the text - Entities []*TextEntity `json:"entities"` + meta + // The text + Text string `json:"text"` + // Entities contained in the text + Entities []*TextEntity `json:"entities"` } func (entity *FormattedText) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FormattedText + type stub FormattedText - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FormattedText) GetClass() string { - return ClassFormattedText + return ClassFormattedText } func (*FormattedText) GetType() string { - return TypeFormattedText + return TypeFormattedText } // Contains Telegram terms of service type TermsOfService struct { - meta - // Text of the terms of service - Text *FormattedText `json:"text"` - // Mininum 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"` + meta + // Text of the terms of service + Text *FormattedText `json:"text"` + // Mininum 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() + entity.meta.Type = entity.GetType() - type stub TermsOfService + type stub TermsOfService - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TermsOfService) GetClass() string { - return ClassTermsOfService + return ClassTermsOfService } func (*TermsOfService) GetType() string { - return TypeTermsOfService + return TypeTermsOfService } // TDLib needs TdlibParameters for initialization -type AuthorizationStateWaitTdlibParameters struct{ - meta +type AuthorizationStateWaitTdlibParameters struct { + meta } func (entity *AuthorizationStateWaitTdlibParameters) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitTdlibParameters + type stub AuthorizationStateWaitTdlibParameters - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitTdlibParameters) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitTdlibParameters) GetType() string { - return TypeAuthorizationStateWaitTdlibParameters + return TypeAuthorizationStateWaitTdlibParameters } func (*AuthorizationStateWaitTdlibParameters) AuthorizationStateType() string { - return TypeAuthorizationStateWaitTdlibParameters + 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"` + meta + // True, if the database is currently encrypted + IsEncrypted bool `json:"is_encrypted"` } func (entity *AuthorizationStateWaitEncryptionKey) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitEncryptionKey + type stub AuthorizationStateWaitEncryptionKey - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitEncryptionKey) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitEncryptionKey) GetType() string { - return TypeAuthorizationStateWaitEncryptionKey + return TypeAuthorizationStateWaitEncryptionKey } func (*AuthorizationStateWaitEncryptionKey) AuthorizationStateType() string { - return TypeAuthorizationStateWaitEncryptionKey + return TypeAuthorizationStateWaitEncryptionKey } // TDLib needs the user's phone number to authorize -type AuthorizationStateWaitPhoneNumber struct{ - meta +type AuthorizationStateWaitPhoneNumber struct { + meta } func (entity *AuthorizationStateWaitPhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitPhoneNumber + type stub AuthorizationStateWaitPhoneNumber - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitPhoneNumber) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitPhoneNumber) GetType() string { - return TypeAuthorizationStateWaitPhoneNumber + return TypeAuthorizationStateWaitPhoneNumber } func (*AuthorizationStateWaitPhoneNumber) AuthorizationStateType() string { - return TypeAuthorizationStateWaitPhoneNumber + return TypeAuthorizationStateWaitPhoneNumber } // TDLib needs the user's authentication code to finalize authorization type AuthorizationStateWaitCode struct { - meta - // True, if the user is already registered - IsRegistered bool `json:"is_registered"` - // Telegram terms of service, which should be accepted before user can continue registration; may be null - TermsOfService *TermsOfService `json:"terms_of_service"` - // Information about the authorization code that was sent - CodeInfo *AuthenticationCodeInfo `json:"code_info"` + meta + // True, if the user is already registered + IsRegistered bool `json:"is_registered"` + // Telegram terms of service, which should be accepted before user can continue registration; may be null + TermsOfService *TermsOfService `json:"terms_of_service"` + // Information about the authorization code that was sent + CodeInfo *AuthenticationCodeInfo `json:"code_info"` } func (entity *AuthorizationStateWaitCode) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitCode + type stub AuthorizationStateWaitCode - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitCode) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitCode) GetType() string { - return TypeAuthorizationStateWaitCode + return TypeAuthorizationStateWaitCode } func (*AuthorizationStateWaitCode) AuthorizationStateType() string { - return TypeAuthorizationStateWaitCode + return TypeAuthorizationStateWaitCode } // The user has been authorized, but needs to enter a password to start using the application type AuthorizationStateWaitPassword struct { - meta - // Hint for the password; can 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"` + meta + // Hint for the password; can 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() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitPassword + type stub AuthorizationStateWaitPassword - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitPassword) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitPassword) GetType() string { - return TypeAuthorizationStateWaitPassword + return TypeAuthorizationStateWaitPassword } func (*AuthorizationStateWaitPassword) AuthorizationStateType() string { - return TypeAuthorizationStateWaitPassword + return TypeAuthorizationStateWaitPassword } // The user has been successfully authorized. TDLib is now ready to answer queries -type AuthorizationStateReady struct{ - meta +type AuthorizationStateReady struct { + meta } func (entity *AuthorizationStateReady) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateReady + type stub AuthorizationStateReady - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateReady) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateReady) GetType() string { - return TypeAuthorizationStateReady + return TypeAuthorizationStateReady } func (*AuthorizationStateReady) AuthorizationStateType() string { - return TypeAuthorizationStateReady + return TypeAuthorizationStateReady } // The user is currently logging out -type AuthorizationStateLoggingOut struct{ - meta +type AuthorizationStateLoggingOut struct { + meta } func (entity *AuthorizationStateLoggingOut) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateLoggingOut + type stub AuthorizationStateLoggingOut - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateLoggingOut) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateLoggingOut) GetType() string { - return TypeAuthorizationStateLoggingOut + return TypeAuthorizationStateLoggingOut } func (*AuthorizationStateLoggingOut) AuthorizationStateType() string { - return TypeAuthorizationStateLoggingOut + 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 +type AuthorizationStateClosing struct { + meta } func (entity *AuthorizationStateClosing) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateClosing + type stub AuthorizationStateClosing - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateClosing) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateClosing) GetType() string { - return TypeAuthorizationStateClosing + return TypeAuthorizationStateClosing } func (*AuthorizationStateClosing) AuthorizationStateType() string { - return TypeAuthorizationStateClosing + 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 +type AuthorizationStateClosed struct { + meta } func (entity *AuthorizationStateClosed) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateClosed + type stub AuthorizationStateClosed - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateClosed) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateClosed) GetType() string { - return TypeAuthorizationStateClosed + return TypeAuthorizationStateClosed } func (*AuthorizationStateClosed) AuthorizationStateType() string { - return TypeAuthorizationStateClosed + 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; can 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"` - // Pattern of the email address to which the confirmation email was sent - UnconfirmedRecoveryEmailAddressPattern string `json:"unconfirmed_recovery_email_address_pattern"` + meta + // True if a 2-step verification password is set + HasPassword bool `json:"has_password"` + // Hint for the password; can 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"` + // Pattern of the email address to which the confirmation email was sent + UnconfirmedRecoveryEmailAddressPattern string `json:"unconfirmed_recovery_email_address_pattern"` } func (entity *PasswordState) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PasswordState + type stub PasswordState - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PasswordState) GetClass() string { - return ClassPasswordState + return ClassPasswordState } func (*PasswordState) GetType() string { - return TypePasswordState + return TypePasswordState } // Contains information about the current recovery email address type RecoveryEmailAddress struct { - meta - // Recovery email address - RecoveryEmailAddress string `json:"recovery_email_address"` + meta + // Recovery email address + RecoveryEmailAddress string `json:"recovery_email_address"` } func (entity *RecoveryEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RecoveryEmailAddress + type stub RecoveryEmailAddress - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RecoveryEmailAddress) GetClass() string { - return ClassRecoveryEmailAddress + return ClassRecoveryEmailAddress } func (*RecoveryEmailAddress) GetType() string { - return TypeRecoveryEmailAddress + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub TemporaryPasswordState + type stub TemporaryPasswordState - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TemporaryPasswordState) GetClass() string { - return ClassTemporaryPasswordState + return ClassTemporaryPasswordState } func (*TemporaryPasswordState) GetType() string { - return TypeTemporaryPasswordState + 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"` - // If is_downloading_completed is false, then only some prefix of the file 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"` + 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"` + // If is_downloading_completed is false, then only some prefix of the file 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() + entity.meta.Type = entity.GetType() - type stub LocalFile + type stub LocalFile - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LocalFile) GetClass() string { - return ClassLocalFile + return ClassLocalFile } func (*LocalFile) GetType() string { - return TypeLocalFile + return TypeLocalFile } // Represents a remote file type RemoteFile struct { - meta - // Remote file identifier; may be empty. Can be used across application restarts or even from other devices for the current user. If the ID starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. If downloadFile is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the client with the HTTP URL in the original_path and "#url#" as the conversion string. Clients should generate the file by downloading it to the specified location - Id string `json:"id"` - // True, if the file is currently being uploaded (or a remote copy is being generated by some other means) - IsUploadingActive bool `json:"is_uploading_active"` - // True, if a remote copy is fully available - IsUploadingCompleted bool `json:"is_uploading_completed"` - // Size of the remote available part of the file; 0 if unknown - UploadedSize int32 `json:"uploaded_size"` + meta + // Remote file identifier; may be empty. Can be used across application restarts or even from other devices for the current user. If the ID starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. If downloadFile is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the client with the HTTP URL in the original_path and "#url#" as the conversion string. Clients should generate the file by downloading it to the specified location + Id string `json:"id"` + // True, if the file is currently being uploaded (or a remote copy is being generated by some other means) + IsUploadingActive bool `json:"is_uploading_active"` + // True, if a remote copy is fully available + IsUploadingCompleted bool `json:"is_uploading_completed"` + // Size of the remote available part of the file; 0 if unknown + UploadedSize int32 `json:"uploaded_size"` } func (entity *RemoteFile) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RemoteFile + type stub RemoteFile - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RemoteFile) GetClass() string { - return ClassRemoteFile + return ClassRemoteFile } func (*RemoteFile) GetType() string { - return TypeRemoteFile + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub File + type stub File - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*File) GetClass() string { - return ClassFile + return ClassFile } func (*File) GetType() string { - return TypeFile + return TypeFile } // A file defined by its unique ID type InputFileId struct { - meta - // Unique file identifier - Id int32 `json:"id"` + meta + // Unique file identifier + Id int32 `json:"id"` } func (entity *InputFileId) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputFileId + type stub InputFileId - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputFileId) GetClass() string { - return ClassInputFile + return ClassInputFile } func (*InputFileId) GetType() string { - return TypeInputFileId + return TypeInputFileId } func (*InputFileId) InputFileType() string { - return TypeInputFileId + return TypeInputFileId } // A file defined by its remote ID type InputFileRemote struct { - meta - // Remote file identifier - Id string `json:"id"` + meta + // Remote file identifier + Id string `json:"id"` } func (entity *InputFileRemote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputFileRemote + type stub InputFileRemote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputFileRemote) GetClass() string { - return ClassInputFile + return ClassInputFile } func (*InputFileRemote) GetType() string { - return TypeInputFileRemote + return TypeInputFileRemote } func (*InputFileRemote) InputFileType() string { - return TypeInputFileRemote + return TypeInputFileRemote } // A file defined by a local path type InputFileLocal struct { - meta - // Local path to the file - Path string `json:"path"` + meta + // Local path to the file + Path string `json:"path"` } func (entity *InputFileLocal) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputFileLocal + type stub InputFileLocal - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputFileLocal) GetClass() string { - return ClassInputFile + return ClassInputFile } func (*InputFileLocal) GetType() string { - return TypeInputFileLocal + return TypeInputFileLocal } func (*InputFileLocal) InputFileType() string { - return TypeInputFileLocal + return TypeInputFileLocal } // A file generated by the client 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 - Conversion string `json:"conversion"` - // Expected size of the generated file; 0 if unknown - ExpectedSize int32 `json:"expected_size"` + 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 + 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() + entity.meta.Type = entity.GetType() - type stub InputFileGenerated + type stub InputFileGenerated - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputFileGenerated) GetClass() string { - return ClassInputFile + return ClassInputFile } func (*InputFileGenerated) GetType() string { - return TypeInputFileGenerated + return TypeInputFileGenerated } func (*InputFileGenerated) InputFileType() string { - return TypeInputFileGenerated + return TypeInputFileGenerated } // Photo description type PhotoSize struct { - meta - // Thumbnail type (see https://core.telegram.org/constructor/photoSize) - Type string `json:"type"` - // Information about the photo file - Photo *File `json:"photo"` - // Photo width - Width int32 `json:"width"` - // Photo height - Height int32 `json:"height"` + meta + // Thumbnail type (see https://core.telegram.org/constructor/photoSize) + Type string `json:"type"` + // Information about the photo file + Photo *File `json:"photo"` + // Photo width + Width int32 `json:"width"` + // Photo height + Height int32 `json:"height"` } func (entity *PhotoSize) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PhotoSize + type stub PhotoSize - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PhotoSize) GetClass() string { - return ClassPhotoSize + return ClassPhotoSize } func (*PhotoSize) GetType() string { - return TypePhotoSize + return TypePhotoSize } // A mask should be placed relatively to the forehead -type MaskPointForehead struct{ - meta +type MaskPointForehead struct { + meta } func (entity *MaskPointForehead) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MaskPointForehead + type stub MaskPointForehead - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MaskPointForehead) GetClass() string { - return ClassMaskPoint + return ClassMaskPoint } func (*MaskPointForehead) GetType() string { - return TypeMaskPointForehead + return TypeMaskPointForehead } func (*MaskPointForehead) MaskPointType() string { - return TypeMaskPointForehead + return TypeMaskPointForehead } // A mask should be placed relatively to the eyes -type MaskPointEyes struct{ - meta +type MaskPointEyes struct { + meta } func (entity *MaskPointEyes) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MaskPointEyes + type stub MaskPointEyes - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MaskPointEyes) GetClass() string { - return ClassMaskPoint + return ClassMaskPoint } func (*MaskPointEyes) GetType() string { - return TypeMaskPointEyes + return TypeMaskPointEyes } func (*MaskPointEyes) MaskPointType() string { - return TypeMaskPointEyes + return TypeMaskPointEyes } // A mask should be placed relatively to the mouth -type MaskPointMouth struct{ - meta +type MaskPointMouth struct { + meta } func (entity *MaskPointMouth) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MaskPointMouth + type stub MaskPointMouth - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MaskPointMouth) GetClass() string { - return ClassMaskPoint + return ClassMaskPoint } func (*MaskPointMouth) GetType() string { - return TypeMaskPointMouth + return TypeMaskPointMouth } func (*MaskPointMouth) MaskPointType() string { - return TypeMaskPointMouth + return TypeMaskPointMouth } // A mask should be placed relatively to the chin -type MaskPointChin struct{ - meta +type MaskPointChin struct { + meta } func (entity *MaskPointChin) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MaskPointChin + type stub MaskPointChin - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MaskPointChin) GetClass() string { - return ClassMaskPoint + return ClassMaskPoint } func (*MaskPointChin) GetType() string { - return TypeMaskPointChin + return TypeMaskPointChin } func (*MaskPointChin) MaskPointType() string { - return TypeMaskPointChin + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub MaskPosition + type stub MaskPosition - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MaskPosition) GetClass() string { - return ClassMaskPosition + return ClassMaskPosition } func (*MaskPosition) GetType() string { - return TypeMaskPosition + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - maskPosition.XShift = tmp.XShift - maskPosition.YShift = tmp.YShift - maskPosition.Scale = tmp.Scale + maskPosition.XShift = tmp.XShift + maskPosition.YShift = tmp.YShift + maskPosition.Scale = tmp.Scale - fieldPoint, _ := UnmarshalMaskPoint(tmp.Point) - maskPosition.Point = fieldPoint + fieldPoint, _ := UnmarshalMaskPoint(tmp.Point) + maskPosition.Point = fieldPoint - return nil + return nil } // 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"` - // Animation thumbnail; may be null - Thumbnail *PhotoSize `json:"thumbnail"` - // File containing the animation - Animation *File `json:"animation"` + 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"` + // Animation thumbnail; may be null + Thumbnail *PhotoSize `json:"thumbnail"` + // File containing the animation + Animation *File `json:"animation"` } func (entity *Animation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Animation + type stub Animation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Animation) GetClass() string { - return ClassAnimation + return ClassAnimation } func (*Animation) GetType() string { - return TypeAnimation + return TypeAnimation } // Describes an audio file. Audio is usually in MP3 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 thumbnail of the album cover; as defined by the sender. The full size thumbnail should be extracted from the downloaded file; may be null - AlbumCoverThumbnail *PhotoSize `json:"album_cover_thumbnail"` - // File containing the audio - Audio *File `json:"audio"` + 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 thumbnail of the album cover; as defined by the sender. The full size thumbnail should be extracted from the downloaded file; may be null + AlbumCoverThumbnail *PhotoSize `json:"album_cover_thumbnail"` + // File containing the audio + Audio *File `json:"audio"` } func (entity *Audio) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Audio + type stub Audio - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Audio) GetClass() string { - return ClassAudio + return ClassAudio } func (*Audio) GetType() string { - return TypeAudio + 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 thumbnail; as defined by the sender; may be null - Thumbnail *PhotoSize `json:"thumbnail"` - // File containing the document - Document *File `json:"document"` + 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 thumbnail; as defined by the sender; may be null + Thumbnail *PhotoSize `json:"thumbnail"` + // File containing the document + Document *File `json:"document"` } func (entity *Document) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Document + type stub Document - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Document) GetClass() string { - return ClassDocument + return ClassDocument } func (*Document) GetType() string { - return TypeDocument + return TypeDocument } // Describes a photo type Photo struct { - meta - // Photo identifier; 0 for deleted photos - Id JsonInt64 `json:"id"` - // True, if stickers were added to the photo - HasStickers bool `json:"has_stickers"` - // Available variants of the photo, in different sizes - Sizes []*PhotoSize `json:"sizes"` + meta + // Photo identifier; 0 for deleted photos + Id JsonInt64 `json:"id"` + // True, if stickers were added to the photo + HasStickers bool `json:"has_stickers"` + // Available variants of the photo, in different sizes + Sizes []*PhotoSize `json:"sizes"` } func (entity *Photo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Photo + type stub Photo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Photo) GetClass() string { - return ClassPhoto + return ClassPhoto } func (*Photo) GetType() string { - return TypePhoto + 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 a mask - IsMask bool `json:"is_mask"` - // Position where the mask should be placed; may be null - MaskPosition *MaskPosition `json:"mask_position"` - // Sticker thumbnail in WEBP or JPEG format; may be null - Thumbnail *PhotoSize `json:"thumbnail"` - // File containing the sticker - Sticker *File `json:"sticker"` + 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 a mask + IsMask bool `json:"is_mask"` + // Position where the mask should be placed; may be null + MaskPosition *MaskPosition `json:"mask_position"` + // Sticker thumbnail in WEBP or JPEG format; may be null + Thumbnail *PhotoSize `json:"thumbnail"` + // File containing the sticker + Sticker *File `json:"sticker"` } func (entity *Sticker) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Sticker + type stub Sticker - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Sticker) GetClass() string { - return ClassSticker + return ClassSticker } func (*Sticker) GetType() string { - return TypeSticker + 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 photo - HasStickers bool `json:"has_stickers"` - // True, if the video should be tried to be streamed - SupportsStreaming bool `json:"supports_streaming"` - // Video thumbnail; as defined by the sender; may be null - Thumbnail *PhotoSize `json:"thumbnail"` - // File containing the video - Video *File `json:"video"` + meta + // Duration of the video, in seconds; as defined by the sender + Duration int32 `json:"duration"` + // Video width; as defined by the sender + Width int32 `json:"width"` + // Video height; as defined by the sender + Height int32 `json:"height"` + // Original name of the file; as defined by the sender + FileName string `json:"file_name"` + // MIME type of the file; as defined by the sender + MimeType string `json:"mime_type"` + // True, if stickers were added to the photo + HasStickers bool `json:"has_stickers"` + // True, if the video should be tried to be streamed + SupportsStreaming bool `json:"supports_streaming"` + // Video thumbnail; as defined by the sender; may be null + Thumbnail *PhotoSize `json:"thumbnail"` + // File containing the video + Video *File `json:"video"` } func (entity *Video) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Video + type stub Video - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Video) GetClass() string { - return ClassVideo + return ClassVideo } func (*Video) GetType() string { - return TypeVideo + 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 thumbnail; as defined by the sender; may be null - Thumbnail *PhotoSize `json:"thumbnail"` - // File containing the video - Video *File `json:"video"` + 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 thumbnail; as defined by the sender; may be null + Thumbnail *PhotoSize `json:"thumbnail"` + // File containing the video + Video *File `json:"video"` } func (entity *VideoNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub VideoNote + type stub VideoNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*VideoNote) GetClass() string { - return ClassVideoNote + return ClassVideoNote } func (*VideoNote) GetType() string { - return TypeVideoNote + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub VoiceNote + type stub VoiceNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*VoiceNote) GetClass() string { - return ClassVoiceNote + return ClassVoiceNote } func (*VoiceNote) GetType() string { - return TypeVoiceNote + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub Contact + type stub Contact - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Contact) GetClass() string { - return ClassContact + return ClassContact } func (*Contact) GetType() string { - return TypeContact + 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"` + 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"` } func (entity *Location) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Location + type stub Location - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Location) GetClass() string { - return ClassLocation + return ClassLocation } func (*Location) GetType() string { - return TypeLocation + 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" needs to be supported - Provider string `json:"provider"` - // Identifier of the venue in the provider database; as defined by the sender - Id string `json:"id"` - // Type of the venue in the provider database; as defined by the sender - Type string `json:"type"` + meta + // Venue location; as defined by the sender + Location *Location `json:"location"` + // Venue name; as defined by the sender + Title string `json:"title"` + // Venue address; as defined by the sender + Address string `json:"address"` + // Provider of the venue database; as defined by the sender. Currently only "foursquare" needs to be supported + Provider string `json:"provider"` + // Identifier of the venue in the provider database; as defined by the sender + Id string `json:"id"` + // Type of the venue in the provider database; as defined by the sender + Type string `json:"type"` } func (entity *Venue) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Venue + type stub Venue - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Venue) GetClass() string { - return ClassVenue + return ClassVenue } func (*Venue) GetType() string { - return TypeVenue + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub Game + type stub Game - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Game) GetClass() string { - return ClassGame + return ClassGame } func (*Game) GetType() string { - return TypeGame + return TypeGame } // 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 userProfilePhotos - Id JsonInt64 `json:"id"` - // A small (160x160) user profile photo - Small *File `json:"small"` - // A big (640x640) user profile photo - Big *File `json:"big"` + meta + // Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of userProfilePhotos + Id JsonInt64 `json:"id"` + // A small (160x160) user profile photo + Small *File `json:"small"` + // A big (640x640) user profile photo + Big *File `json:"big"` } func (entity *ProfilePhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ProfilePhoto + type stub ProfilePhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ProfilePhoto) GetClass() string { - return ClassProfilePhoto + return ClassProfilePhoto } func (*ProfilePhoto) GetType() string { - return TypeProfilePhoto + return TypeProfilePhoto } // Describes the photo of a chat type ChatPhoto struct { - meta - // A small (160x160) chat photo - Small *File `json:"small"` - // A big (640x640) chat photo - Big *File `json:"big"` + meta + // A small (160x160) chat photo + Small *File `json:"small"` + // A big (640x640) chat photo + Big *File `json:"big"` } func (entity *ChatPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatPhoto + type stub ChatPhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatPhoto) GetClass() string { - return ClassChatPhoto + return ClassChatPhoto } func (*ChatPhoto) GetType() string { - return TypeChatPhoto + return TypeChatPhoto } // The phone number of user A is not known to user B -type LinkStateNone struct{ - meta +type LinkStateNone struct { + meta } func (entity *LinkStateNone) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub LinkStateNone + type stub LinkStateNone - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LinkStateNone) GetClass() string { - return ClassLinkState + return ClassLinkState } func (*LinkStateNone) GetType() string { - return TypeLinkStateNone + return TypeLinkStateNone } func (*LinkStateNone) LinkStateType() string { - return TypeLinkStateNone + return TypeLinkStateNone } // The phone number of user A is known but that number has not been saved to the contacts list of user B -type LinkStateKnowsPhoneNumber struct{ - meta +type LinkStateKnowsPhoneNumber struct { + meta } func (entity *LinkStateKnowsPhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub LinkStateKnowsPhoneNumber + type stub LinkStateKnowsPhoneNumber - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LinkStateKnowsPhoneNumber) GetClass() string { - return ClassLinkState + return ClassLinkState } func (*LinkStateKnowsPhoneNumber) GetType() string { - return TypeLinkStateKnowsPhoneNumber + return TypeLinkStateKnowsPhoneNumber } func (*LinkStateKnowsPhoneNumber) LinkStateType() string { - return TypeLinkStateKnowsPhoneNumber + return TypeLinkStateKnowsPhoneNumber } // The phone number of user A has been saved to the contacts list of user B -type LinkStateIsContact struct{ - meta +type LinkStateIsContact struct { + meta } func (entity *LinkStateIsContact) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub LinkStateIsContact + type stub LinkStateIsContact - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LinkStateIsContact) GetClass() string { - return ClassLinkState + return ClassLinkState } func (*LinkStateIsContact) GetType() string { - return TypeLinkStateIsContact + return TypeLinkStateIsContact } func (*LinkStateIsContact) LinkStateType() string { - return TypeLinkStateIsContact + return TypeLinkStateIsContact } // A regular user -type UserTypeRegular struct{ - meta +type UserTypeRegular struct { + meta } func (entity *UserTypeRegular) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserTypeRegular + type stub UserTypeRegular - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserTypeRegular) GetClass() string { - return ClassUserType + return ClassUserType } func (*UserTypeRegular) GetType() string { - return TypeUserTypeRegular + return TypeUserTypeRegular } func (*UserTypeRegular) UserTypeType() string { - return TypeUserTypeRegular + return TypeUserTypeRegular } // A deleted user or deleted bot. No information on the user besides the user_id is available. It is not possible to perform any active actions on this type of user -type UserTypeDeleted struct{ - meta +type UserTypeDeleted struct { + meta } func (entity *UserTypeDeleted) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserTypeDeleted + type stub UserTypeDeleted - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserTypeDeleted) GetClass() string { - return ClassUserType + return ClassUserType } func (*UserTypeDeleted) GetType() string { - return TypeUserTypeDeleted + return TypeUserTypeDeleted } func (*UserTypeDeleted) UserTypeType() string { - return TypeUserTypeDeleted + 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 client input field) - InlineQueryPlaceholder string `json:"inline_query_placeholder"` - // True, if the location of the user should be sent with every inline query to this bot - NeedLocation bool `json:"need_location"` + meta + // True, if the bot can be invited to basic group and supergroup chats + CanJoinGroups bool `json:"can_join_groups"` + // True, if the bot can read all messages in basic group or supergroup chats and not just those addressed to the bot. In private and channel chats a bot can always read all messages + CanReadAllGroupMessages bool `json:"can_read_all_group_messages"` + // True, if the bot supports inline queries + IsInline bool `json:"is_inline"` + // Placeholder for inline queries (displayed on the client input field) + InlineQueryPlaceholder string `json:"inline_query_placeholder"` + // True, if the location of the user should be sent with every inline query to this bot + NeedLocation bool `json:"need_location"` } func (entity *UserTypeBot) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserTypeBot + type stub UserTypeBot - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserTypeBot) GetClass() string { - return ClassUserType + return ClassUserType } func (*UserTypeBot) GetType() string { - return TypeUserTypeBot + return TypeUserTypeBot } func (*UserTypeBot) UserTypeType() string { - return TypeUserTypeBot + return TypeUserTypeBot } // No information on the user besides the user_id is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type -type UserTypeUnknown struct{ - meta +type UserTypeUnknown struct { + meta } func (entity *UserTypeUnknown) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserTypeUnknown + type stub UserTypeUnknown - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserTypeUnknown) GetClass() string { - return ClassUserType + return ClassUserType } func (*UserTypeUnknown) GetType() string { - return TypeUserTypeUnknown + return TypeUserTypeUnknown } func (*UserTypeUnknown) UserTypeType() string { - return TypeUserTypeUnknown + return TypeUserTypeUnknown } // Represents commands 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"` + 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() + entity.meta.Type = entity.GetType() - type stub BotCommand + type stub BotCommand - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*BotCommand) GetClass() string { - return ClassBotCommand + return ClassBotCommand } func (*BotCommand) GetType() string { - return TypeBotCommand + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub BotInfo + type stub BotInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*BotInfo) GetClass() string { - return ClassBotInfo + return ClassBotInfo } func (*BotInfo) GetType() string { - return TypeBotInfo + return TypeBotInfo } // 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"` - // Relationship from the current user to the other user - OutgoingLink LinkState `json:"outgoing_link"` - // Relationship from the other user to the current user - IncomingLink LinkState `json:"incoming_link"` - // True, if the user is verified - IsVerified bool `json:"is_verified"` - // If non-empty, it contains the reason why access to this user must be restricted. The format of the string is "{type}: {description}". {type} contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user) - RestrictionReason string `json:"restriction_reason"` - // 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"` + meta + // User identifier + Id int32 `json:"id"` + // First name of the user + FirstName string `json:"first_name"` + // Last name of the user + LastName string `json:"last_name"` + // Username of the user + Username string `json:"username"` + // Phone number of the user + PhoneNumber string `json:"phone_number"` + // Current online status of the user + Status UserStatus `json:"status"` + // Profile photo of the user; may be null + ProfilePhoto *ProfilePhoto `json:"profile_photo"` + // Relationship from the current user to the other user + OutgoingLink LinkState `json:"outgoing_link"` + // Relationship from the other user to the current user + IncomingLink LinkState `json:"incoming_link"` + // True, if the user is verified + IsVerified bool `json:"is_verified"` + // If non-empty, it contains the reason why access to this user must be restricted. The format of the string is "{type}: {description}". {type} contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user) + RestrictionReason string `json:"restriction_reason"` + // 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() + entity.meta.Type = entity.GetType() - type stub User + type stub User - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*User) GetClass() string { - return ClassUser + return ClassUser } func (*User) GetType() string { - return TypeUser + 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"` - OutgoingLink json.RawMessage `json:"outgoing_link"` - IncomingLink json.RawMessage `json:"incoming_link"` - IsVerified bool `json:"is_verified"` - RestrictionReason string `json:"restriction_reason"` - HaveAccess bool `json:"have_access"` - Type json.RawMessage `json:"type"` - LanguageCode string `json:"language_code"` - } + var tmp struct { + Id int32 `json:"id"` + FirstName string `json:"first_name"` + LastName string `json:"last_name"` + Username string `json:"username"` + PhoneNumber string `json:"phone_number"` + Status json.RawMessage `json:"status"` + ProfilePhoto *ProfilePhoto `json:"profile_photo"` + OutgoingLink json.RawMessage `json:"outgoing_link"` + IncomingLink json.RawMessage `json:"incoming_link"` + IsVerified bool `json:"is_verified"` + RestrictionReason string `json:"restriction_reason"` + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - user.Id = tmp.Id - user.FirstName = tmp.FirstName - user.LastName = tmp.LastName - user.Username = tmp.Username - user.PhoneNumber = tmp.PhoneNumber - user.ProfilePhoto = tmp.ProfilePhoto - user.IsVerified = tmp.IsVerified - user.RestrictionReason = tmp.RestrictionReason - user.HaveAccess = tmp.HaveAccess - user.LanguageCode = tmp.LanguageCode + user.Id = tmp.Id + user.FirstName = tmp.FirstName + user.LastName = tmp.LastName + user.Username = tmp.Username + user.PhoneNumber = tmp.PhoneNumber + user.ProfilePhoto = tmp.ProfilePhoto + user.IsVerified = tmp.IsVerified + user.RestrictionReason = tmp.RestrictionReason + user.HaveAccess = tmp.HaveAccess + user.LanguageCode = tmp.LanguageCode - fieldStatus, _ := UnmarshalUserStatus(tmp.Status) - user.Status = fieldStatus + fieldStatus, _ := UnmarshalUserStatus(tmp.Status) + user.Status = fieldStatus - fieldOutgoingLink, _ := UnmarshalLinkState(tmp.OutgoingLink) - user.OutgoingLink = fieldOutgoingLink + fieldOutgoingLink, _ := UnmarshalLinkState(tmp.OutgoingLink) + user.OutgoingLink = fieldOutgoingLink - fieldIncomingLink, _ := UnmarshalLinkState(tmp.IncomingLink) - user.IncomingLink = fieldIncomingLink + fieldIncomingLink, _ := UnmarshalLinkState(tmp.IncomingLink) + user.IncomingLink = fieldIncomingLink - fieldType, _ := UnmarshalUserType(tmp.Type) - user.Type = fieldType + fieldType, _ := UnmarshalUserType(tmp.Type) + user.Type = fieldType - return nil + return nil } // Contains full information about a user (except the full list of profile photos) type UserFullInfo struct { - meta - // True, if the user is blacklisted by the current user - IsBlocked bool `json:"is_blocked"` - // True, if the user can be called - CanBeCalled bool `json:"can_be_called"` - // True, if the user can't be called due to their privacy settings - HasPrivateCalls bool `json:"has_private_calls"` - // A short user bio - Bio string `json:"bio"` - // For bots, the text that is included with the link when users share the bot - ShareText string `json:"share_text"` - // Number of group chats where both the other user and the current user are a member; 0 for the current user - GroupInCommonCount int32 `json:"group_in_common_count"` - // If the user is a bot, information about the bot; may be null - BotInfo *BotInfo `json:"bot_info"` + meta + // True, if the user is blacklisted by the current user + IsBlocked bool `json:"is_blocked"` + // True, if the user can be called + CanBeCalled bool `json:"can_be_called"` + // True, if the user can't be called due to their privacy settings + HasPrivateCalls bool `json:"has_private_calls"` + // A short user bio + Bio string `json:"bio"` + // For bots, the text that is included with the link when users share the bot + ShareText string `json:"share_text"` + // Number of group chats where both the other user and the current user are a member; 0 for the current user + GroupInCommonCount int32 `json:"group_in_common_count"` + // If the user is a bot, information about the bot; may be null + BotInfo *BotInfo `json:"bot_info"` } func (entity *UserFullInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserFullInfo + type stub UserFullInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserFullInfo) GetClass() string { - return ClassUserFullInfo + return ClassUserFullInfo } func (*UserFullInfo) GetType() string { - return TypeUserFullInfo + return TypeUserFullInfo } // Contains part of the list of user photos type UserProfilePhotos struct { - meta - // Total number of user profile photos - TotalCount int32 `json:"total_count"` - // A list of photos - Photos []*Photo `json:"photos"` + meta + // Total number of user profile photos + TotalCount int32 `json:"total_count"` + // A list of photos + Photos []*Photo `json:"photos"` } func (entity *UserProfilePhotos) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserProfilePhotos + type stub UserProfilePhotos - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserProfilePhotos) GetClass() string { - return ClassUserProfilePhotos + return ClassUserProfilePhotos } func (*UserProfilePhotos) GetType() string { - return TypeUserProfilePhotos + return TypeUserProfilePhotos } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub Users + type stub Users - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Users) GetClass() string { - return ClassUsers + return ClassUsers } func (*Users) GetType() string { - return TypeUsers + return TypeUsers } // The user is the creator of a chat and has all the administrator privileges type ChatMemberStatusCreator struct { - meta - // True, if the user is a member of the chat - IsMember bool `json:"is_member"` + meta + // 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() + entity.meta.Type = entity.GetType() - type stub ChatMemberStatusCreator + type stub ChatMemberStatusCreator - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMemberStatusCreator) GetClass() string { - return ClassChatMemberStatus + return ClassChatMemberStatus } func (*ChatMemberStatusCreator) GetType() string { - return TypeChatMemberStatusCreator + return TypeChatMemberStatusCreator } func (*ChatMemberStatusCreator) ChatMemberStatusType() string { - return TypeChatMemberStatusCreator + 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 - // 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 supergroups only - CanPinMessages bool `json:"can_pin_messages"` - // True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that were directly or indirectly promoted by him - CanPromoteMembers bool `json:"can_promote_members"` + meta + // True, if the current user can edit the administrator privileges for the called user + CanBeEdited bool `json:"can_be_edited"` + // True, if the administrator can change the chat title, photo, and other settings + CanChangeInfo bool `json:"can_change_info"` + // True, if the administrator can create channel posts; applicable to channels only + CanPostMessages bool `json:"can_post_messages"` + // True, if the administrator can edit messages of other users and pin messages; applicable to channels only + CanEditMessages bool `json:"can_edit_messages"` + // True, if the administrator can delete messages of other users + CanDeleteMessages bool `json:"can_delete_messages"` + // True, if the administrator can invite new users to the chat + CanInviteUsers bool `json:"can_invite_users"` + // True, if the administrator can restrict, ban, or unban chat members + CanRestrictMembers bool `json:"can_restrict_members"` + // True, if the administrator can pin messages; applicable to supergroups only + CanPinMessages bool `json:"can_pin_messages"` + // True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that were directly or indirectly promoted by him + CanPromoteMembers bool `json:"can_promote_members"` } func (entity *ChatMemberStatusAdministrator) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatMemberStatusAdministrator + type stub ChatMemberStatusAdministrator - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMemberStatusAdministrator) GetClass() string { - return ClassChatMemberStatus + return ClassChatMemberStatus } func (*ChatMemberStatusAdministrator) GetType() string { - return TypeChatMemberStatusAdministrator + return TypeChatMemberStatusAdministrator } func (*ChatMemberStatusAdministrator) ChatMemberStatusType() string { - return TypeChatMemberStatusAdministrator + return TypeChatMemberStatusAdministrator } // The user is a member of a chat, without any additional privileges or restrictions -type ChatMemberStatusMember struct{ - meta +type ChatMemberStatusMember struct { + meta } func (entity *ChatMemberStatusMember) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatMemberStatusMember + type stub ChatMemberStatusMember - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMemberStatusMember) GetClass() string { - return ClassChatMemberStatus + return ClassChatMemberStatus } func (*ChatMemberStatusMember) GetType() string { - return TypeChatMemberStatusMember + return TypeChatMemberStatusMember } func (*ChatMemberStatusMember) ChatMemberStatusType() string { - return TypeChatMemberStatusMember + 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"` - // 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 animations, games, and stickers and use inline bots. Implies can_send_media_messages permissions - CanSendOtherMessages bool `json:"can_send_other_messages"` - // True, if the user may add a web page preview to his messages. Implies can_send_messages permissions - CanAddWebPagePreviews bool `json:"can_add_web_page_previews"` + 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"` + // 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 animations, games, and stickers and use inline bots. Implies can_send_media_messages permissions + CanSendOtherMessages bool `json:"can_send_other_messages"` + // True, if the user may add a web page preview to his messages. Implies can_send_messages permissions + CanAddWebPagePreviews bool `json:"can_add_web_page_previews"` } func (entity *ChatMemberStatusRestricted) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatMemberStatusRestricted + type stub ChatMemberStatusRestricted - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMemberStatusRestricted) GetClass() string { - return ClassChatMemberStatus + return ClassChatMemberStatus } func (*ChatMemberStatusRestricted) GetType() string { - return TypeChatMemberStatusRestricted + return TypeChatMemberStatusRestricted } func (*ChatMemberStatusRestricted) ChatMemberStatusType() string { - return TypeChatMemberStatusRestricted + return TypeChatMemberStatusRestricted } // The user is not a chat member -type ChatMemberStatusLeft struct{ - meta +type ChatMemberStatusLeft struct { + meta } func (entity *ChatMemberStatusLeft) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatMemberStatusLeft + type stub ChatMemberStatusLeft - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMemberStatusLeft) GetClass() string { - return ClassChatMemberStatus + return ClassChatMemberStatus } func (*ChatMemberStatusLeft) GetType() string { - return TypeChatMemberStatusLeft + return TypeChatMemberStatusLeft } func (*ChatMemberStatusLeft) ChatMemberStatusType() string { - return TypeChatMemberStatusLeft + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatMemberStatusBanned + type stub ChatMemberStatusBanned - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMemberStatusBanned) GetClass() string { - return ClassChatMemberStatus + return ClassChatMemberStatus } func (*ChatMemberStatusBanned) GetType() string { - return TypeChatMemberStatusBanned + return TypeChatMemberStatusBanned } func (*ChatMemberStatusBanned) ChatMemberStatusType() string { - return TypeChatMemberStatusBanned + 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 a chat - JoinedChatDate int32 `json:"joined_chat_date"` - // Status of the member in the chat - Status ChatMemberStatus `json:"status"` - // If the user is a bot, information about the bot; may be null. Can be null even for a bot if the bot is not a chat member - BotInfo *BotInfo `json:"bot_info"` + meta + // User identifier of the chat member + UserId int32 `json:"user_id"` + // Identifier of a user that invited/promoted/banned this member in the chat; 0 if unknown + InviterUserId int32 `json:"inviter_user_id"` + // Point in time (Unix timestamp) when the user joined a chat + JoinedChatDate int32 `json:"joined_chat_date"` + // Status of the member in the chat + Status ChatMemberStatus `json:"status"` + // If the user is a bot, information about the bot; may be null. Can be null even for a bot if the bot is not a chat member + BotInfo *BotInfo `json:"bot_info"` } func (entity *ChatMember) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatMember + type stub ChatMember - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMember) GetClass() string { - return ClassChatMember + return ClassChatMember } func (*ChatMember) GetType() string { - return TypeChatMember + 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"` - } + 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 - } + 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 + chatMember.UserId = tmp.UserId + chatMember.InviterUserId = tmp.InviterUserId + chatMember.JoinedChatDate = tmp.JoinedChatDate + chatMember.BotInfo = tmp.BotInfo - fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) - chatMember.Status = fieldStatus + fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) + chatMember.Status = fieldStatus - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatMembers + type stub ChatMembers - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMembers) GetClass() string { - return ClassChatMembers + return ClassChatMembers } func (*ChatMembers) GetType() string { - return TypeChatMembers + return TypeChatMembers } // Returns the creator and administrators -type ChatMembersFilterAdministrators struct{ - meta +type ChatMembersFilterAdministrators struct { + meta } func (entity *ChatMembersFilterAdministrators) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatMembersFilterAdministrators + type stub ChatMembersFilterAdministrators - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMembersFilterAdministrators) GetClass() string { - return ClassChatMembersFilter + return ClassChatMembersFilter } func (*ChatMembersFilterAdministrators) GetType() string { - return TypeChatMembersFilterAdministrators + return TypeChatMembersFilterAdministrators } func (*ChatMembersFilterAdministrators) ChatMembersFilterType() string { - return TypeChatMembersFilterAdministrators + return TypeChatMembersFilterAdministrators } // Returns all chat members, including restricted chat members -type ChatMembersFilterMembers struct{ - meta +type ChatMembersFilterMembers struct { + meta } func (entity *ChatMembersFilterMembers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatMembersFilterMembers + type stub ChatMembersFilterMembers - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMembersFilterMembers) GetClass() string { - return ClassChatMembersFilter + return ClassChatMembersFilter } func (*ChatMembersFilterMembers) GetType() string { - return TypeChatMembersFilterMembers + return TypeChatMembersFilterMembers } func (*ChatMembersFilterMembers) ChatMembersFilterType() string { - return TypeChatMembersFilterMembers + return TypeChatMembersFilterMembers } // Returns users under certain restrictions in the chat; can be used only by administrators in a supergroup -type ChatMembersFilterRestricted struct{ - meta +type ChatMembersFilterRestricted struct { + meta } func (entity *ChatMembersFilterRestricted) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatMembersFilterRestricted + type stub ChatMembersFilterRestricted - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMembersFilterRestricted) GetClass() string { - return ClassChatMembersFilter + return ClassChatMembersFilter } func (*ChatMembersFilterRestricted) GetType() string { - return TypeChatMembersFilterRestricted + return TypeChatMembersFilterRestricted } func (*ChatMembersFilterRestricted) ChatMembersFilterType() string { - return TypeChatMembersFilterRestricted + 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 +type ChatMembersFilterBanned struct { + meta } func (entity *ChatMembersFilterBanned) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatMembersFilterBanned + type stub ChatMembersFilterBanned - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMembersFilterBanned) GetClass() string { - return ClassChatMembersFilter + return ClassChatMembersFilter } func (*ChatMembersFilterBanned) GetType() string { - return TypeChatMembersFilterBanned + return TypeChatMembersFilterBanned } func (*ChatMembersFilterBanned) ChatMembersFilterType() string { - return TypeChatMembersFilterBanned + return TypeChatMembersFilterBanned } // Returns bot members of the chat -type ChatMembersFilterBots struct{ - meta +type ChatMembersFilterBots struct { + meta } func (entity *ChatMembersFilterBots) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatMembersFilterBots + type stub ChatMembersFilterBots - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatMembersFilterBots) GetClass() string { - return ClassChatMembersFilter + return ClassChatMembersFilter } func (*ChatMembersFilterBots) GetType() string { - return TypeChatMembersFilterBots + return TypeChatMembersFilterBots } func (*ChatMembersFilterBots) ChatMembersFilterType() string { - return TypeChatMembersFilterBots + return TypeChatMembersFilterBots } // Returns recently active users in reverse chronological order -type SupergroupMembersFilterRecent struct{ - meta +type SupergroupMembersFilterRecent struct { + meta } func (entity *SupergroupMembersFilterRecent) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SupergroupMembersFilterRecent + type stub SupergroupMembersFilterRecent - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SupergroupMembersFilterRecent) GetClass() string { - return ClassSupergroupMembersFilter + return ClassSupergroupMembersFilter } func (*SupergroupMembersFilterRecent) GetType() string { - return TypeSupergroupMembersFilterRecent + return TypeSupergroupMembersFilterRecent } func (*SupergroupMembersFilterRecent) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterRecent + return TypeSupergroupMembersFilterRecent } // Returns the creator and administrators -type SupergroupMembersFilterAdministrators struct{ - meta +type SupergroupMembersFilterAdministrators struct { + meta } func (entity *SupergroupMembersFilterAdministrators) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SupergroupMembersFilterAdministrators + type stub SupergroupMembersFilterAdministrators - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SupergroupMembersFilterAdministrators) GetClass() string { - return ClassSupergroupMembersFilter + return ClassSupergroupMembersFilter } func (*SupergroupMembersFilterAdministrators) GetType() string { - return TypeSupergroupMembersFilterAdministrators + return TypeSupergroupMembersFilterAdministrators } func (*SupergroupMembersFilterAdministrators) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterAdministrators + 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"` + meta + // Query to search for + Query string `json:"query"` } func (entity *SupergroupMembersFilterSearch) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SupergroupMembersFilterSearch + type stub SupergroupMembersFilterSearch - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SupergroupMembersFilterSearch) GetClass() string { - return ClassSupergroupMembersFilter + return ClassSupergroupMembersFilter } func (*SupergroupMembersFilterSearch) GetType() string { - return TypeSupergroupMembersFilterSearch + return TypeSupergroupMembersFilterSearch } func (*SupergroupMembersFilterSearch) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterSearch + return TypeSupergroupMembersFilterSearch } // Returns restricted supergroup members; can be used only by administrators type SupergroupMembersFilterRestricted struct { - meta - // Query to search for - Query string `json:"query"` + meta + // Query to search for + Query string `json:"query"` } func (entity *SupergroupMembersFilterRestricted) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SupergroupMembersFilterRestricted + type stub SupergroupMembersFilterRestricted - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SupergroupMembersFilterRestricted) GetClass() string { - return ClassSupergroupMembersFilter + return ClassSupergroupMembersFilter } func (*SupergroupMembersFilterRestricted) GetType() string { - return TypeSupergroupMembersFilterRestricted + return TypeSupergroupMembersFilterRestricted } func (*SupergroupMembersFilterRestricted) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterRestricted + 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"` + meta + // Query to search for + Query string `json:"query"` } func (entity *SupergroupMembersFilterBanned) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SupergroupMembersFilterBanned + type stub SupergroupMembersFilterBanned - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SupergroupMembersFilterBanned) GetClass() string { - return ClassSupergroupMembersFilter + return ClassSupergroupMembersFilter } func (*SupergroupMembersFilterBanned) GetType() string { - return TypeSupergroupMembersFilterBanned + return TypeSupergroupMembersFilterBanned } func (*SupergroupMembersFilterBanned) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterBanned + return TypeSupergroupMembersFilterBanned } // Returns bot members of the supergroup or channel -type SupergroupMembersFilterBots struct{ - meta +type SupergroupMembersFilterBots struct { + meta } func (entity *SupergroupMembersFilterBots) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SupergroupMembersFilterBots + type stub SupergroupMembersFilterBots - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SupergroupMembersFilterBots) GetClass() string { - return ClassSupergroupMembersFilter + return ClassSupergroupMembersFilter } func (*SupergroupMembersFilterBots) GetType() string { - return TypeSupergroupMembersFilterBots + return TypeSupergroupMembersFilterBots } func (*SupergroupMembersFilterBots) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterBots + 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 all members have been granted administrator rights in the group - EveryoneIsAdministrator bool `json:"everyone_is_administrator"` - // 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"` + 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 all members have been granted administrator rights in the group + EveryoneIsAdministrator bool `json:"everyone_is_administrator"` + // 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() + entity.meta.Type = entity.GetType() - type stub BasicGroup + type stub BasicGroup - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*BasicGroup) GetClass() string { - return ClassBasicGroup + return ClassBasicGroup } func (*BasicGroup) GetType() string { - return TypeBasicGroup + 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"` - EveryoneIsAdministrator bool `json:"everyone_is_administrator"` - IsActive bool `json:"is_active"` - UpgradedToSupergroupId int32 `json:"upgraded_to_supergroup_id"` - } + var tmp struct { + Id int32 `json:"id"` + MemberCount int32 `json:"member_count"` + Status json.RawMessage `json:"status"` + EveryoneIsAdministrator bool `json:"everyone_is_administrator"` + IsActive bool `json:"is_active"` + UpgradedToSupergroupId int32 `json:"upgraded_to_supergroup_id"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - basicGroup.Id = tmp.Id - basicGroup.MemberCount = tmp.MemberCount - basicGroup.EveryoneIsAdministrator = tmp.EveryoneIsAdministrator - basicGroup.IsActive = tmp.IsActive - basicGroup.UpgradedToSupergroupId = tmp.UpgradedToSupergroupId + basicGroup.Id = tmp.Id + basicGroup.MemberCount = tmp.MemberCount + basicGroup.EveryoneIsAdministrator = tmp.EveryoneIsAdministrator + basicGroup.IsActive = tmp.IsActive + basicGroup.UpgradedToSupergroupId = tmp.UpgradedToSupergroupId - fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) - basicGroup.Status = fieldStatus + fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) + basicGroup.Status = fieldStatus - return nil + return nil } // Contains full information about a basic group type BasicGroupFullInfo struct { - meta - // User identifier of the creator of the group; 0 if unknown - CreatorUserId int32 `json:"creator_user_id"` - // Group members - Members []*ChatMember `json:"members"` - // Invite link for this group; available only for the group creator and only after it has been generated at least once - InviteLink string `json:"invite_link"` + meta + // User identifier of the creator of the group; 0 if unknown + CreatorUserId int32 `json:"creator_user_id"` + // Group members + Members []*ChatMember `json:"members"` + // Invite link for this group; available only for the group creator and only after it has been generated at least once + InviteLink string `json:"invite_link"` } func (entity *BasicGroupFullInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub BasicGroupFullInfo + type stub BasicGroupFullInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*BasicGroupFullInfo) GetClass() string { - return ClassBasicGroupFullInfo + return ClassBasicGroupFullInfo } func (*BasicGroupFullInfo) GetType() string { - return TypeBasicGroupFullInfo + 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 - Status ChatMemberStatus `json:"status"` - // Member count; 0 if unknown. Currently it is guaranteed to be known only if the supergroup or channel was found through SearchPublicChats - MemberCount int32 `json:"member_count"` - // True, if any member of the supergroup can invite other members. This field has no meaning for channels - AnyoneCanInvite bool `json:"anyone_can_invite"` - // True, if messages sent to the channel should contain information about the sender. This field is only applicable to channels - SignMessages bool `json:"sign_messages"` - // True, if the supergroup is a channel - IsChannel bool `json:"is_channel"` - // True, if the supergroup or channel is verified - IsVerified bool `json:"is_verified"` - // If non-empty, contains the reason why access to this supergroup or channel must be restricted. Format of the string is "{type}: {description}". {type} Contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user) - RestrictionReason string `json:"restriction_reason"` + meta + // Supergroup or channel identifier + Id int32 `json:"id"` + // Username of the supergroup or channel; empty for private supergroups or channels + Username string `json:"username"` + // Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member + Date int32 `json:"date"` + // Status of the current user in the supergroup or channel + Status ChatMemberStatus `json:"status"` + // Member count; 0 if unknown. Currently it is guaranteed to be known only if the supergroup or channel was found through SearchPublicChats + MemberCount int32 `json:"member_count"` + // True, if any member of the supergroup can invite other members. This field has no meaning for channels + AnyoneCanInvite bool `json:"anyone_can_invite"` + // True, if messages sent to the channel should contain information about the sender. This field is only applicable to channels + SignMessages bool `json:"sign_messages"` + // True, if the supergroup is a channel + IsChannel bool `json:"is_channel"` + // True, if the supergroup or channel is verified + IsVerified bool `json:"is_verified"` + // If non-empty, contains the reason why access to this supergroup or channel must be restricted. Format of the string is "{type}: {description}". {type} Contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user) + RestrictionReason string `json:"restriction_reason"` } func (entity *Supergroup) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Supergroup + type stub Supergroup - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Supergroup) GetClass() string { - return ClassSupergroup + return ClassSupergroup } func (*Supergroup) GetType() string { - return TypeSupergroup + 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"` - AnyoneCanInvite bool `json:"anyone_can_invite"` - SignMessages bool `json:"sign_messages"` - IsChannel bool `json:"is_channel"` - IsVerified bool `json:"is_verified"` - RestrictionReason string `json:"restriction_reason"` - } + 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"` + AnyoneCanInvite bool `json:"anyone_can_invite"` + SignMessages bool `json:"sign_messages"` + IsChannel bool `json:"is_channel"` + IsVerified bool `json:"is_verified"` + RestrictionReason string `json:"restriction_reason"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + 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.AnyoneCanInvite = tmp.AnyoneCanInvite - supergroup.SignMessages = tmp.SignMessages - supergroup.IsChannel = tmp.IsChannel - supergroup.IsVerified = tmp.IsVerified - supergroup.RestrictionReason = tmp.RestrictionReason + supergroup.Id = tmp.Id + supergroup.Username = tmp.Username + supergroup.Date = tmp.Date + supergroup.MemberCount = tmp.MemberCount + supergroup.AnyoneCanInvite = tmp.AnyoneCanInvite + supergroup.SignMessages = tmp.SignMessages + supergroup.IsChannel = tmp.IsChannel + supergroup.IsVerified = tmp.IsVerified + supergroup.RestrictionReason = tmp.RestrictionReason - fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) - supergroup.Status = fieldStatus + fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) + supergroup.Status = fieldStatus - return nil + return nil } // Contains full information about a supergroup or channel type SupergroupFullInfo struct { - meta - // Supergroup or channel description - Description string `json:"description"` - // Number of members in the supergroup or channel; 0 if unknown - MemberCount int32 `json:"member_count"` - // Number of privileged users in the supergroup or channel; 0 if unknown - AdministratorCount int32 `json:"administrator_count"` - // Number of restricted users in the supergroup; 0 if unknown - RestrictedCount int32 `json:"restricted_count"` - // Number of users banned from chat; 0 if unknown - BannedCount int32 `json:"banned_count"` - // True, if members of the chat can be retrieved - CanGetMembers bool `json:"can_get_members"` - // True, if the chat can be made public - CanSetUsername bool `json:"can_set_username"` - // True, if the supergroup sticker set can be changed - CanSetStickerSet bool `json:"can_set_sticker_set"` - // True, if new chat members will have access to old messages. In public supergroups and both public and private channels, old messages are always available, so this option affects only private supergroups. The value of this field is only available for chat administrators - IsAllHistoryAvailable bool `json:"is_all_history_available"` - // Identifier of the supergroup sticker set; 0 if none - StickerSetId JsonInt64 `json:"sticker_set_id"` - // Invite link for this chat - InviteLink string `json:"invite_link"` - // Identifier of the pinned message in the chat; 0 if none - PinnedMessageId int64 `json:"pinned_message_id"` - // 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"` + meta + // Supergroup or channel description + Description string `json:"description"` + // Number of members in the supergroup or channel; 0 if unknown + MemberCount int32 `json:"member_count"` + // Number of privileged users in the supergroup or channel; 0 if unknown + AdministratorCount int32 `json:"administrator_count"` + // Number of restricted users in the supergroup; 0 if unknown + RestrictedCount int32 `json:"restricted_count"` + // Number of users banned from chat; 0 if unknown + BannedCount int32 `json:"banned_count"` + // True, if members of the chat can be retrieved + CanGetMembers bool `json:"can_get_members"` + // True, if the chat can be made public + CanSetUsername bool `json:"can_set_username"` + // True, if the supergroup sticker set can be changed + CanSetStickerSet bool `json:"can_set_sticker_set"` + // True, if new chat members will have access to old messages. In public supergroups and both public and private channels, old messages are always available, so this option affects only private supergroups. The value of this field is only available for chat administrators + IsAllHistoryAvailable bool `json:"is_all_history_available"` + // Identifier of the supergroup sticker set; 0 if none + StickerSetId JsonInt64 `json:"sticker_set_id"` + // Invite link for this chat + InviteLink string `json:"invite_link"` + // Identifier of the pinned message in the chat; 0 if none + PinnedMessageId int64 `json:"pinned_message_id"` + // 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() + entity.meta.Type = entity.GetType() - type stub SupergroupFullInfo + type stub SupergroupFullInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SupergroupFullInfo) GetClass() string { - return ClassSupergroupFullInfo + return ClassSupergroupFullInfo } func (*SupergroupFullInfo) GetType() string { - return TypeSupergroupFullInfo + return TypeSupergroupFullInfo } // The secret chat is not yet created; waiting for the other user to get online -type SecretChatStatePending struct{ - meta +type SecretChatStatePending struct { + meta } func (entity *SecretChatStatePending) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SecretChatStatePending + type stub SecretChatStatePending - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SecretChatStatePending) GetClass() string { - return ClassSecretChatState + return ClassSecretChatState } func (*SecretChatStatePending) GetType() string { - return TypeSecretChatStatePending + return TypeSecretChatStatePending } func (*SecretChatStatePending) SecretChatStateType() string { - return TypeSecretChatStatePending + return TypeSecretChatStatePending } // The secret chat is ready to use -type SecretChatStateReady struct{ - meta +type SecretChatStateReady struct { + meta } func (entity *SecretChatStateReady) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SecretChatStateReady + type stub SecretChatStateReady - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SecretChatStateReady) GetClass() string { - return ClassSecretChatState + return ClassSecretChatState } func (*SecretChatStateReady) GetType() string { - return TypeSecretChatStateReady + return TypeSecretChatStateReady } func (*SecretChatStateReady) SecretChatStateType() string { - return TypeSecretChatStateReady + return TypeSecretChatStateReady } // The secret chat is closed -type SecretChatStateClosed struct{ - meta +type SecretChatStateClosed struct { + meta } func (entity *SecretChatStateClosed) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SecretChatStateClosed + type stub SecretChatStateClosed - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SecretChatStateClosed) GetClass() string { - return ClassSecretChatState + return ClassSecretChatState } func (*SecretChatStateClosed) GetType() string { - return TypeSecretChatStateClosed + return TypeSecretChatStateClosed } func (*SecretChatStateClosed) SecretChatStateType() string { - return TypeSecretChatStateClosed + 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 bytes, which must be used to make a 12x12 square image with a color depth of 4. The first 16 bytes should be used to make a central 8x8 square, while the remaining 20 bytes should be used to construct a 2-pixel-wide border around that square. Alternatively, the first 32 bytes of the hash can be converted to the hexadecimal format and printed as 32 2-digit hex numbers - KeyHash []byte `json:"key_hash"` - // Secret chat layer; determines features supported by the other client. Video notes are supported if the layer >= 66 - Layer int32 `json:"layer"` + meta + // Secret chat identifier + Id int32 `json:"id"` + // Identifier of the chat partner + UserId int32 `json:"user_id"` + // State of the secret chat + State SecretChatState `json:"state"` + // True, if the chat was created by the current user; otherwise false + IsOutbound bool `json:"is_outbound"` + // Current message Time To Live setting (self-destruct timer) for the chat, in seconds + Ttl int32 `json:"ttl"` + // Hash of the currently used key for comparison with the hash of the chat partner's key. This is a string of 36 bytes, which must be used to make a 12x12 square image with a color depth of 4. The first 16 bytes should be used to make a central 8x8 square, while the remaining 20 bytes should be used to construct a 2-pixel-wide border around that square. Alternatively, the first 32 bytes of the hash can be converted to the hexadecimal format and printed as 32 2-digit hex numbers + KeyHash []byte `json:"key_hash"` + // Secret chat layer; determines features supported by the other client. Video notes are supported if the layer >= 66 + Layer int32 `json:"layer"` } func (entity *SecretChat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SecretChat + type stub SecretChat - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SecretChat) GetClass() string { - return ClassSecretChat + return ClassSecretChat } func (*SecretChat) GetType() string { - return TypeSecretChat + 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"` - } + 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 - } + 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 + 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 + fieldState, _ := UnmarshalSecretChatState(tmp.State) + secretChat.State = fieldState - return nil + return nil } // The message was originally written by a known user type MessageForwardedFromUser struct { - meta - // Identifier of the user that originally sent this message - SenderUserId int32 `json:"sender_user_id"` - // Point in time (Unix timestamp) when the message was originally sent - Date int32 `json:"date"` - // For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown - ForwardedFromChatId int64 `json:"forwarded_from_chat_id"` - // For messages forwarded to the chat with the current user (saved messages) the identifier of the original message from which the new message was forwarded; 0 if unknown - ForwardedFromMessageId int64 `json:"forwarded_from_message_id"` + meta + // Identifier of the user that originally sent this message + SenderUserId int32 `json:"sender_user_id"` + // Point in time (Unix timestamp) when the message was originally sent + Date int32 `json:"date"` + // For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown + ForwardedFromChatId int64 `json:"forwarded_from_chat_id"` + // For messages forwarded to the chat with the current user (saved messages) the identifier of the original message from which the new message was forwarded; 0 if unknown + ForwardedFromMessageId int64 `json:"forwarded_from_message_id"` } func (entity *MessageForwardedFromUser) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageForwardedFromUser + type stub MessageForwardedFromUser - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageForwardedFromUser) GetClass() string { - return ClassMessageForwardInfo + return ClassMessageForwardInfo } func (*MessageForwardedFromUser) GetType() string { - return TypeMessageForwardedFromUser + return TypeMessageForwardedFromUser } func (*MessageForwardedFromUser) MessageForwardInfoType() string { - return TypeMessageForwardedFromUser + return TypeMessageForwardedFromUser } // The message was originally a post in a channel type MessageForwardedPost struct { - meta - // Identifier of the chat from which the message was forwarded - ChatId int64 `json:"chat_id"` - // Post author signature - AuthorSignature string `json:"author_signature"` - // Point in time (Unix timestamp) when the message was originally sent - Date int32 `json:"date"` - // Message identifier of the original message from which the new message was forwarded; 0 if unknown - MessageId int64 `json:"message_id"` - // For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown - ForwardedFromChatId int64 `json:"forwarded_from_chat_id"` - // For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded; 0 if unknown - ForwardedFromMessageId int64 `json:"forwarded_from_message_id"` + meta + // Identifier of the chat from which the message was forwarded + ChatId int64 `json:"chat_id"` + // Post author signature + AuthorSignature string `json:"author_signature"` + // Point in time (Unix timestamp) when the message was originally sent + Date int32 `json:"date"` + // Message identifier of the original message from which the new message was forwarded; 0 if unknown + MessageId int64 `json:"message_id"` + // For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown + ForwardedFromChatId int64 `json:"forwarded_from_chat_id"` + // For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded; 0 if unknown + ForwardedFromMessageId int64 `json:"forwarded_from_message_id"` } func (entity *MessageForwardedPost) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageForwardedPost + type stub MessageForwardedPost - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageForwardedPost) GetClass() string { - return ClassMessageForwardInfo + return ClassMessageForwardInfo } func (*MessageForwardedPost) GetType() string { - return TypeMessageForwardedPost + return TypeMessageForwardedPost } func (*MessageForwardedPost) MessageForwardInfoType() string { - return TypeMessageForwardedPost + return TypeMessageForwardedPost } // The message is being sent now, but has not yet been delivered to the server -type MessageSendingStatePending struct{ - meta +type MessageSendingStatePending struct { + meta } func (entity *MessageSendingStatePending) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageSendingStatePending + type stub MessageSendingStatePending - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageSendingStatePending) GetClass() string { - return ClassMessageSendingState + return ClassMessageSendingState } func (*MessageSendingStatePending) GetType() string { - return TypeMessageSendingStatePending + return TypeMessageSendingStatePending } func (*MessageSendingStatePending) MessageSendingStateType() string { - return TypeMessageSendingStatePending + return TypeMessageSendingStatePending } // The message failed to be sent -type MessageSendingStateFailed struct{ - meta +type MessageSendingStateFailed struct { + meta } func (entity *MessageSendingStateFailed) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageSendingStateFailed + type stub MessageSendingStateFailed - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageSendingStateFailed) GetClass() string { - return ClassMessageSendingState + return ClassMessageSendingState } func (*MessageSendingStateFailed) GetType() string { - return TypeMessageSendingStateFailed + return TypeMessageSendingStateFailed } func (*MessageSendingStateFailed) MessageSendingStateType() string { - return TypeMessageSendingStateFailed + return TypeMessageSendingStateFailed } // Describes a message type Message struct { - meta - // Message identifier, unique for the chat to which the message belongs - Id int64 `json:"id"` - // Identifier of the user who sent the message; 0 if unknown. It is unknown for channel posts - SenderUserId int32 `json:"sender_user_id"` - // Chat identifier - ChatId int64 `json:"chat_id"` - // Information about the sending state of the message; may be null - SendingState MessageSendingState `json:"sending_state"` - // True, if the message is outgoing - IsOutgoing bool `json:"is_outgoing"` - // True, if the message can be edited - CanBeEdited bool `json:"can_be_edited"` - // True, if the message can be forwarded - CanBeForwarded bool `json:"can_be_forwarded"` - // True, if the message can be deleted only for the current user while other users will continue to see it - CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` - // True, if the message can be deleted for all users - CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - // True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts - IsChannelPost bool `json:"is_channel_post"` - // True, if the message contains an unread mention for the current user - ContainsUnreadMention bool `json:"contains_unread_mention"` - // Point in time (Unix timestamp) when the message was sent - Date int32 `json:"date"` - // Point in time (Unix timestamp) when the message was last edited - EditDate int32 `json:"edit_date"` - // Information about the initial message sender; may be null - ForwardInfo MessageForwardInfo `json:"forward_info"` - // If non-zero, the identifier of the message this message is replying to; can be the identifier of a deleted message - ReplyToMessageId int64 `json:"reply_to_message_id"` - // For self-destructing messages, the message's TTL (Time To Live), in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the TTL expires - Ttl int32 `json:"ttl"` - // Time left before the message expires, in seconds - TtlExpiresIn float64 `json:"ttl_expires_in"` - // If non-zero, the user identifier of the bot through which this message was sent - ViaBotUserId int32 `json:"via_bot_user_id"` - // For channel posts, optional author signature - AuthorSignature string `json:"author_signature"` - // Number of times this message was viewed - Views int32 `json:"views"` - // Unique identifier of an album this message belongs to. Only photos and videos can be grouped together in albums - MediaAlbumId JsonInt64 `json:"media_album_id"` - // Content of the message - Content MessageContent `json:"content"` - // Reply markup for the message; may be null - ReplyMarkup ReplyMarkup `json:"reply_markup"` + meta + // Message identifier, unique for the chat to which the message belongs + Id int64 `json:"id"` + // Identifier of the user who sent the message; 0 if unknown. It is unknown for channel posts + SenderUserId int32 `json:"sender_user_id"` + // Chat identifier + ChatId int64 `json:"chat_id"` + // Information about the sending state of the message; may be null + SendingState MessageSendingState `json:"sending_state"` + // True, if the message is outgoing + IsOutgoing bool `json:"is_outgoing"` + // True, if the message can be edited + CanBeEdited bool `json:"can_be_edited"` + // True, if the message can be forwarded + CanBeForwarded bool `json:"can_be_forwarded"` + // True, if the message can be deleted only for the current user while other users will continue to see it + CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` + // True, if the message can be deleted for all users + CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` + // True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts + IsChannelPost bool `json:"is_channel_post"` + // True, if the message contains an unread mention for the current user + ContainsUnreadMention bool `json:"contains_unread_mention"` + // Point in time (Unix timestamp) when the message was sent + Date int32 `json:"date"` + // Point in time (Unix timestamp) when the message was last edited + EditDate int32 `json:"edit_date"` + // Information about the initial message sender; may be null + ForwardInfo MessageForwardInfo `json:"forward_info"` + // If non-zero, the identifier of the message this message is replying to; can be the identifier of a deleted message + ReplyToMessageId int64 `json:"reply_to_message_id"` + // For self-destructing messages, the message's TTL (Time To Live), in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the TTL expires + Ttl int32 `json:"ttl"` + // Time left before the message expires, in seconds + TtlExpiresIn float64 `json:"ttl_expires_in"` + // If non-zero, the user identifier of the bot through which this message was sent + ViaBotUserId int32 `json:"via_bot_user_id"` + // For channel posts, optional author signature + AuthorSignature string `json:"author_signature"` + // Number of times this message was viewed + Views int32 `json:"views"` + // Unique identifier of an album this message belongs to. Only photos and videos can be grouped together in albums + MediaAlbumId JsonInt64 `json:"media_album_id"` + // Content of the message + Content MessageContent `json:"content"` + // Reply markup for the message; may be null + ReplyMarkup ReplyMarkup `json:"reply_markup"` } func (entity *Message) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Message + type stub Message - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Message) GetClass() string { - return ClassMessage + return ClassMessage } func (*Message) GetType() string { - return TypeMessage + return TypeMessage } func (message *Message) UnmarshalJSON(data []byte) error { - var tmp struct { - Id int64 `json:"id"` - SenderUserId int32 `json:"sender_user_id"` - ChatId int64 `json:"chat_id"` - SendingState json.RawMessage `json:"sending_state"` - IsOutgoing bool `json:"is_outgoing"` - CanBeEdited bool `json:"can_be_edited"` - CanBeForwarded bool `json:"can_be_forwarded"` - CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` - CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - IsChannelPost bool `json:"is_channel_post"` - ContainsUnreadMention bool `json:"contains_unread_mention"` - Date int32 `json:"date"` - EditDate int32 `json:"edit_date"` - ForwardInfo json.RawMessage `json:"forward_info"` - ReplyToMessageId int64 `json:"reply_to_message_id"` - Ttl int32 `json:"ttl"` - TtlExpiresIn float64 `json:"ttl_expires_in"` - ViaBotUserId int32 `json:"via_bot_user_id"` - AuthorSignature string `json:"author_signature"` - Views int32 `json:"views"` - MediaAlbumId JsonInt64 `json:"media_album_id"` - Content json.RawMessage `json:"content"` - ReplyMarkup json.RawMessage `json:"reply_markup"` - } + var tmp struct { + Id int64 `json:"id"` + SenderUserId int32 `json:"sender_user_id"` + ChatId int64 `json:"chat_id"` + SendingState json.RawMessage `json:"sending_state"` + IsOutgoing bool `json:"is_outgoing"` + CanBeEdited bool `json:"can_be_edited"` + CanBeForwarded bool `json:"can_be_forwarded"` + CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` + CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` + IsChannelPost bool `json:"is_channel_post"` + ContainsUnreadMention bool `json:"contains_unread_mention"` + Date int32 `json:"date"` + EditDate int32 `json:"edit_date"` + ForwardInfo json.RawMessage `json:"forward_info"` + ReplyToMessageId int64 `json:"reply_to_message_id"` + Ttl int32 `json:"ttl"` + TtlExpiresIn float64 `json:"ttl_expires_in"` + ViaBotUserId int32 `json:"via_bot_user_id"` + AuthorSignature string `json:"author_signature"` + Views int32 `json:"views"` + MediaAlbumId JsonInt64 `json:"media_album_id"` + Content json.RawMessage `json:"content"` + ReplyMarkup json.RawMessage `json:"reply_markup"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - message.Id = tmp.Id - message.SenderUserId = tmp.SenderUserId - message.ChatId = tmp.ChatId - message.IsOutgoing = tmp.IsOutgoing - message.CanBeEdited = tmp.CanBeEdited - message.CanBeForwarded = tmp.CanBeForwarded - message.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf - message.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers - message.IsChannelPost = tmp.IsChannelPost - message.ContainsUnreadMention = tmp.ContainsUnreadMention - message.Date = tmp.Date - message.EditDate = tmp.EditDate - message.ReplyToMessageId = tmp.ReplyToMessageId - message.Ttl = tmp.Ttl - message.TtlExpiresIn = tmp.TtlExpiresIn - message.ViaBotUserId = tmp.ViaBotUserId - message.AuthorSignature = tmp.AuthorSignature - message.Views = tmp.Views - message.MediaAlbumId = tmp.MediaAlbumId + message.Id = tmp.Id + message.SenderUserId = tmp.SenderUserId + message.ChatId = tmp.ChatId + message.IsOutgoing = tmp.IsOutgoing + message.CanBeEdited = tmp.CanBeEdited + message.CanBeForwarded = tmp.CanBeForwarded + message.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf + message.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers + message.IsChannelPost = tmp.IsChannelPost + message.ContainsUnreadMention = tmp.ContainsUnreadMention + message.Date = tmp.Date + message.EditDate = tmp.EditDate + message.ReplyToMessageId = tmp.ReplyToMessageId + message.Ttl = tmp.Ttl + message.TtlExpiresIn = tmp.TtlExpiresIn + message.ViaBotUserId = tmp.ViaBotUserId + message.AuthorSignature = tmp.AuthorSignature + message.Views = tmp.Views + message.MediaAlbumId = tmp.MediaAlbumId - fieldSendingState, _ := UnmarshalMessageSendingState(tmp.SendingState) - message.SendingState = fieldSendingState + fieldSendingState, _ := UnmarshalMessageSendingState(tmp.SendingState) + message.SendingState = fieldSendingState - fieldForwardInfo, _ := UnmarshalMessageForwardInfo(tmp.ForwardInfo) - message.ForwardInfo = fieldForwardInfo + fieldForwardInfo, _ := UnmarshalMessageForwardInfo(tmp.ForwardInfo) + message.ForwardInfo = fieldForwardInfo - fieldContent, _ := UnmarshalMessageContent(tmp.Content) - message.Content = fieldContent + fieldContent, _ := UnmarshalMessageContent(tmp.Content) + message.Content = fieldContent - fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) - message.ReplyMarkup = fieldReplyMarkup + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + message.ReplyMarkup = fieldReplyMarkup - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub Messages + type stub Messages - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Messages) GetClass() string { - return ClassMessages + return ClassMessages } func (*Messages) GetType() string { - return TypeMessages + return TypeMessages } // Contains a list of messages found by a search type FoundMessages struct { - meta - // List of messages - Messages []*Message `json:"messages"` - // Value to pass as from_search_id to get more results - NextFromSearchId JsonInt64 `json:"next_from_search_id"` + meta + // List of messages + Messages []*Message `json:"messages"` + // Value to pass as from_search_id to get more results + NextFromSearchId JsonInt64 `json:"next_from_search_id"` } func (entity *FoundMessages) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FoundMessages + type stub FoundMessages - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FoundMessages) GetClass() string { - return ClassFoundMessages + return ClassFoundMessages } func (*FoundMessages) GetType() string { - return TypeFoundMessages + return TypeFoundMessages } // Notification settings applied to all private and secret chats when the corresponding chat setting has a default value -type NotificationSettingsScopePrivateChats struct{ - meta +type NotificationSettingsScopePrivateChats struct { + meta } func (entity *NotificationSettingsScopePrivateChats) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub NotificationSettingsScopePrivateChats + type stub NotificationSettingsScopePrivateChats - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*NotificationSettingsScopePrivateChats) GetClass() string { - return ClassNotificationSettingsScope + return ClassNotificationSettingsScope } func (*NotificationSettingsScopePrivateChats) GetType() string { - return TypeNotificationSettingsScopePrivateChats + return TypeNotificationSettingsScopePrivateChats } func (*NotificationSettingsScopePrivateChats) NotificationSettingsScopeType() string { - return TypeNotificationSettingsScopePrivateChats + return TypeNotificationSettingsScopePrivateChats } // Notification settings applied to all basic groups, supergroups and channels when the corresponding chat setting has a default value -type NotificationSettingsScopeGroupChats struct{ - meta +type NotificationSettingsScopeGroupChats struct { + meta } func (entity *NotificationSettingsScopeGroupChats) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub NotificationSettingsScopeGroupChats + type stub NotificationSettingsScopeGroupChats - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*NotificationSettingsScopeGroupChats) GetClass() string { - return ClassNotificationSettingsScope + return ClassNotificationSettingsScope } func (*NotificationSettingsScopeGroupChats) GetType() string { - return TypeNotificationSettingsScopeGroupChats + return TypeNotificationSettingsScopeGroupChats } func (*NotificationSettingsScopeGroupChats) NotificationSettingsScopeType() string { - return TypeNotificationSettingsScopeGroupChats + return TypeNotificationSettingsScopeGroupChats } // 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"` + 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"` } func (entity *ChatNotificationSettings) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatNotificationSettings + type stub ChatNotificationSettings - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatNotificationSettings) GetClass() string { - return ClassChatNotificationSettings + return ClassChatNotificationSettings } func (*ChatNotificationSettings) GetType() string { - return TypeChatNotificationSettings + 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"` + 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"` } func (entity *ScopeNotificationSettings) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ScopeNotificationSettings + type stub ScopeNotificationSettings - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ScopeNotificationSettings) GetClass() string { - return ClassScopeNotificationSettings + return ClassScopeNotificationSettings } func (*ScopeNotificationSettings) GetType() string { - return TypeScopeNotificationSettings + 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"` - // Content of the message draft; this should always be of type inputMessageText - InputMessageText InputMessageContent `json:"input_message_text"` + meta + // Identifier of the message to reply to; 0 if none + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Content of the message draft; this should always be of type inputMessageText + InputMessageText InputMessageContent `json:"input_message_text"` } func (entity *DraftMessage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub DraftMessage + type stub DraftMessage - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DraftMessage) GetClass() string { - return ClassDraftMessage + return ClassDraftMessage } func (*DraftMessage) GetType() string { - return TypeDraftMessage + return TypeDraftMessage } func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { - var tmp struct { - ReplyToMessageId int64 `json:"reply_to_message_id"` - InputMessageText json.RawMessage `json:"input_message_text"` - } + var tmp struct { + ReplyToMessageId int64 `json:"reply_to_message_id"` + InputMessageText json.RawMessage `json:"input_message_text"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - draftMessage.ReplyToMessageId = tmp.ReplyToMessageId + draftMessage.ReplyToMessageId = tmp.ReplyToMessageId - fieldInputMessageText, _ := UnmarshalInputMessageContent(tmp.InputMessageText) - draftMessage.InputMessageText = fieldInputMessageText + fieldInputMessageText, _ := UnmarshalInputMessageContent(tmp.InputMessageText) + draftMessage.InputMessageText = fieldInputMessageText - return nil + return nil } // An ordinary chat with a user type ChatTypePrivate struct { - meta - // User identifier - UserId int32 `json:"user_id"` + meta + // User identifier + UserId int32 `json:"user_id"` } func (entity *ChatTypePrivate) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatTypePrivate + type stub ChatTypePrivate - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatTypePrivate) GetClass() string { - return ClassChatType + return ClassChatType } func (*ChatTypePrivate) GetType() string { - return TypeChatTypePrivate + return TypeChatTypePrivate } func (*ChatTypePrivate) ChatTypeType() string { - return TypeChatTypePrivate + 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"` + meta + // Basic group identifier + BasicGroupId int32 `json:"basic_group_id"` } func (entity *ChatTypeBasicGroup) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatTypeBasicGroup + type stub ChatTypeBasicGroup - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatTypeBasicGroup) GetClass() string { - return ClassChatType + return ClassChatType } func (*ChatTypeBasicGroup) GetType() string { - return TypeChatTypeBasicGroup + return TypeChatTypeBasicGroup } func (*ChatTypeBasicGroup) ChatTypeType() string { - return TypeChatTypeBasicGroup + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatTypeSupergroup + type stub ChatTypeSupergroup - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatTypeSupergroup) GetClass() string { - return ClassChatType + return ClassChatType } func (*ChatTypeSupergroup) GetType() string { - return TypeChatTypeSupergroup + return TypeChatTypeSupergroup } func (*ChatTypeSupergroup) ChatTypeType() string { - return TypeChatTypeSupergroup + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatTypeSecret + type stub ChatTypeSecret - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatTypeSecret) GetClass() string { - return ClassChatType + return ClassChatType } func (*ChatTypeSecret) GetType() string { - return TypeChatTypeSecret + return TypeChatTypeSecret } func (*ChatTypeSecret) ChatTypeType() string { - return TypeChatTypeSecret + return TypeChatTypeSecret } // 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 *ChatPhoto `json:"photo"` - // Last message in the chat; may be null - LastMessage *Message `json:"last_message"` - // Descending parameter by which chats are sorted in the main chat list. If the order number of two chats is the same, they must be sorted in descending order by ID. If 0, the position of the chat in the list is undetermined - Order JsonInt64 `json:"order"` - // True, if the chat is pinned - IsPinned bool `json:"is_pinned"` - // True, if the chat is marked as unread - IsMarkedAsUnread bool `json:"is_marked_as_unread"` - // True, if the chat is sponsored by the user's MTProxy server - IsSponsored bool `json:"is_sponsored"` - // 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"` - // Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat - ReplyMarkupMessageId int64 `json:"reply_markup_message_id"` - // A draft of a message in the chat; may be null - DraftMessage *DraftMessage `json:"draft_message"` - // Contains client-specific data associated with the chat. (For example, the chat position or local chat notification settings can be stored here.) Persistent if a message database is used - ClientData string `json:"client_data"` + meta + // Chat unique identifier + Id int64 `json:"id"` + // Type of the chat + Type ChatType `json:"type"` + // Chat title + Title string `json:"title"` + // Chat photo; may be null + Photo *ChatPhoto `json:"photo"` + // Last message in the chat; may be null + LastMessage *Message `json:"last_message"` + // Descending parameter by which chats are sorted in the main chat list. If the order number of two chats is the same, they must be sorted in descending order by ID. If 0, the position of the chat in the list is undetermined + Order JsonInt64 `json:"order"` + // True, if the chat is pinned + IsPinned bool `json:"is_pinned"` + // True, if the chat is marked as unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + // True, if the chat is sponsored by the user's MTProxy server + IsSponsored bool `json:"is_sponsored"` + // 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"` + // Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat + ReplyMarkupMessageId int64 `json:"reply_markup_message_id"` + // A draft of a message in the chat; may be null + DraftMessage *DraftMessage `json:"draft_message"` + // Contains client-specific data associated with the chat. (For example, the chat position or local chat notification settings can be stored here.) Persistent if a message database is used + ClientData string `json:"client_data"` } func (entity *Chat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Chat + type stub Chat - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Chat) GetClass() string { - return ClassChat + return ClassChat } func (*Chat) GetType() string { - return TypeChat + 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 *ChatPhoto `json:"photo"` - LastMessage *Message `json:"last_message"` - Order JsonInt64 `json:"order"` - IsPinned bool `json:"is_pinned"` - IsMarkedAsUnread bool `json:"is_marked_as_unread"` - IsSponsored bool `json:"is_sponsored"` - 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"` - ReplyMarkupMessageId int64 `json:"reply_markup_message_id"` - DraftMessage *DraftMessage `json:"draft_message"` - ClientData string `json:"client_data"` - } + var tmp struct { + Id int64 `json:"id"` + Type json.RawMessage `json:"type"` + Title string `json:"title"` + Photo *ChatPhoto `json:"photo"` + LastMessage *Message `json:"last_message"` + Order JsonInt64 `json:"order"` + IsPinned bool `json:"is_pinned"` + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + IsSponsored bool `json:"is_sponsored"` + 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"` + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - chat.Id = tmp.Id - chat.Title = tmp.Title - chat.Photo = tmp.Photo - chat.LastMessage = tmp.LastMessage - chat.Order = tmp.Order - chat.IsPinned = tmp.IsPinned - chat.IsMarkedAsUnread = tmp.IsMarkedAsUnread - chat.IsSponsored = tmp.IsSponsored - 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 + chat.Id = tmp.Id + chat.Title = tmp.Title + chat.Photo = tmp.Photo + chat.LastMessage = tmp.LastMessage + chat.Order = tmp.Order + chat.IsPinned = tmp.IsPinned + chat.IsMarkedAsUnread = tmp.IsMarkedAsUnread + chat.IsSponsored = tmp.IsSponsored + 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 + fieldType, _ := UnmarshalChatType(tmp.Type) + chat.Type = fieldType - return nil + return nil } // Represents a list of chats type Chats struct { - meta - // List of chat identifiers - ChatIds []int64 `json:"chat_ids"` + meta + // List of chat identifiers + ChatIds []int64 `json:"chat_ids"` } func (entity *Chats) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Chats + type stub Chats - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Chats) GetClass() string { - return ClassChats + return ClassChats } func (*Chats) GetType() string { - return TypeChats + return TypeChats } // Contains a chat invite link type ChatInviteLink struct { - meta - // Chat invite link - InviteLink string `json:"invite_link"` + meta + // Chat invite link + InviteLink string `json:"invite_link"` } func (entity *ChatInviteLink) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatInviteLink + type stub ChatInviteLink - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatInviteLink) GetClass() string { - return ClassChatInviteLink + return ClassChatInviteLink } func (*ChatInviteLink) GetType() string { - return TypeChatInviteLink + return TypeChatInviteLink } // Contains information about a chat invite link type ChatInviteLinkInfo struct { - meta - // Chat identifier of the invite link; 0 if the user is not a member of this chat - ChatId int64 `json:"chat_id"` - // Contains information about the type of the chat - Type ChatType `json:"type"` - // Title of the chat - Title string `json:"title"` - // Chat photo; may be null - Photo *ChatPhoto `json:"photo"` - // Number of members - MemberCount int32 `json:"member_count"` - // User identifiers of some chat members that may be known to the current user - MemberUserIds []int32 `json:"member_user_ids"` - // True, if the chat is a public supergroup or channel with a username - IsPublic bool `json:"is_public"` + meta + // Chat identifier of the invite link; 0 if the user is not a member of this chat + ChatId int64 `json:"chat_id"` + // Contains information about the type of the chat + Type ChatType `json:"type"` + // Title of the chat + Title string `json:"title"` + // Chat photo; may be null + Photo *ChatPhoto `json:"photo"` + // Number of members + MemberCount int32 `json:"member_count"` + // User identifiers of some chat members that may be known to the current user + MemberUserIds []int32 `json:"member_user_ids"` + // True, if the chat is a public supergroup or channel with a username + IsPublic bool `json:"is_public"` } func (entity *ChatInviteLinkInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatInviteLinkInfo + type stub ChatInviteLinkInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatInviteLinkInfo) GetClass() string { - return ClassChatInviteLinkInfo + return ClassChatInviteLinkInfo } func (*ChatInviteLinkInfo) GetType() string { - return TypeChatInviteLinkInfo + return TypeChatInviteLinkInfo } func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { - var tmp struct { - ChatId int64 `json:"chat_id"` - Type json.RawMessage `json:"type"` - Title string `json:"title"` - Photo *ChatPhoto `json:"photo"` - MemberCount int32 `json:"member_count"` - MemberUserIds []int32 `json:"member_user_ids"` - IsPublic bool `json:"is_public"` - } + var tmp struct { + ChatId int64 `json:"chat_id"` + Type json.RawMessage `json:"type"` + Title string `json:"title"` + Photo *ChatPhoto `json:"photo"` + MemberCount int32 `json:"member_count"` + MemberUserIds []int32 `json:"member_user_ids"` + IsPublic bool `json:"is_public"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - chatInviteLinkInfo.ChatId = tmp.ChatId - chatInviteLinkInfo.Title = tmp.Title - chatInviteLinkInfo.Photo = tmp.Photo - chatInviteLinkInfo.MemberCount = tmp.MemberCount - chatInviteLinkInfo.MemberUserIds = tmp.MemberUserIds - chatInviteLinkInfo.IsPublic = tmp.IsPublic + chatInviteLinkInfo.ChatId = tmp.ChatId + chatInviteLinkInfo.Title = tmp.Title + chatInviteLinkInfo.Photo = tmp.Photo + chatInviteLinkInfo.MemberCount = tmp.MemberCount + chatInviteLinkInfo.MemberUserIds = tmp.MemberUserIds + chatInviteLinkInfo.IsPublic = tmp.IsPublic - fieldType, _ := UnmarshalChatType(tmp.Type) - chatInviteLinkInfo.Type = fieldType + fieldType, _ := UnmarshalChatType(tmp.Type) + chatInviteLinkInfo.Type = fieldType - return nil + return nil } // A simple button, with text that should be sent when the button is pressed -type KeyboardButtonTypeText struct{ - meta +type KeyboardButtonTypeText struct { + meta } func (entity *KeyboardButtonTypeText) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub KeyboardButtonTypeText + type stub KeyboardButtonTypeText - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*KeyboardButtonTypeText) GetClass() string { - return ClassKeyboardButtonType + return ClassKeyboardButtonType } func (*KeyboardButtonTypeText) GetType() string { - return TypeKeyboardButtonTypeText + return TypeKeyboardButtonTypeText } func (*KeyboardButtonTypeText) KeyboardButtonTypeType() string { - return TypeKeyboardButtonTypeText + return TypeKeyboardButtonTypeText } // A button that sends the user's phone number when pressed; available only in private chats -type KeyboardButtonTypeRequestPhoneNumber struct{ - meta +type KeyboardButtonTypeRequestPhoneNumber struct { + meta } func (entity *KeyboardButtonTypeRequestPhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub KeyboardButtonTypeRequestPhoneNumber + type stub KeyboardButtonTypeRequestPhoneNumber - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*KeyboardButtonTypeRequestPhoneNumber) GetClass() string { - return ClassKeyboardButtonType + return ClassKeyboardButtonType } func (*KeyboardButtonTypeRequestPhoneNumber) GetType() string { - return TypeKeyboardButtonTypeRequestPhoneNumber + return TypeKeyboardButtonTypeRequestPhoneNumber } func (*KeyboardButtonTypeRequestPhoneNumber) KeyboardButtonTypeType() string { - return TypeKeyboardButtonTypeRequestPhoneNumber + return TypeKeyboardButtonTypeRequestPhoneNumber } // A button that sends the user's location when pressed; available only in private chats -type KeyboardButtonTypeRequestLocation struct{ - meta +type KeyboardButtonTypeRequestLocation struct { + meta } func (entity *KeyboardButtonTypeRequestLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub KeyboardButtonTypeRequestLocation + type stub KeyboardButtonTypeRequestLocation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*KeyboardButtonTypeRequestLocation) GetClass() string { - return ClassKeyboardButtonType + return ClassKeyboardButtonType } func (*KeyboardButtonTypeRequestLocation) GetType() string { - return TypeKeyboardButtonTypeRequestLocation + return TypeKeyboardButtonTypeRequestLocation } func (*KeyboardButtonTypeRequestLocation) KeyboardButtonTypeType() string { - return TypeKeyboardButtonTypeRequestLocation + return TypeKeyboardButtonTypeRequestLocation } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub KeyboardButton + type stub KeyboardButton - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*KeyboardButton) GetClass() string { - return ClassKeyboardButton + return ClassKeyboardButton } func (*KeyboardButton) GetType() string { - return TypeKeyboardButton + return TypeKeyboardButton } func (keyboardButton *KeyboardButton) UnmarshalJSON(data []byte) error { - var tmp struct { - Text string `json:"text"` - Type json.RawMessage `json:"type"` - } + var tmp struct { + Text string `json:"text"` + Type json.RawMessage `json:"type"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - keyboardButton.Text = tmp.Text + keyboardButton.Text = tmp.Text - fieldType, _ := UnmarshalKeyboardButtonType(tmp.Type) - keyboardButton.Type = fieldType + fieldType, _ := UnmarshalKeyboardButtonType(tmp.Type) + keyboardButton.Type = fieldType - return nil + return nil } // A button that opens a specified URL type InlineKeyboardButtonTypeUrl struct { - meta - // HTTP or tg:// URL to open - Url string `json:"url"` + meta + // HTTP or tg:// URL to open + Url string `json:"url"` } func (entity *InlineKeyboardButtonTypeUrl) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InlineKeyboardButtonTypeUrl + type stub InlineKeyboardButtonTypeUrl - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineKeyboardButtonTypeUrl) GetClass() string { - return ClassInlineKeyboardButtonType + return ClassInlineKeyboardButtonType } func (*InlineKeyboardButtonTypeUrl) GetType() string { - return TypeInlineKeyboardButtonTypeUrl + return TypeInlineKeyboardButtonTypeUrl } func (*InlineKeyboardButtonTypeUrl) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeUrl + return TypeInlineKeyboardButtonTypeUrl } // A button that sends a special callback query to a bot type InlineKeyboardButtonTypeCallback struct { - meta - // Data to be sent to the bot via a callback query - Data []byte `json:"data"` + 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() + entity.meta.Type = entity.GetType() - type stub InlineKeyboardButtonTypeCallback + type stub InlineKeyboardButtonTypeCallback - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineKeyboardButtonTypeCallback) GetClass() string { - return ClassInlineKeyboardButtonType + return ClassInlineKeyboardButtonType } func (*InlineKeyboardButtonTypeCallback) GetType() string { - return TypeInlineKeyboardButtonTypeCallback + return TypeInlineKeyboardButtonTypeCallback } func (*InlineKeyboardButtonTypeCallback) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeCallback + return TypeInlineKeyboardButtonTypeCallback } // A button with a game that sends a special callback query to a bot. This button must be in the first column and row of the keyboard and can be attached only to a message with content of the type messageGame -type InlineKeyboardButtonTypeCallbackGame struct{ - meta +type InlineKeyboardButtonTypeCallbackGame struct { + meta } func (entity *InlineKeyboardButtonTypeCallbackGame) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InlineKeyboardButtonTypeCallbackGame + type stub InlineKeyboardButtonTypeCallbackGame - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineKeyboardButtonTypeCallbackGame) GetClass() string { - return ClassInlineKeyboardButtonType + return ClassInlineKeyboardButtonType } func (*InlineKeyboardButtonTypeCallbackGame) GetType() string { - return TypeInlineKeyboardButtonTypeCallbackGame + return TypeInlineKeyboardButtonTypeCallbackGame } func (*InlineKeyboardButtonTypeCallbackGame) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeCallbackGame + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InlineKeyboardButtonTypeSwitchInline + type stub InlineKeyboardButtonTypeSwitchInline - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineKeyboardButtonTypeSwitchInline) GetClass() string { - return ClassInlineKeyboardButtonType + return ClassInlineKeyboardButtonType } func (*InlineKeyboardButtonTypeSwitchInline) GetType() string { - return TypeInlineKeyboardButtonTypeSwitchInline + return TypeInlineKeyboardButtonTypeSwitchInline } func (*InlineKeyboardButtonTypeSwitchInline) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeSwitchInline + 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 +type InlineKeyboardButtonTypeBuy struct { + meta } func (entity *InlineKeyboardButtonTypeBuy) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InlineKeyboardButtonTypeBuy + type stub InlineKeyboardButtonTypeBuy - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineKeyboardButtonTypeBuy) GetClass() string { - return ClassInlineKeyboardButtonType + return ClassInlineKeyboardButtonType } func (*InlineKeyboardButtonTypeBuy) GetType() string { - return TypeInlineKeyboardButtonTypeBuy + return TypeInlineKeyboardButtonTypeBuy } func (*InlineKeyboardButtonTypeBuy) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeBuy + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InlineKeyboardButton + type stub InlineKeyboardButton - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineKeyboardButton) GetClass() string { - return ClassInlineKeyboardButton + return ClassInlineKeyboardButton } func (*InlineKeyboardButton) GetType() string { - return TypeInlineKeyboardButton + return TypeInlineKeyboardButton } func (inlineKeyboardButton *InlineKeyboardButton) UnmarshalJSON(data []byte) error { - var tmp struct { - Text string `json:"text"` - Type json.RawMessage `json:"type"` - } + var tmp struct { + Text string `json:"text"` + Type json.RawMessage `json:"type"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inlineKeyboardButton.Text = tmp.Text + inlineKeyboardButton.Text = tmp.Text - fieldType, _ := UnmarshalInlineKeyboardButtonType(tmp.Type) - inlineKeyboardButton.Type = fieldType + fieldType, _ := UnmarshalInlineKeyboardButtonType(tmp.Type) + inlineKeyboardButton.Type = fieldType - return nil + return nil } // Instructs clients to remove the keyboard once this message has been received. This kind of keyboard can't be received in an incoming message; instead, UpdateChatReplyMarkup with message_id == 0 will be sent type ReplyMarkupRemoveKeyboard struct { - meta - // True, if the keyboard is removed only for the mentioned users or the target user of a reply - IsPersonal bool `json:"is_personal"` + 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() + entity.meta.Type = entity.GetType() - type stub ReplyMarkupRemoveKeyboard + type stub ReplyMarkupRemoveKeyboard - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ReplyMarkupRemoveKeyboard) GetClass() string { - return ClassReplyMarkup + return ClassReplyMarkup } func (*ReplyMarkupRemoveKeyboard) GetType() string { - return TypeReplyMarkupRemoveKeyboard + return TypeReplyMarkupRemoveKeyboard } func (*ReplyMarkupRemoveKeyboard) ReplyMarkupType() string { - return TypeReplyMarkupRemoveKeyboard + return TypeReplyMarkupRemoveKeyboard } // Instructs clients 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ReplyMarkupForceReply + type stub ReplyMarkupForceReply - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ReplyMarkupForceReply) GetClass() string { - return ClassReplyMarkup + return ClassReplyMarkup } func (*ReplyMarkupForceReply) GetType() string { - return TypeReplyMarkupForceReply + return TypeReplyMarkupForceReply } func (*ReplyMarkupForceReply) ReplyMarkupType() string { - return TypeReplyMarkupForceReply + 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 client needs to resize the keyboard vertically - ResizeKeyboard bool `json:"resize_keyboard"` - // True, if the client needs to hide the keyboard after use - OneTime bool `json:"one_time"` - // True, if the keyboard must automatically be shown to the current user. For outgoing messages, specify true to show the keyboard only for the mentioned users and for the target user of a reply - IsPersonal bool `json:"is_personal"` + meta + // A list of rows of bot keyboard buttons + Rows [][]*KeyboardButton `json:"rows"` + // True, if the client needs to resize the keyboard vertically + ResizeKeyboard bool `json:"resize_keyboard"` + // True, if the client needs to hide the keyboard after use + OneTime bool `json:"one_time"` + // True, if the keyboard must automatically be shown to the current user. For outgoing messages, specify true to show the keyboard only for the mentioned users and for the target user of a reply + IsPersonal bool `json:"is_personal"` } func (entity *ReplyMarkupShowKeyboard) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ReplyMarkupShowKeyboard + type stub ReplyMarkupShowKeyboard - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ReplyMarkupShowKeyboard) GetClass() string { - return ClassReplyMarkup + return ClassReplyMarkup } func (*ReplyMarkupShowKeyboard) GetType() string { - return TypeReplyMarkupShowKeyboard + return TypeReplyMarkupShowKeyboard } func (*ReplyMarkupShowKeyboard) ReplyMarkupType() string { - return TypeReplyMarkupShowKeyboard + return TypeReplyMarkupShowKeyboard } // Contains an inline keyboard layout type ReplyMarkupInlineKeyboard struct { - meta - // A list of rows of inline keyboard buttons - Rows [][]*InlineKeyboardButton `json:"rows"` + meta + // A list of rows of inline keyboard buttons + Rows [][]*InlineKeyboardButton `json:"rows"` } func (entity *ReplyMarkupInlineKeyboard) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ReplyMarkupInlineKeyboard + type stub ReplyMarkupInlineKeyboard - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ReplyMarkupInlineKeyboard) GetClass() string { - return ClassReplyMarkup + return ClassReplyMarkup } func (*ReplyMarkupInlineKeyboard) GetType() string { - return TypeReplyMarkupInlineKeyboard + return TypeReplyMarkupInlineKeyboard } func (*ReplyMarkupInlineKeyboard) ReplyMarkupType() string { - return TypeReplyMarkupInlineKeyboard + return TypeReplyMarkupInlineKeyboard } // A plain text type RichTextPlain struct { - meta - // Text - Text string `json:"text"` + meta + // Text + Text string `json:"text"` } func (entity *RichTextPlain) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RichTextPlain + type stub RichTextPlain - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RichTextPlain) GetClass() string { - return ClassRichText + return ClassRichText } func (*RichTextPlain) GetType() string { - return TypeRichTextPlain + return TypeRichTextPlain } func (*RichTextPlain) RichTextType() string { - return TypeRichTextPlain + return TypeRichTextPlain } // A bold rich text type RichTextBold struct { - meta - // Text - Text RichText `json:"text"` + meta + // Text + Text RichText `json:"text"` } func (entity *RichTextBold) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RichTextBold + type stub RichTextBold - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RichTextBold) GetClass() string { - return ClassRichText + return ClassRichText } func (*RichTextBold) GetType() string { - return TypeRichTextBold + return TypeRichTextBold } func (*RichTextBold) RichTextType() string { - return TypeRichTextBold + return TypeRichTextBold } func (richTextBold *RichTextBold) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } + var tmp struct { + Text json.RawMessage `json:"text"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextBold.Text = fieldText + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextBold.Text = fieldText - return nil + return nil } // An italicized rich text type RichTextItalic struct { - meta - // Text - Text RichText `json:"text"` + meta + // Text + Text RichText `json:"text"` } func (entity *RichTextItalic) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RichTextItalic + type stub RichTextItalic - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RichTextItalic) GetClass() string { - return ClassRichText + return ClassRichText } func (*RichTextItalic) GetType() string { - return TypeRichTextItalic + return TypeRichTextItalic } func (*RichTextItalic) RichTextType() string { - return TypeRichTextItalic + return TypeRichTextItalic } func (richTextItalic *RichTextItalic) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } + var tmp struct { + Text json.RawMessage `json:"text"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextItalic.Text = fieldText + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextItalic.Text = fieldText - return nil + return nil } // An underlined rich text type RichTextUnderline struct { - meta - // Text - Text RichText `json:"text"` + meta + // Text + Text RichText `json:"text"` } func (entity *RichTextUnderline) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RichTextUnderline + type stub RichTextUnderline - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RichTextUnderline) GetClass() string { - return ClassRichText + return ClassRichText } func (*RichTextUnderline) GetType() string { - return TypeRichTextUnderline + return TypeRichTextUnderline } func (*RichTextUnderline) RichTextType() string { - return TypeRichTextUnderline + return TypeRichTextUnderline } func (richTextUnderline *RichTextUnderline) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } + var tmp struct { + Text json.RawMessage `json:"text"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextUnderline.Text = fieldText + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextUnderline.Text = fieldText - return nil + return nil } // A strike-through rich text type RichTextStrikethrough struct { - meta - // Text - Text RichText `json:"text"` + meta + // Text + Text RichText `json:"text"` } func (entity *RichTextStrikethrough) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RichTextStrikethrough + type stub RichTextStrikethrough - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RichTextStrikethrough) GetClass() string { - return ClassRichText + return ClassRichText } func (*RichTextStrikethrough) GetType() string { - return TypeRichTextStrikethrough + return TypeRichTextStrikethrough } func (*RichTextStrikethrough) RichTextType() string { - return TypeRichTextStrikethrough + return TypeRichTextStrikethrough } func (richTextStrikethrough *RichTextStrikethrough) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } + var tmp struct { + Text json.RawMessage `json:"text"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextStrikethrough.Text = fieldText + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextStrikethrough.Text = fieldText - return nil + return nil } // A fixed-width rich text type RichTextFixed struct { - meta - // Text - Text RichText `json:"text"` + meta + // Text + Text RichText `json:"text"` } func (entity *RichTextFixed) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RichTextFixed + type stub RichTextFixed - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RichTextFixed) GetClass() string { - return ClassRichText + return ClassRichText } func (*RichTextFixed) GetType() string { - return TypeRichTextFixed + return TypeRichTextFixed } func (*RichTextFixed) RichTextType() string { - return TypeRichTextFixed + return TypeRichTextFixed } func (richTextFixed *RichTextFixed) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } + var tmp struct { + Text json.RawMessage `json:"text"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextFixed.Text = fieldText + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextFixed.Text = fieldText - return nil + return nil } // A rich text URL link type RichTextUrl struct { - meta - // Text - Text RichText `json:"text"` - // URL - Url string `json:"url"` + meta + // Text + Text RichText `json:"text"` + // URL + Url string `json:"url"` } func (entity *RichTextUrl) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RichTextUrl + type stub RichTextUrl - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RichTextUrl) GetClass() string { - return ClassRichText + return ClassRichText } func (*RichTextUrl) GetType() string { - return TypeRichTextUrl + return TypeRichTextUrl } func (*RichTextUrl) RichTextType() string { - return TypeRichTextUrl + return TypeRichTextUrl } func (richTextUrl *RichTextUrl) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - Url string `json:"url"` - } + var tmp struct { + Text json.RawMessage `json:"text"` + Url string `json:"url"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - richTextUrl.Url = tmp.Url + richTextUrl.Url = tmp.Url - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextUrl.Text = fieldText + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextUrl.Text = fieldText - return nil + return nil } // A rich text email link type RichTextEmailAddress struct { - meta - // Text - Text RichText `json:"text"` - // Email address - EmailAddress string `json:"email_address"` + meta + // Text + Text RichText `json:"text"` + // Email address + EmailAddress string `json:"email_address"` } func (entity *RichTextEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RichTextEmailAddress + type stub RichTextEmailAddress - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RichTextEmailAddress) GetClass() string { - return ClassRichText + return ClassRichText } func (*RichTextEmailAddress) GetType() string { - return TypeRichTextEmailAddress + return TypeRichTextEmailAddress } func (*RichTextEmailAddress) RichTextType() string { - return TypeRichTextEmailAddress + return TypeRichTextEmailAddress } func (richTextEmailAddress *RichTextEmailAddress) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - EmailAddress string `json:"email_address"` - } + var tmp struct { + Text json.RawMessage `json:"text"` + EmailAddress string `json:"email_address"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - richTextEmailAddress.EmailAddress = tmp.EmailAddress + richTextEmailAddress.EmailAddress = tmp.EmailAddress - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextEmailAddress.Text = fieldText + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextEmailAddress.Text = fieldText - return nil + return nil } // A concatenation of rich texts type RichTexts struct { - meta - // Texts - Texts []RichText `json:"texts"` + meta + // Texts + Texts []RichText `json:"texts"` } func (entity *RichTexts) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RichTexts + type stub RichTexts - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RichTexts) GetClass() string { - return ClassRichText + return ClassRichText } func (*RichTexts) GetType() string { - return TypeRichTexts + return TypeRichTexts } func (*RichTexts) RichTextType() string { - return TypeRichTexts + return TypeRichTexts } // The title of a page type PageBlockTitle struct { - meta - // Title - Title RichText `json:"title"` + meta + // Title + Title RichText `json:"title"` } func (entity *PageBlockTitle) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockTitle + type stub PageBlockTitle - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockTitle) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockTitle) GetType() string { - return TypePageBlockTitle + return TypePageBlockTitle } func (*PageBlockTitle) PageBlockType() string { - return TypePageBlockTitle + return TypePageBlockTitle } func (pageBlockTitle *PageBlockTitle) UnmarshalJSON(data []byte) error { - var tmp struct { - Title json.RawMessage `json:"title"` - } + var tmp struct { + Title json.RawMessage `json:"title"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldTitle, _ := UnmarshalRichText(tmp.Title) - pageBlockTitle.Title = fieldTitle + fieldTitle, _ := UnmarshalRichText(tmp.Title) + pageBlockTitle.Title = fieldTitle - return nil + return nil } // The subtitle of a page type PageBlockSubtitle struct { - meta - // Subtitle - Subtitle RichText `json:"subtitle"` + meta + // Subtitle + Subtitle RichText `json:"subtitle"` } func (entity *PageBlockSubtitle) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockSubtitle + type stub PageBlockSubtitle - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockSubtitle) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockSubtitle) GetType() string { - return TypePageBlockSubtitle + return TypePageBlockSubtitle } func (*PageBlockSubtitle) PageBlockType() string { - return TypePageBlockSubtitle + return TypePageBlockSubtitle } func (pageBlockSubtitle *PageBlockSubtitle) UnmarshalJSON(data []byte) error { - var tmp struct { - Subtitle json.RawMessage `json:"subtitle"` - } + var tmp struct { + Subtitle json.RawMessage `json:"subtitle"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldSubtitle, _ := UnmarshalRichText(tmp.Subtitle) - pageBlockSubtitle.Subtitle = fieldSubtitle + fieldSubtitle, _ := UnmarshalRichText(tmp.Subtitle) + pageBlockSubtitle.Subtitle = fieldSubtitle - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub PageBlockAuthorDate + type stub PageBlockAuthorDate - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockAuthorDate) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockAuthorDate) GetType() string { - return TypePageBlockAuthorDate + return TypePageBlockAuthorDate } func (*PageBlockAuthorDate) PageBlockType() string { - return TypePageBlockAuthorDate + return TypePageBlockAuthorDate } func (pageBlockAuthorDate *PageBlockAuthorDate) UnmarshalJSON(data []byte) error { - var tmp struct { - Author json.RawMessage `json:"author"` - PublishDate int32 `json:"publish_date"` - } + var tmp struct { + Author json.RawMessage `json:"author"` + PublishDate int32 `json:"publish_date"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - pageBlockAuthorDate.PublishDate = tmp.PublishDate + pageBlockAuthorDate.PublishDate = tmp.PublishDate - fieldAuthor, _ := UnmarshalRichText(tmp.Author) - pageBlockAuthorDate.Author = fieldAuthor + fieldAuthor, _ := UnmarshalRichText(tmp.Author) + pageBlockAuthorDate.Author = fieldAuthor - return nil + return nil } // A header type PageBlockHeader struct { - meta - // Header - Header RichText `json:"header"` + meta + // Header + Header RichText `json:"header"` } func (entity *PageBlockHeader) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockHeader + type stub PageBlockHeader - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockHeader) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockHeader) GetType() string { - return TypePageBlockHeader + return TypePageBlockHeader } func (*PageBlockHeader) PageBlockType() string { - return TypePageBlockHeader + return TypePageBlockHeader } func (pageBlockHeader *PageBlockHeader) UnmarshalJSON(data []byte) error { - var tmp struct { - Header json.RawMessage `json:"header"` - } + var tmp struct { + Header json.RawMessage `json:"header"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldHeader, _ := UnmarshalRichText(tmp.Header) - pageBlockHeader.Header = fieldHeader + fieldHeader, _ := UnmarshalRichText(tmp.Header) + pageBlockHeader.Header = fieldHeader - return nil + return nil } // A subheader type PageBlockSubheader struct { - meta - // Subheader - Subheader RichText `json:"subheader"` + meta + // Subheader + Subheader RichText `json:"subheader"` } func (entity *PageBlockSubheader) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockSubheader + type stub PageBlockSubheader - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockSubheader) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockSubheader) GetType() string { - return TypePageBlockSubheader + return TypePageBlockSubheader } func (*PageBlockSubheader) PageBlockType() string { - return TypePageBlockSubheader + return TypePageBlockSubheader } func (pageBlockSubheader *PageBlockSubheader) UnmarshalJSON(data []byte) error { - var tmp struct { - Subheader json.RawMessage `json:"subheader"` - } + var tmp struct { + Subheader json.RawMessage `json:"subheader"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldSubheader, _ := UnmarshalRichText(tmp.Subheader) - pageBlockSubheader.Subheader = fieldSubheader + fieldSubheader, _ := UnmarshalRichText(tmp.Subheader) + pageBlockSubheader.Subheader = fieldSubheader - return nil + return nil } // A text paragraph type PageBlockParagraph struct { - meta - // Paragraph text - Text RichText `json:"text"` + meta + // Paragraph text + Text RichText `json:"text"` } func (entity *PageBlockParagraph) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockParagraph + type stub PageBlockParagraph - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockParagraph) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockParagraph) GetType() string { - return TypePageBlockParagraph + return TypePageBlockParagraph } func (*PageBlockParagraph) PageBlockType() string { - return TypePageBlockParagraph + return TypePageBlockParagraph } func (pageBlockParagraph *PageBlockParagraph) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } + var tmp struct { + Text json.RawMessage `json:"text"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldText, _ := UnmarshalRichText(tmp.Text) - pageBlockParagraph.Text = fieldText + fieldText, _ := UnmarshalRichText(tmp.Text) + pageBlockParagraph.Text = fieldText - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub PageBlockPreformatted + type stub PageBlockPreformatted - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockPreformatted) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockPreformatted) GetType() string { - return TypePageBlockPreformatted + return TypePageBlockPreformatted } func (*PageBlockPreformatted) PageBlockType() string { - return TypePageBlockPreformatted + return TypePageBlockPreformatted } func (pageBlockPreformatted *PageBlockPreformatted) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - Language string `json:"language"` - } + var tmp struct { + Text json.RawMessage `json:"text"` + Language string `json:"language"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - pageBlockPreformatted.Language = tmp.Language + pageBlockPreformatted.Language = tmp.Language - fieldText, _ := UnmarshalRichText(tmp.Text) - pageBlockPreformatted.Text = fieldText + fieldText, _ := UnmarshalRichText(tmp.Text) + pageBlockPreformatted.Text = fieldText - return nil + return nil } // The footer of a page type PageBlockFooter struct { - meta - // Footer - Footer RichText `json:"footer"` + meta + // Footer + Footer RichText `json:"footer"` } func (entity *PageBlockFooter) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockFooter + type stub PageBlockFooter - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockFooter) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockFooter) GetType() string { - return TypePageBlockFooter + return TypePageBlockFooter } func (*PageBlockFooter) PageBlockType() string { - return TypePageBlockFooter + return TypePageBlockFooter } func (pageBlockFooter *PageBlockFooter) UnmarshalJSON(data []byte) error { - var tmp struct { - Footer json.RawMessage `json:"footer"` - } + var tmp struct { + Footer json.RawMessage `json:"footer"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldFooter, _ := UnmarshalRichText(tmp.Footer) - pageBlockFooter.Footer = fieldFooter + fieldFooter, _ := UnmarshalRichText(tmp.Footer) + pageBlockFooter.Footer = fieldFooter - return nil + return nil } // An empty block separating a page -type PageBlockDivider struct{ - meta +type PageBlockDivider struct { + meta } func (entity *PageBlockDivider) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockDivider + type stub PageBlockDivider - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockDivider) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockDivider) GetType() string { - return TypePageBlockDivider + return TypePageBlockDivider } func (*PageBlockDivider) PageBlockType() string { - return TypePageBlockDivider + 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"` + meta + // Name of the anchor + Name string `json:"name"` } func (entity *PageBlockAnchor) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockAnchor + type stub PageBlockAnchor - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockAnchor) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockAnchor) GetType() string { - return TypePageBlockAnchor + return TypePageBlockAnchor } func (*PageBlockAnchor) PageBlockType() string { - return TypePageBlockAnchor + return TypePageBlockAnchor } // A list of texts type PageBlockList struct { - meta - // Texts - Items []RichText `json:"items"` - // True, if the items should be marked with numbers - IsOrdered bool `json:"is_ordered"` + meta + // Texts + Items []RichText `json:"items"` + // True, if the items should be marked with numbers + IsOrdered bool `json:"is_ordered"` } func (entity *PageBlockList) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockList + type stub PageBlockList - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockList) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockList) GetType() string { - return TypePageBlockList + return TypePageBlockList } func (*PageBlockList) PageBlockType() string { - return TypePageBlockList + return TypePageBlockList } // A block quote type PageBlockBlockQuote struct { - meta - // Quote text - Text RichText `json:"text"` - // Quote caption - Caption RichText `json:"caption"` + meta + // Quote text + Text RichText `json:"text"` + // Quote caption + Caption RichText `json:"caption"` } func (entity *PageBlockBlockQuote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockBlockQuote + type stub PageBlockBlockQuote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockBlockQuote) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockBlockQuote) GetType() string { - return TypePageBlockBlockQuote + return TypePageBlockBlockQuote } func (*PageBlockBlockQuote) PageBlockType() string { - return TypePageBlockBlockQuote + return TypePageBlockBlockQuote } func (pageBlockBlockQuote *PageBlockBlockQuote) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - Caption json.RawMessage `json:"caption"` - } + var tmp struct { + Text json.RawMessage `json:"text"` + Caption json.RawMessage `json:"caption"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldText, _ := UnmarshalRichText(tmp.Text) - pageBlockBlockQuote.Text = fieldText + fieldText, _ := UnmarshalRichText(tmp.Text) + pageBlockBlockQuote.Text = fieldText - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockBlockQuote.Caption = fieldCaption + fieldCaption, _ := UnmarshalRichText(tmp.Caption) + pageBlockBlockQuote.Caption = fieldCaption - return nil + return nil } // A pull quote type PageBlockPullQuote struct { - meta - // Quote text - Text RichText `json:"text"` - // Quote caption - Caption RichText `json:"caption"` + meta + // Quote text + Text RichText `json:"text"` + // Quote caption + Caption RichText `json:"caption"` } func (entity *PageBlockPullQuote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockPullQuote + type stub PageBlockPullQuote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockPullQuote) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockPullQuote) GetType() string { - return TypePageBlockPullQuote + return TypePageBlockPullQuote } func (*PageBlockPullQuote) PageBlockType() string { - return TypePageBlockPullQuote + return TypePageBlockPullQuote } func (pageBlockPullQuote *PageBlockPullQuote) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - Caption json.RawMessage `json:"caption"` - } + var tmp struct { + Text json.RawMessage `json:"text"` + Caption json.RawMessage `json:"caption"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldText, _ := UnmarshalRichText(tmp.Text) - pageBlockPullQuote.Text = fieldText + fieldText, _ := UnmarshalRichText(tmp.Text) + pageBlockPullQuote.Text = fieldText - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockPullQuote.Caption = fieldCaption + fieldCaption, _ := UnmarshalRichText(tmp.Caption) + pageBlockPullQuote.Caption = fieldCaption - return nil + return nil } // An animation type PageBlockAnimation struct { - meta - // Animation file; may be null - Animation *Animation `json:"animation"` - // Animation caption - Caption RichText `json:"caption"` - // True, if the animation should be played automatically - NeedAutoplay bool `json:"need_autoplay"` + meta + // Animation file; may be null + Animation *Animation `json:"animation"` + // Animation caption + Caption RichText `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() + entity.meta.Type = entity.GetType() - type stub PageBlockAnimation + type stub PageBlockAnimation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockAnimation) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockAnimation) GetType() string { - return TypePageBlockAnimation + return TypePageBlockAnimation } func (*PageBlockAnimation) PageBlockType() string { - return TypePageBlockAnimation + return TypePageBlockAnimation } func (pageBlockAnimation *PageBlockAnimation) UnmarshalJSON(data []byte) error { - var tmp struct { - Animation *Animation `json:"animation"` - Caption json.RawMessage `json:"caption"` - NeedAutoplay bool `json:"need_autoplay"` - } + var tmp struct { + Animation *Animation `json:"animation"` + Caption json.RawMessage `json:"caption"` + NeedAutoplay bool `json:"need_autoplay"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - pageBlockAnimation.Animation = tmp.Animation - pageBlockAnimation.NeedAutoplay = tmp.NeedAutoplay + pageBlockAnimation.Animation = tmp.Animation + pageBlockAnimation.NeedAutoplay = tmp.NeedAutoplay - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockAnimation.Caption = fieldCaption + fieldCaption, _ := UnmarshalRichText(tmp.Caption) + pageBlockAnimation.Caption = fieldCaption - return nil + return nil } // An audio file type PageBlockAudio struct { - meta - // Audio file; may be null - Audio *Audio `json:"audio"` - // Audio file caption - Caption RichText `json:"caption"` + meta + // Audio file; may be null + Audio *Audio `json:"audio"` + // Audio file caption + Caption RichText `json:"caption"` } func (entity *PageBlockAudio) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockAudio + type stub PageBlockAudio - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockAudio) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockAudio) GetType() string { - return TypePageBlockAudio + return TypePageBlockAudio } func (*PageBlockAudio) PageBlockType() string { - return TypePageBlockAudio + return TypePageBlockAudio } func (pageBlockAudio *PageBlockAudio) UnmarshalJSON(data []byte) error { - var tmp struct { - Audio *Audio `json:"audio"` - Caption json.RawMessage `json:"caption"` - } + var tmp struct { + Audio *Audio `json:"audio"` + Caption json.RawMessage `json:"caption"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - pageBlockAudio.Audio = tmp.Audio + pageBlockAudio.Audio = tmp.Audio - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockAudio.Caption = fieldCaption + fieldCaption, _ := UnmarshalRichText(tmp.Caption) + pageBlockAudio.Caption = fieldCaption - return nil + return nil } // A photo type PageBlockPhoto struct { - meta - // Photo file; may be null - Photo *Photo `json:"photo"` - // Photo caption - Caption RichText `json:"caption"` + meta + // Photo file; may be null + Photo *Photo `json:"photo"` + // Photo caption + Caption RichText `json:"caption"` } func (entity *PageBlockPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockPhoto + type stub PageBlockPhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockPhoto) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockPhoto) GetType() string { - return TypePageBlockPhoto + return TypePageBlockPhoto } func (*PageBlockPhoto) PageBlockType() string { - return TypePageBlockPhoto + return TypePageBlockPhoto } func (pageBlockPhoto *PageBlockPhoto) UnmarshalJSON(data []byte) error { - var tmp struct { - Photo *Photo `json:"photo"` - Caption json.RawMessage `json:"caption"` - } + var tmp struct { + Photo *Photo `json:"photo"` + Caption json.RawMessage `json:"caption"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - pageBlockPhoto.Photo = tmp.Photo + pageBlockPhoto.Photo = tmp.Photo - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockPhoto.Caption = fieldCaption + fieldCaption, _ := UnmarshalRichText(tmp.Caption) + pageBlockPhoto.Caption = fieldCaption - return nil + return nil } // A video type PageBlockVideo struct { - meta - // Video file; may be null - Video *Video `json:"video"` - // Video caption - Caption RichText `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"` + meta + // Video file; may be null + Video *Video `json:"video"` + // Video caption + Caption RichText `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() + entity.meta.Type = entity.GetType() - type stub PageBlockVideo + type stub PageBlockVideo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockVideo) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockVideo) GetType() string { - return TypePageBlockVideo + return TypePageBlockVideo } func (*PageBlockVideo) PageBlockType() string { - return TypePageBlockVideo + return TypePageBlockVideo } func (pageBlockVideo *PageBlockVideo) UnmarshalJSON(data []byte) error { - var tmp struct { - Video *Video `json:"video"` - Caption json.RawMessage `json:"caption"` - NeedAutoplay bool `json:"need_autoplay"` - IsLooped bool `json:"is_looped"` - } + var tmp struct { + Video *Video `json:"video"` + Caption json.RawMessage `json:"caption"` + NeedAutoplay bool `json:"need_autoplay"` + IsLooped bool `json:"is_looped"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - pageBlockVideo.Video = tmp.Video - pageBlockVideo.NeedAutoplay = tmp.NeedAutoplay - pageBlockVideo.IsLooped = tmp.IsLooped + pageBlockVideo.Video = tmp.Video + pageBlockVideo.NeedAutoplay = tmp.NeedAutoplay + pageBlockVideo.IsLooped = tmp.IsLooped - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockVideo.Caption = fieldCaption + fieldCaption, _ := UnmarshalRichText(tmp.Caption) + pageBlockVideo.Caption = fieldCaption - return nil + return nil } // A page cover type PageBlockCover struct { - meta - // Cover - Cover PageBlock `json:"cover"` + meta + // Cover + Cover PageBlock `json:"cover"` } func (entity *PageBlockCover) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockCover + type stub PageBlockCover - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockCover) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockCover) GetType() string { - return TypePageBlockCover + return TypePageBlockCover } func (*PageBlockCover) PageBlockType() string { - return TypePageBlockCover + return TypePageBlockCover } func (pageBlockCover *PageBlockCover) UnmarshalJSON(data []byte) error { - var tmp struct { - Cover json.RawMessage `json:"cover"` - } + var tmp struct { + Cover json.RawMessage `json:"cover"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldCover, _ := UnmarshalPageBlock(tmp.Cover) - pageBlockCover.Cover = fieldCover + fieldCover, _ := UnmarshalPageBlock(tmp.Cover) + pageBlockCover.Cover = fieldCover - return nil + 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 - Width int32 `json:"width"` - // Block height - Height int32 `json:"height"` - // Block caption - Caption RichText `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"` + 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 + Width int32 `json:"width"` + // Block height + Height int32 `json:"height"` + // Block caption + Caption RichText `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() + entity.meta.Type = entity.GetType() - type stub PageBlockEmbedded + type stub PageBlockEmbedded - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockEmbedded) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockEmbedded) GetType() string { - return TypePageBlockEmbedded + return TypePageBlockEmbedded } func (*PageBlockEmbedded) PageBlockType() string { - return TypePageBlockEmbedded + return TypePageBlockEmbedded } func (pageBlockEmbedded *PageBlockEmbedded) UnmarshalJSON(data []byte) error { - var tmp struct { - Url string `json:"url"` - Html string `json:"html"` - PosterPhoto *Photo `json:"poster_photo"` - Width int32 `json:"width"` - Height int32 `json:"height"` - Caption json.RawMessage `json:"caption"` - IsFullWidth bool `json:"is_full_width"` - AllowScrolling bool `json:"allow_scrolling"` - } + var tmp struct { + Url string `json:"url"` + Html string `json:"html"` + PosterPhoto *Photo `json:"poster_photo"` + Width int32 `json:"width"` + Height int32 `json:"height"` + Caption json.RawMessage `json:"caption"` + IsFullWidth bool `json:"is_full_width"` + AllowScrolling bool `json:"allow_scrolling"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - pageBlockEmbedded.Url = tmp.Url - pageBlockEmbedded.Html = tmp.Html - pageBlockEmbedded.PosterPhoto = tmp.PosterPhoto - pageBlockEmbedded.Width = tmp.Width - pageBlockEmbedded.Height = tmp.Height - pageBlockEmbedded.IsFullWidth = tmp.IsFullWidth - pageBlockEmbedded.AllowScrolling = tmp.AllowScrolling + pageBlockEmbedded.Url = tmp.Url + pageBlockEmbedded.Html = tmp.Html + pageBlockEmbedded.PosterPhoto = tmp.PosterPhoto + pageBlockEmbedded.Width = tmp.Width + pageBlockEmbedded.Height = tmp.Height + pageBlockEmbedded.IsFullWidth = tmp.IsFullWidth + pageBlockEmbedded.AllowScrolling = tmp.AllowScrolling - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockEmbedded.Caption = fieldCaption + fieldCaption, _ := UnmarshalRichText(tmp.Caption) + pageBlockEmbedded.Caption = fieldCaption - return nil + return nil } // An embedded post type PageBlockEmbeddedPost struct { - meta - // Web page URL - Url string `json:"url"` - // Post author - Author string `json:"author"` - // Post author photo - 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 RichText `json:"caption"` + meta + // Web page URL + Url string `json:"url"` + // Post author + Author string `json:"author"` + // Post author photo + 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 RichText `json:"caption"` } func (entity *PageBlockEmbeddedPost) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockEmbeddedPost + type stub PageBlockEmbeddedPost - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockEmbeddedPost) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockEmbeddedPost) GetType() string { - return TypePageBlockEmbeddedPost + return TypePageBlockEmbeddedPost } func (*PageBlockEmbeddedPost) PageBlockType() string { - return TypePageBlockEmbeddedPost + 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 []PageBlock `json:"page_blocks"` - Caption json.RawMessage `json:"caption"` - } + var tmp struct { + Url string `json:"url"` + Author string `json:"author"` + AuthorPhoto *Photo `json:"author_photo"` + Date int32 `json:"date"` + PageBlocks []PageBlock `json:"page_blocks"` + Caption json.RawMessage `json:"caption"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + 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.PageBlocks = tmp.PageBlocks + pageBlockEmbeddedPost.Url = tmp.Url + pageBlockEmbeddedPost.Author = tmp.Author + pageBlockEmbeddedPost.AuthorPhoto = tmp.AuthorPhoto + pageBlockEmbeddedPost.Date = tmp.Date + pageBlockEmbeddedPost.PageBlocks = tmp.PageBlocks - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockEmbeddedPost.Caption = fieldCaption + fieldCaption, _ := UnmarshalRichText(tmp.Caption) + pageBlockEmbeddedPost.Caption = fieldCaption - return nil + return nil } // A collage type PageBlockCollage struct { - meta - // Collage item contents - PageBlocks []PageBlock `json:"page_blocks"` - // Block caption - Caption RichText `json:"caption"` + meta + // Collage item contents + PageBlocks []PageBlock `json:"page_blocks"` + // Block caption + Caption RichText `json:"caption"` } func (entity *PageBlockCollage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockCollage + type stub PageBlockCollage - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockCollage) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockCollage) GetType() string { - return TypePageBlockCollage + return TypePageBlockCollage } func (*PageBlockCollage) PageBlockType() string { - return TypePageBlockCollage + return TypePageBlockCollage } func (pageBlockCollage *PageBlockCollage) UnmarshalJSON(data []byte) error { - var tmp struct { - PageBlocks []PageBlock `json:"page_blocks"` - Caption json.RawMessage `json:"caption"` - } + var tmp struct { + PageBlocks []PageBlock `json:"page_blocks"` + Caption json.RawMessage `json:"caption"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - pageBlockCollage.PageBlocks = tmp.PageBlocks + pageBlockCollage.PageBlocks = tmp.PageBlocks - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockCollage.Caption = fieldCaption + fieldCaption, _ := UnmarshalRichText(tmp.Caption) + pageBlockCollage.Caption = fieldCaption - return nil + return nil } // A slideshow type PageBlockSlideshow struct { - meta - // Slideshow item contents - PageBlocks []PageBlock `json:"page_blocks"` - // Block caption - Caption RichText `json:"caption"` + meta + // Slideshow item contents + PageBlocks []PageBlock `json:"page_blocks"` + // Block caption + Caption RichText `json:"caption"` } func (entity *PageBlockSlideshow) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockSlideshow + type stub PageBlockSlideshow - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockSlideshow) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockSlideshow) GetType() string { - return TypePageBlockSlideshow + return TypePageBlockSlideshow } func (*PageBlockSlideshow) PageBlockType() string { - return TypePageBlockSlideshow + return TypePageBlockSlideshow } func (pageBlockSlideshow *PageBlockSlideshow) UnmarshalJSON(data []byte) error { - var tmp struct { - PageBlocks []PageBlock `json:"page_blocks"` - Caption json.RawMessage `json:"caption"` - } + var tmp struct { + PageBlocks []PageBlock `json:"page_blocks"` + Caption json.RawMessage `json:"caption"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - pageBlockSlideshow.PageBlocks = tmp.PageBlocks + pageBlockSlideshow.PageBlocks = tmp.PageBlocks - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockSlideshow.Caption = fieldCaption + fieldCaption, _ := UnmarshalRichText(tmp.Caption) + pageBlockSlideshow.Caption = fieldCaption - return nil + return nil } // A link to a chat type PageBlockChatLink struct { - meta - // Chat title - Title string `json:"title"` - // Chat photo; may be null - Photo *ChatPhoto `json:"photo"` - // Chat username, by which all other information about the chat should be resolved - Username string `json:"username"` + meta + // Chat title + Title string `json:"title"` + // Chat photo; may be null + Photo *ChatPhoto `json:"photo"` + // Chat username, by which all other information about the chat should be resolved + Username string `json:"username"` } func (entity *PageBlockChatLink) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PageBlockChatLink + type stub PageBlockChatLink - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PageBlockChatLink) GetClass() string { - return ClassPageBlock + return ClassPageBlock } func (*PageBlockChatLink) GetType() string { - return TypePageBlockChatLink + return TypePageBlockChatLink } func (*PageBlockChatLink) PageBlockType() string { - return TypePageBlockChatLink + return TypePageBlockChatLink } // Describes an instant view page for a web page type WebPageInstantView struct { - meta - // Content of the web page - PageBlocks []PageBlock `json:"page_blocks"` - // 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"` + meta + // Content of the web page + PageBlocks []PageBlock `json:"page_blocks"` + // 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() + entity.meta.Type = entity.GetType() - type stub WebPageInstantView + type stub WebPageInstantView - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*WebPageInstantView) GetClass() string { - return ClassWebPageInstantView + return ClassWebPageInstantView } func (*WebPageInstantView) GetType() string { - return TypeWebPageInstantView + return TypeWebPageInstantView } // 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 string `json:"description"` - // Image representing the content; may be null - Photo *Photo `json:"photo"` - // URL to show in the embedded preview - EmbedUrl string `json:"embed_url"` - // MIME type of the embedded preview, (e.g., text/html or video/mp4) - EmbedType string `json:"embed_type"` - // Width of the embedded preview - EmbedWidth int32 `json:"embed_width"` - // Height of the embedded preview - EmbedHeight int32 `json:"embed_height"` - // Duration of the content, in seconds - Duration int32 `json:"duration"` - // Author of the content - Author string `json:"author"` - // Preview of the content as an animation, if available; may be null - Animation *Animation `json:"animation"` - // Preview of the content as an audio file, if available; may be null - Audio *Audio `json:"audio"` - // Preview of the content as a document, if available (currently only available for small PDF files and ZIP archives); may be null - Document *Document `json:"document"` - // Preview of the content as a sticker for small WEBP files, if available; may be null - Sticker *Sticker `json:"sticker"` - // Preview of the content as a video, if available; may be null - Video *Video `json:"video"` - // Preview of the content as a video note, if available; may be null - VideoNote *VideoNote `json:"video_note"` - // Preview of the content as a voice note, if available; may be null - VoiceNote *VoiceNote `json:"voice_note"` - // True, if the web page has an instant view - HasInstantView bool `json:"has_instant_view"` + 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 string `json:"description"` + // Image representing the content; may be null + Photo *Photo `json:"photo"` + // URL to show in the embedded preview + EmbedUrl string `json:"embed_url"` + // MIME type of the embedded preview, (e.g., text/html or video/mp4) + EmbedType string `json:"embed_type"` + // Width of the embedded preview + EmbedWidth int32 `json:"embed_width"` + // Height of the embedded preview + EmbedHeight int32 `json:"embed_height"` + // Duration of the content, in seconds + Duration int32 `json:"duration"` + // Author of the content + Author string `json:"author"` + // Preview of the content as an animation, if available; may be null + Animation *Animation `json:"animation"` + // Preview of the content as an audio file, if available; may be null + Audio *Audio `json:"audio"` + // Preview of the content as a document, if available (currently only available for small PDF files and ZIP archives); may be null + Document *Document `json:"document"` + // Preview of the content as a sticker for small WEBP files, if available; may be null + Sticker *Sticker `json:"sticker"` + // Preview of the content as a video, if available; may be null + Video *Video `json:"video"` + // Preview of the content as a video note, if available; may be null + VideoNote *VideoNote `json:"video_note"` + // Preview of the content as a voice note, if available; may be null + VoiceNote *VoiceNote `json:"voice_note"` + // True, if the web page has an instant view + HasInstantView bool `json:"has_instant_view"` } func (entity *WebPage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub WebPage + type stub WebPage - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*WebPage) GetClass() string { - return ClassWebPage + return ClassWebPage } func (*WebPage) GetType() string { - return TypeWebPage + return TypeWebPage } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub Address + type stub Address - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Address) GetClass() string { - return ClassAddress + return ClassAddress } func (*Address) GetType() string { - return TypeAddress + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub LabeledPricePart + type stub LabeledPricePart - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LabeledPricePart) GetClass() string { - return ClassLabeledPricePart + return ClassLabeledPricePart } func (*LabeledPricePart) GetType() string { - return TypeLabeledPricePart + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub Invoice + type stub Invoice - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Invoice) GetClass() string { - return ClassInvoice + return ClassInvoice } func (*Invoice) GetType() string { - return TypeInvoice + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub OrderInfo + type stub OrderInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*OrderInfo) GetClass() string { - return ClassOrderInfo + return ClassOrderInfo } func (*OrderInfo) GetType() string { - return TypeOrderInfo + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ShippingOption + type stub ShippingOption - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ShippingOption) GetClass() string { - return ClassShippingOption + return ClassShippingOption } func (*ShippingOption) GetType() string { - return TypeShippingOption + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub SavedCredentials + type stub SavedCredentials - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SavedCredentials) GetClass() string { - return ClassSavedCredentials + return ClassSavedCredentials } func (*SavedCredentials) GetType() string { - return TypeSavedCredentials + 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"` + meta + // Identifier of the saved credentials + SavedCredentialsId string `json:"saved_credentials_id"` } func (entity *InputCredentialsSaved) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputCredentialsSaved + type stub InputCredentialsSaved - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputCredentialsSaved) GetClass() string { - return ClassInputCredentials + return ClassInputCredentials } func (*InputCredentialsSaved) GetType() string { - return TypeInputCredentialsSaved + return TypeInputCredentialsSaved } func (*InputCredentialsSaved) InputCredentialsType() string { - return TypeInputCredentialsSaved + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputCredentialsNew + type stub InputCredentialsNew - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputCredentialsNew) GetClass() string { - return ClassInputCredentials + return ClassInputCredentials } func (*InputCredentialsNew) GetType() string { - return TypeInputCredentialsNew + return TypeInputCredentialsNew } func (*InputCredentialsNew) InputCredentialsType() string { - return TypeInputCredentialsNew + 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"` + meta + // JSON-encoded data with the credential identifier + Data string `json:"data"` } func (entity *InputCredentialsAndroidPay) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputCredentialsAndroidPay + type stub InputCredentialsAndroidPay - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputCredentialsAndroidPay) GetClass() string { - return ClassInputCredentials + return ClassInputCredentials } func (*InputCredentialsAndroidPay) GetType() string { - return TypeInputCredentialsAndroidPay + return TypeInputCredentialsAndroidPay } func (*InputCredentialsAndroidPay) InputCredentialsType() string { - return TypeInputCredentialsAndroidPay + 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"` + meta + // JSON-encoded data with the credential identifier + Data string `json:"data"` } func (entity *InputCredentialsApplePay) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputCredentialsApplePay + type stub InputCredentialsApplePay - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputCredentialsApplePay) GetClass() string { - return ClassInputCredentials + return ClassInputCredentials } func (*InputCredentialsApplePay) GetType() string { - return TypeInputCredentialsApplePay + return TypeInputCredentialsApplePay } func (*InputCredentialsApplePay) InputCredentialsType() string { - return TypeInputCredentialsApplePay + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub PaymentsProviderStripe + type stub PaymentsProviderStripe - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PaymentsProviderStripe) GetClass() string { - return ClassPaymentsProviderStripe + return ClassPaymentsProviderStripe } func (*PaymentsProviderStripe) GetType() string { - return TypePaymentsProviderStripe + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub PaymentForm + type stub PaymentForm - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PaymentForm) GetClass() string { - return ClassPaymentForm + return ClassPaymentForm } func (*PaymentForm) GetType() string { - return TypePaymentForm + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ValidatedOrderInfo + type stub ValidatedOrderInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ValidatedOrderInfo) GetClass() string { - return ClassValidatedOrderInfo + return ClassValidatedOrderInfo } func (*ValidatedOrderInfo) GetType() string { - return TypeValidatedOrderInfo + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub PaymentResult + type stub PaymentResult - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PaymentResult) GetClass() string { - return ClassPaymentResult + return ClassPaymentResult } func (*PaymentResult) GetType() string { - return TypePaymentResult + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub PaymentReceipt + type stub PaymentReceipt - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PaymentReceipt) GetClass() string { - return ClassPaymentReceipt + return ClassPaymentReceipt } func (*PaymentReceipt) GetType() string { - return TypePaymentReceipt + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub DatedFile + type stub DatedFile - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DatedFile) GetClass() string { - return ClassDatedFile + return ClassDatedFile } func (*DatedFile) GetType() string { - return TypeDatedFile + return TypeDatedFile } // A Telegram Passport element containing the user's personal details -type PassportElementTypePersonalDetails struct{ - meta +type PassportElementTypePersonalDetails struct { + meta } func (entity *PassportElementTypePersonalDetails) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypePersonalDetails + type stub PassportElementTypePersonalDetails - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypePersonalDetails) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypePersonalDetails) GetType() string { - return TypePassportElementTypePersonalDetails + return TypePassportElementTypePersonalDetails } func (*PassportElementTypePersonalDetails) PassportElementTypeType() string { - return TypePassportElementTypePersonalDetails + return TypePassportElementTypePersonalDetails } // A Telegram Passport element containing the user's passport -type PassportElementTypePassport struct{ - meta +type PassportElementTypePassport struct { + meta } func (entity *PassportElementTypePassport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypePassport + type stub PassportElementTypePassport - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypePassport) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypePassport) GetType() string { - return TypePassportElementTypePassport + return TypePassportElementTypePassport } func (*PassportElementTypePassport) PassportElementTypeType() string { - return TypePassportElementTypePassport + return TypePassportElementTypePassport } // A Telegram Passport element containing the user's driver license -type PassportElementTypeDriverLicense struct{ - meta +type PassportElementTypeDriverLicense struct { + meta } func (entity *PassportElementTypeDriverLicense) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypeDriverLicense + type stub PassportElementTypeDriverLicense - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypeDriverLicense) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypeDriverLicense) GetType() string { - return TypePassportElementTypeDriverLicense + return TypePassportElementTypeDriverLicense } func (*PassportElementTypeDriverLicense) PassportElementTypeType() string { - return TypePassportElementTypeDriverLicense + return TypePassportElementTypeDriverLicense } // A Telegram Passport element containing the user's identity card -type PassportElementTypeIdentityCard struct{ - meta +type PassportElementTypeIdentityCard struct { + meta } func (entity *PassportElementTypeIdentityCard) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypeIdentityCard + type stub PassportElementTypeIdentityCard - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypeIdentityCard) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypeIdentityCard) GetType() string { - return TypePassportElementTypeIdentityCard + return TypePassportElementTypeIdentityCard } func (*PassportElementTypeIdentityCard) PassportElementTypeType() string { - return TypePassportElementTypeIdentityCard + return TypePassportElementTypeIdentityCard } // A Telegram Passport element containing the user's internal passport -type PassportElementTypeInternalPassport struct{ - meta +type PassportElementTypeInternalPassport struct { + meta } func (entity *PassportElementTypeInternalPassport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypeInternalPassport + type stub PassportElementTypeInternalPassport - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypeInternalPassport) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypeInternalPassport) GetType() string { - return TypePassportElementTypeInternalPassport + return TypePassportElementTypeInternalPassport } func (*PassportElementTypeInternalPassport) PassportElementTypeType() string { - return TypePassportElementTypeInternalPassport + return TypePassportElementTypeInternalPassport } // A Telegram Passport element containing the user's address -type PassportElementTypeAddress struct{ - meta +type PassportElementTypeAddress struct { + meta } func (entity *PassportElementTypeAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypeAddress + type stub PassportElementTypeAddress - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypeAddress) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypeAddress) GetType() string { - return TypePassportElementTypeAddress + return TypePassportElementTypeAddress } func (*PassportElementTypeAddress) PassportElementTypeType() string { - return TypePassportElementTypeAddress + return TypePassportElementTypeAddress } // A Telegram Passport element containing the user's utility bill -type PassportElementTypeUtilityBill struct{ - meta +type PassportElementTypeUtilityBill struct { + meta } func (entity *PassportElementTypeUtilityBill) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypeUtilityBill + type stub PassportElementTypeUtilityBill - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypeUtilityBill) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypeUtilityBill) GetType() string { - return TypePassportElementTypeUtilityBill + return TypePassportElementTypeUtilityBill } func (*PassportElementTypeUtilityBill) PassportElementTypeType() string { - return TypePassportElementTypeUtilityBill + return TypePassportElementTypeUtilityBill } // A Telegram Passport element containing the user's bank statement -type PassportElementTypeBankStatement struct{ - meta +type PassportElementTypeBankStatement struct { + meta } func (entity *PassportElementTypeBankStatement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypeBankStatement + type stub PassportElementTypeBankStatement - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypeBankStatement) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypeBankStatement) GetType() string { - return TypePassportElementTypeBankStatement + return TypePassportElementTypeBankStatement } func (*PassportElementTypeBankStatement) PassportElementTypeType() string { - return TypePassportElementTypeBankStatement + return TypePassportElementTypeBankStatement } // A Telegram Passport element containing the user's rental agreement -type PassportElementTypeRentalAgreement struct{ - meta +type PassportElementTypeRentalAgreement struct { + meta } func (entity *PassportElementTypeRentalAgreement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypeRentalAgreement + type stub PassportElementTypeRentalAgreement - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypeRentalAgreement) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypeRentalAgreement) GetType() string { - return TypePassportElementTypeRentalAgreement + return TypePassportElementTypeRentalAgreement } func (*PassportElementTypeRentalAgreement) PassportElementTypeType() string { - return TypePassportElementTypeRentalAgreement + return TypePassportElementTypeRentalAgreement } // A Telegram Passport element containing the registration page of the user's passport -type PassportElementTypePassportRegistration struct{ - meta +type PassportElementTypePassportRegistration struct { + meta } func (entity *PassportElementTypePassportRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypePassportRegistration + type stub PassportElementTypePassportRegistration - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypePassportRegistration) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypePassportRegistration) GetType() string { - return TypePassportElementTypePassportRegistration + return TypePassportElementTypePassportRegistration } func (*PassportElementTypePassportRegistration) PassportElementTypeType() string { - return TypePassportElementTypePassportRegistration + return TypePassportElementTypePassportRegistration } // A Telegram Passport element containing the user's temporary registration -type PassportElementTypeTemporaryRegistration struct{ - meta +type PassportElementTypeTemporaryRegistration struct { + meta } func (entity *PassportElementTypeTemporaryRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypeTemporaryRegistration + type stub PassportElementTypeTemporaryRegistration - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypeTemporaryRegistration) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypeTemporaryRegistration) GetType() string { - return TypePassportElementTypeTemporaryRegistration + return TypePassportElementTypeTemporaryRegistration } func (*PassportElementTypeTemporaryRegistration) PassportElementTypeType() string { - return TypePassportElementTypeTemporaryRegistration + return TypePassportElementTypeTemporaryRegistration } // A Telegram Passport element containing the user's phone number -type PassportElementTypePhoneNumber struct{ - meta +type PassportElementTypePhoneNumber struct { + meta } func (entity *PassportElementTypePhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypePhoneNumber + type stub PassportElementTypePhoneNumber - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypePhoneNumber) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypePhoneNumber) GetType() string { - return TypePassportElementTypePhoneNumber + return TypePassportElementTypePhoneNumber } func (*PassportElementTypePhoneNumber) PassportElementTypeType() string { - return TypePassportElementTypePhoneNumber + return TypePassportElementTypePhoneNumber } // A Telegram Passport element containing the user's email address -type PassportElementTypeEmailAddress struct{ - meta +type PassportElementTypeEmailAddress struct { + meta } func (entity *PassportElementTypeEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTypeEmailAddress + type stub PassportElementTypeEmailAddress - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTypeEmailAddress) GetClass() string { - return ClassPassportElementType + return ClassPassportElementType } func (*PassportElementTypeEmailAddress) GetType() string { - return TypePassportElementTypeEmailAddress + return TypePassportElementTypeEmailAddress } func (*PassportElementTypeEmailAddress) PassportElementTypeType() string { - return TypePassportElementTypeEmailAddress + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub Date + type stub Date - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Date) GetClass() string { - return ClassDate + return ClassDate } func (*Date) GetType() string { - return TypeDate + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub PersonalDetails + type stub PersonalDetails - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PersonalDetails) GetClass() string { - return ClassPersonalDetails + return ClassPersonalDetails } func (*PersonalDetails) GetType() string { - return TypePersonalDetails + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub IdentityDocument + type stub IdentityDocument - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*IdentityDocument) GetClass() string { - return ClassIdentityDocument + return ClassIdentityDocument } func (*IdentityDocument) GetType() string { - return TypeIdentityDocument + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputIdentityDocument + type stub InputIdentityDocument - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputIdentityDocument) GetClass() string { - return ClassInputIdentityDocument + return ClassInputIdentityDocument } func (*InputIdentityDocument) GetType() string { - return TypeInputIdentityDocument + 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 []InputFile `json:"translation"` - } + var tmp struct { + Number string `json:"number"` + ExpiryDate *Date `json:"expiry_date"` + FrontSide json.RawMessage `json:"front_side"` + ReverseSide json.RawMessage `json:"reverse_side"` + Selfie json.RawMessage `json:"selfie"` + Translation []InputFile `json:"translation"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inputIdentityDocument.Number = tmp.Number - inputIdentityDocument.ExpiryDate = tmp.ExpiryDate - inputIdentityDocument.Translation = tmp.Translation + inputIdentityDocument.Number = tmp.Number + inputIdentityDocument.ExpiryDate = tmp.ExpiryDate + inputIdentityDocument.Translation = tmp.Translation - fieldFrontSide, _ := UnmarshalInputFile(tmp.FrontSide) - inputIdentityDocument.FrontSide = fieldFrontSide + fieldFrontSide, _ := UnmarshalInputFile(tmp.FrontSide) + inputIdentityDocument.FrontSide = fieldFrontSide - fieldReverseSide, _ := UnmarshalInputFile(tmp.ReverseSide) - inputIdentityDocument.ReverseSide = fieldReverseSide + fieldReverseSide, _ := UnmarshalInputFile(tmp.ReverseSide) + inputIdentityDocument.ReverseSide = fieldReverseSide - fieldSelfie, _ := UnmarshalInputFile(tmp.Selfie) - inputIdentityDocument.Selfie = fieldSelfie + fieldSelfie, _ := UnmarshalInputFile(tmp.Selfie) + inputIdentityDocument.Selfie = fieldSelfie - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub PersonalDocument + type stub PersonalDocument - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PersonalDocument) GetClass() string { - return ClassPersonalDocument + return ClassPersonalDocument } func (*PersonalDocument) GetType() string { - return TypePersonalDocument + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputPersonalDocument + type stub InputPersonalDocument - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPersonalDocument) GetClass() string { - return ClassInputPersonalDocument + return ClassInputPersonalDocument } func (*InputPersonalDocument) GetType() string { - return TypeInputPersonalDocument + return TypeInputPersonalDocument } // A Telegram Passport element containing the user's personal details type PassportElementPersonalDetails struct { - meta - // Personal details of the user - PersonalDetails *PersonalDetails `json:"personal_details"` + meta + // Personal details of the user + PersonalDetails *PersonalDetails `json:"personal_details"` } func (entity *PassportElementPersonalDetails) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementPersonalDetails + type stub PassportElementPersonalDetails - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementPersonalDetails) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementPersonalDetails) GetType() string { - return TypePassportElementPersonalDetails + return TypePassportElementPersonalDetails } func (*PassportElementPersonalDetails) PassportElementType() string { - return TypePassportElementPersonalDetails + return TypePassportElementPersonalDetails } // A Telegram Passport element containing the user's passport type PassportElementPassport struct { - meta - // Passport - Passport *IdentityDocument `json:"passport"` + meta + // Passport + Passport *IdentityDocument `json:"passport"` } func (entity *PassportElementPassport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementPassport + type stub PassportElementPassport - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementPassport) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementPassport) GetType() string { - return TypePassportElementPassport + return TypePassportElementPassport } func (*PassportElementPassport) PassportElementType() string { - return TypePassportElementPassport + return TypePassportElementPassport } // A Telegram Passport element containing the user's driver license type PassportElementDriverLicense struct { - meta - // Driver license - DriverLicense *IdentityDocument `json:"driver_license"` + meta + // Driver license + DriverLicense *IdentityDocument `json:"driver_license"` } func (entity *PassportElementDriverLicense) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementDriverLicense + type stub PassportElementDriverLicense - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementDriverLicense) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementDriverLicense) GetType() string { - return TypePassportElementDriverLicense + return TypePassportElementDriverLicense } func (*PassportElementDriverLicense) PassportElementType() string { - return TypePassportElementDriverLicense + return TypePassportElementDriverLicense } // A Telegram Passport element containing the user's identity card type PassportElementIdentityCard struct { - meta - // Identity card - IdentityCard *IdentityDocument `json:"identity_card"` + meta + // Identity card + IdentityCard *IdentityDocument `json:"identity_card"` } func (entity *PassportElementIdentityCard) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementIdentityCard + type stub PassportElementIdentityCard - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementIdentityCard) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementIdentityCard) GetType() string { - return TypePassportElementIdentityCard + return TypePassportElementIdentityCard } func (*PassportElementIdentityCard) PassportElementType() string { - return TypePassportElementIdentityCard + return TypePassportElementIdentityCard } // A Telegram Passport element containing the user's internal passport type PassportElementInternalPassport struct { - meta - // Internal passport - InternalPassport *IdentityDocument `json:"internal_passport"` + meta + // Internal passport + InternalPassport *IdentityDocument `json:"internal_passport"` } func (entity *PassportElementInternalPassport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementInternalPassport + type stub PassportElementInternalPassport - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementInternalPassport) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementInternalPassport) GetType() string { - return TypePassportElementInternalPassport + return TypePassportElementInternalPassport } func (*PassportElementInternalPassport) PassportElementType() string { - return TypePassportElementInternalPassport + return TypePassportElementInternalPassport } // A Telegram Passport element containing the user's address type PassportElementAddress struct { - meta - // Address - Address *Address `json:"address"` + meta + // Address + Address *Address `json:"address"` } func (entity *PassportElementAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementAddress + type stub PassportElementAddress - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementAddress) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementAddress) GetType() string { - return TypePassportElementAddress + return TypePassportElementAddress } func (*PassportElementAddress) PassportElementType() string { - return TypePassportElementAddress + return TypePassportElementAddress } // A Telegram Passport element containing the user's utility bill type PassportElementUtilityBill struct { - meta - // Utility bill - UtilityBill *PersonalDocument `json:"utility_bill"` + meta + // Utility bill + UtilityBill *PersonalDocument `json:"utility_bill"` } func (entity *PassportElementUtilityBill) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementUtilityBill + type stub PassportElementUtilityBill - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementUtilityBill) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementUtilityBill) GetType() string { - return TypePassportElementUtilityBill + return TypePassportElementUtilityBill } func (*PassportElementUtilityBill) PassportElementType() string { - return TypePassportElementUtilityBill + return TypePassportElementUtilityBill } // A Telegram Passport element containing the user's bank statement type PassportElementBankStatement struct { - meta - // Bank statement - BankStatement *PersonalDocument `json:"bank_statement"` + meta + // Bank statement + BankStatement *PersonalDocument `json:"bank_statement"` } func (entity *PassportElementBankStatement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementBankStatement + type stub PassportElementBankStatement - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementBankStatement) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementBankStatement) GetType() string { - return TypePassportElementBankStatement + return TypePassportElementBankStatement } func (*PassportElementBankStatement) PassportElementType() string { - return TypePassportElementBankStatement + return TypePassportElementBankStatement } // A Telegram Passport element containing the user's rental agreement type PassportElementRentalAgreement struct { - meta - // Rental agreement - RentalAgreement *PersonalDocument `json:"rental_agreement"` + meta + // Rental agreement + RentalAgreement *PersonalDocument `json:"rental_agreement"` } func (entity *PassportElementRentalAgreement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementRentalAgreement + type stub PassportElementRentalAgreement - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementRentalAgreement) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementRentalAgreement) GetType() string { - return TypePassportElementRentalAgreement + return TypePassportElementRentalAgreement } func (*PassportElementRentalAgreement) PassportElementType() string { - return TypePassportElementRentalAgreement + 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"` + meta + // Passport registration pages + PassportRegistration *PersonalDocument `json:"passport_registration"` } func (entity *PassportElementPassportRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementPassportRegistration + type stub PassportElementPassportRegistration - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementPassportRegistration) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementPassportRegistration) GetType() string { - return TypePassportElementPassportRegistration + return TypePassportElementPassportRegistration } func (*PassportElementPassportRegistration) PassportElementType() string { - return TypePassportElementPassportRegistration + return TypePassportElementPassportRegistration } // A Telegram Passport element containing the user's temporary registration type PassportElementTemporaryRegistration struct { - meta - // Temporary registration - TemporaryRegistration *PersonalDocument `json:"temporary_registration"` + meta + // Temporary registration + TemporaryRegistration *PersonalDocument `json:"temporary_registration"` } func (entity *PassportElementTemporaryRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementTemporaryRegistration + type stub PassportElementTemporaryRegistration - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementTemporaryRegistration) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementTemporaryRegistration) GetType() string { - return TypePassportElementTemporaryRegistration + return TypePassportElementTemporaryRegistration } func (*PassportElementTemporaryRegistration) PassportElementType() string { - return TypePassportElementTemporaryRegistration + return TypePassportElementTemporaryRegistration } // A Telegram Passport element containing the user's phone number type PassportElementPhoneNumber struct { - meta - // Phone number - PhoneNumber string `json:"phone_number"` + meta + // Phone number + PhoneNumber string `json:"phone_number"` } func (entity *PassportElementPhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementPhoneNumber + type stub PassportElementPhoneNumber - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementPhoneNumber) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementPhoneNumber) GetType() string { - return TypePassportElementPhoneNumber + return TypePassportElementPhoneNumber } func (*PassportElementPhoneNumber) PassportElementType() string { - return TypePassportElementPhoneNumber + return TypePassportElementPhoneNumber } // A Telegram Passport element containing the user's email address type PassportElementEmailAddress struct { - meta - // Email address - EmailAddress string `json:"email_address"` + meta + // Email address + EmailAddress string `json:"email_address"` } func (entity *PassportElementEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementEmailAddress + type stub PassportElementEmailAddress - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementEmailAddress) GetClass() string { - return ClassPassportElement + return ClassPassportElement } func (*PassportElementEmailAddress) GetType() string { - return TypePassportElementEmailAddress + return TypePassportElementEmailAddress } func (*PassportElementEmailAddress) PassportElementType() string { - return TypePassportElementEmailAddress + 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"` + meta + // Personal details of the user + PersonalDetails *PersonalDetails `json:"personal_details"` } func (entity *InputPassportElementPersonalDetails) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementPersonalDetails + type stub InputPassportElementPersonalDetails - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementPersonalDetails) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementPersonalDetails) GetType() string { - return TypeInputPassportElementPersonalDetails + return TypeInputPassportElementPersonalDetails } func (*InputPassportElementPersonalDetails) InputPassportElementType() string { - return TypeInputPassportElementPersonalDetails + 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"` + meta + // The passport to be saved + Passport *InputIdentityDocument `json:"passport"` } func (entity *InputPassportElementPassport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementPassport + type stub InputPassportElementPassport - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementPassport) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementPassport) GetType() string { - return TypeInputPassportElementPassport + return TypeInputPassportElementPassport } func (*InputPassportElementPassport) InputPassportElementType() string { - return TypeInputPassportElementPassport + 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"` + meta + // The driver license to be saved + DriverLicense *InputIdentityDocument `json:"driver_license"` } func (entity *InputPassportElementDriverLicense) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementDriverLicense + type stub InputPassportElementDriverLicense - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementDriverLicense) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementDriverLicense) GetType() string { - return TypeInputPassportElementDriverLicense + return TypeInputPassportElementDriverLicense } func (*InputPassportElementDriverLicense) InputPassportElementType() string { - return TypeInputPassportElementDriverLicense + 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"` + meta + // The identity card to be saved + IdentityCard *InputIdentityDocument `json:"identity_card"` } func (entity *InputPassportElementIdentityCard) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementIdentityCard + type stub InputPassportElementIdentityCard - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementIdentityCard) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementIdentityCard) GetType() string { - return TypeInputPassportElementIdentityCard + return TypeInputPassportElementIdentityCard } func (*InputPassportElementIdentityCard) InputPassportElementType() string { - return TypeInputPassportElementIdentityCard + 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"` + meta + // The internal passport to be saved + InternalPassport *InputIdentityDocument `json:"internal_passport"` } func (entity *InputPassportElementInternalPassport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementInternalPassport + type stub InputPassportElementInternalPassport - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementInternalPassport) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementInternalPassport) GetType() string { - return TypeInputPassportElementInternalPassport + return TypeInputPassportElementInternalPassport } func (*InputPassportElementInternalPassport) InputPassportElementType() string { - return TypeInputPassportElementInternalPassport + 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"` + meta + // The address to be saved + Address *Address `json:"address"` } func (entity *InputPassportElementAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementAddress + type stub InputPassportElementAddress - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementAddress) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementAddress) GetType() string { - return TypeInputPassportElementAddress + return TypeInputPassportElementAddress } func (*InputPassportElementAddress) InputPassportElementType() string { - return TypeInputPassportElementAddress + 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"` + meta + // The utility bill to be saved + UtilityBill *InputPersonalDocument `json:"utility_bill"` } func (entity *InputPassportElementUtilityBill) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementUtilityBill + type stub InputPassportElementUtilityBill - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementUtilityBill) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementUtilityBill) GetType() string { - return TypeInputPassportElementUtilityBill + return TypeInputPassportElementUtilityBill } func (*InputPassportElementUtilityBill) InputPassportElementType() string { - return TypeInputPassportElementUtilityBill + 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"` + meta + // The bank statement to be saved + BankStatement *InputPersonalDocument `json:"bank_statement"` } func (entity *InputPassportElementBankStatement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementBankStatement + type stub InputPassportElementBankStatement - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementBankStatement) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementBankStatement) GetType() string { - return TypeInputPassportElementBankStatement + return TypeInputPassportElementBankStatement } func (*InputPassportElementBankStatement) InputPassportElementType() string { - return TypeInputPassportElementBankStatement + 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"` + meta + // The rental agreement to be saved + RentalAgreement *InputPersonalDocument `json:"rental_agreement"` } func (entity *InputPassportElementRentalAgreement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementRentalAgreement + type stub InputPassportElementRentalAgreement - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementRentalAgreement) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementRentalAgreement) GetType() string { - return TypeInputPassportElementRentalAgreement + return TypeInputPassportElementRentalAgreement } func (*InputPassportElementRentalAgreement) InputPassportElementType() string { - return TypeInputPassportElementRentalAgreement + 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"` + meta + // The passport registration page to be saved + PassportRegistration *InputPersonalDocument `json:"passport_registration"` } func (entity *InputPassportElementPassportRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementPassportRegistration + type stub InputPassportElementPassportRegistration - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementPassportRegistration) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementPassportRegistration) GetType() string { - return TypeInputPassportElementPassportRegistration + return TypeInputPassportElementPassportRegistration } func (*InputPassportElementPassportRegistration) InputPassportElementType() string { - return TypeInputPassportElementPassportRegistration + 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"` + meta + // The temporary registration document to be saved + TemporaryRegistration *InputPersonalDocument `json:"temporary_registration"` } func (entity *InputPassportElementTemporaryRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementTemporaryRegistration + type stub InputPassportElementTemporaryRegistration - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementTemporaryRegistration) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementTemporaryRegistration) GetType() string { - return TypeInputPassportElementTemporaryRegistration + return TypeInputPassportElementTemporaryRegistration } func (*InputPassportElementTemporaryRegistration) InputPassportElementType() string { - return TypeInputPassportElementTemporaryRegistration + 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"` + meta + // The phone number to be saved + PhoneNumber string `json:"phone_number"` } func (entity *InputPassportElementPhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementPhoneNumber + type stub InputPassportElementPhoneNumber - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementPhoneNumber) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementPhoneNumber) GetType() string { - return TypeInputPassportElementPhoneNumber + return TypeInputPassportElementPhoneNumber } func (*InputPassportElementPhoneNumber) InputPassportElementType() string { - return TypeInputPassportElementPhoneNumber + 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"` + meta + // The email address to be saved + EmailAddress string `json:"email_address"` } func (entity *InputPassportElementEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementEmailAddress + type stub InputPassportElementEmailAddress - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementEmailAddress) GetClass() string { - return ClassInputPassportElement + return ClassInputPassportElement } func (*InputPassportElementEmailAddress) GetType() string { - return TypeInputPassportElementEmailAddress + return TypeInputPassportElementEmailAddress } func (*InputPassportElementEmailAddress) InputPassportElementType() string { - return TypeInputPassportElementEmailAddress + return TypeInputPassportElementEmailAddress } // Contains information about saved Telegram Passport elements type PassportElements struct { - meta - // Telegram Passport elements - Elements []PassportElement `json:"elements"` + meta + // Telegram Passport elements + Elements []PassportElement `json:"elements"` } func (entity *PassportElements) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElements + type stub PassportElements - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElements) GetClass() string { - return ClassPassportElements + return ClassPassportElements } func (*PassportElements) GetType() string { - return TypePassportElements + return TypePassportElements } // The element contains an error in an unspecified place. The error will be considered resolved when new data is added -type PassportElementErrorSourceUnspecified struct{ - meta +type PassportElementErrorSourceUnspecified struct { + meta } func (entity *PassportElementErrorSourceUnspecified) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementErrorSourceUnspecified + type stub PassportElementErrorSourceUnspecified - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementErrorSourceUnspecified) GetClass() string { - return ClassPassportElementErrorSource + return ClassPassportElementErrorSource } func (*PassportElementErrorSourceUnspecified) GetType() string { - return TypePassportElementErrorSourceUnspecified + return TypePassportElementErrorSourceUnspecified } func (*PassportElementErrorSourceUnspecified) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceUnspecified + 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"` + meta + // Field name + FieldName string `json:"field_name"` } func (entity *PassportElementErrorSourceDataField) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementErrorSourceDataField + type stub PassportElementErrorSourceDataField - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementErrorSourceDataField) GetClass() string { - return ClassPassportElementErrorSource + return ClassPassportElementErrorSource } func (*PassportElementErrorSourceDataField) GetType() string { - return TypePassportElementErrorSourceDataField + return TypePassportElementErrorSourceDataField } func (*PassportElementErrorSourceDataField) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceDataField + 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 +type PassportElementErrorSourceFrontSide struct { + meta } func (entity *PassportElementErrorSourceFrontSide) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementErrorSourceFrontSide + type stub PassportElementErrorSourceFrontSide - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementErrorSourceFrontSide) GetClass() string { - return ClassPassportElementErrorSource + return ClassPassportElementErrorSource } func (*PassportElementErrorSourceFrontSide) GetType() string { - return TypePassportElementErrorSourceFrontSide + return TypePassportElementErrorSourceFrontSide } func (*PassportElementErrorSourceFrontSide) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceFrontSide + 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 +type PassportElementErrorSourceReverseSide struct { + meta } func (entity *PassportElementErrorSourceReverseSide) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementErrorSourceReverseSide + type stub PassportElementErrorSourceReverseSide - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementErrorSourceReverseSide) GetClass() string { - return ClassPassportElementErrorSource + return ClassPassportElementErrorSource } func (*PassportElementErrorSourceReverseSide) GetType() string { - return TypePassportElementErrorSourceReverseSide + return TypePassportElementErrorSourceReverseSide } func (*PassportElementErrorSourceReverseSide) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceReverseSide + 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 +type PassportElementErrorSourceSelfie struct { + meta } func (entity *PassportElementErrorSourceSelfie) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementErrorSourceSelfie + type stub PassportElementErrorSourceSelfie - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementErrorSourceSelfie) GetClass() string { - return ClassPassportElementErrorSource + return ClassPassportElementErrorSource } func (*PassportElementErrorSourceSelfie) GetType() string { - return TypePassportElementErrorSourceSelfie + return TypePassportElementErrorSourceSelfie } func (*PassportElementErrorSourceSelfie) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceSelfie + 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 +type PassportElementErrorSourceTranslationFile struct { + meta } func (entity *PassportElementErrorSourceTranslationFile) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementErrorSourceTranslationFile + type stub PassportElementErrorSourceTranslationFile - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementErrorSourceTranslationFile) GetClass() string { - return ClassPassportElementErrorSource + return ClassPassportElementErrorSource } func (*PassportElementErrorSourceTranslationFile) GetType() string { - return TypePassportElementErrorSourceTranslationFile + return TypePassportElementErrorSourceTranslationFile } func (*PassportElementErrorSourceTranslationFile) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceTranslationFile + 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 +type PassportElementErrorSourceTranslationFiles struct { + meta } func (entity *PassportElementErrorSourceTranslationFiles) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementErrorSourceTranslationFiles + type stub PassportElementErrorSourceTranslationFiles - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementErrorSourceTranslationFiles) GetClass() string { - return ClassPassportElementErrorSource + return ClassPassportElementErrorSource } func (*PassportElementErrorSourceTranslationFiles) GetType() string { - return TypePassportElementErrorSourceTranslationFiles + return TypePassportElementErrorSourceTranslationFiles } func (*PassportElementErrorSourceTranslationFiles) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceTranslationFiles + return TypePassportElementErrorSourceTranslationFiles } // The file contains an error. The error will be considered resolved when the file changes -type PassportElementErrorSourceFile struct{ - meta +type PassportElementErrorSourceFile struct { + meta } func (entity *PassportElementErrorSourceFile) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementErrorSourceFile + type stub PassportElementErrorSourceFile - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementErrorSourceFile) GetClass() string { - return ClassPassportElementErrorSource + return ClassPassportElementErrorSource } func (*PassportElementErrorSourceFile) GetType() string { - return TypePassportElementErrorSourceFile + return TypePassportElementErrorSourceFile } func (*PassportElementErrorSourceFile) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceFile + 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 +type PassportElementErrorSourceFiles struct { + meta } func (entity *PassportElementErrorSourceFiles) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportElementErrorSourceFiles + type stub PassportElementErrorSourceFiles - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementErrorSourceFiles) GetClass() string { - return ClassPassportElementErrorSource + return ClassPassportElementErrorSource } func (*PassportElementErrorSourceFiles) GetType() string { - return TypePassportElementErrorSourceFiles + return TypePassportElementErrorSourceFiles } func (*PassportElementErrorSourceFiles) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceFiles + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub PassportElementError + type stub PassportElementError - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportElementError) GetClass() string { - return ClassPassportElementError + return ClassPassportElementError } func (*PassportElementError) GetType() string { - return TypePassportElementError + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - passportElementError.Message = tmp.Message + passportElementError.Message = tmp.Message - fieldType, _ := UnmarshalPassportElementType(tmp.Type) - passportElementError.Type = fieldType + fieldType, _ := UnmarshalPassportElementType(tmp.Type) + passportElementError.Type = fieldType - fieldSource, _ := UnmarshalPassportElementErrorSource(tmp.Source) - passportElementError.Source = fieldSource + fieldSource, _ := UnmarshalPassportElementErrorSource(tmp.Source) + passportElementError.Source = fieldSource - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub PassportSuitableElement + type stub PassportSuitableElement - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportSuitableElement) GetClass() string { - return ClassPassportSuitableElement + return ClassPassportSuitableElement } func (*PassportSuitableElement) GetType() string { - return TypePassportSuitableElement + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - passportSuitableElement.IsSelfieRequired = tmp.IsSelfieRequired - passportSuitableElement.IsTranslationRequired = tmp.IsTranslationRequired - passportSuitableElement.IsNativeNameRequired = tmp.IsNativeNameRequired + passportSuitableElement.IsSelfieRequired = tmp.IsSelfieRequired + passportSuitableElement.IsTranslationRequired = tmp.IsTranslationRequired + passportSuitableElement.IsNativeNameRequired = tmp.IsNativeNameRequired - fieldType, _ := UnmarshalPassportElementType(tmp.Type) - passportSuitableElement.Type = fieldType + fieldType, _ := UnmarshalPassportElementType(tmp.Type) + passportSuitableElement.Type = fieldType - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub PassportRequiredElement + type stub PassportRequiredElement - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportRequiredElement) GetClass() string { - return ClassPassportRequiredElement + return ClassPassportRequiredElement } func (*PassportRequiredElement) GetType() string { - return TypePassportRequiredElement + 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 need to be provided to complete the form - RequiredElements []*PassportRequiredElement `json:"required_elements"` - // Already available Telegram Passport elements - Elements []PassportElement `json:"elements"` - // Errors in the elements that are already available - Errors []*PassportElementError `json:"errors"` - // URL for the privacy policy of the service; can be empty - PrivacyPolicyUrl string `json:"privacy_policy_url"` + meta + // Unique identifier of the authorization form + Id int32 `json:"id"` + // Information about the Telegram Passport elements that need to be provided to complete the form + RequiredElements []*PassportRequiredElement `json:"required_elements"` + // Already available Telegram Passport elements + Elements []PassportElement `json:"elements"` + // Errors in the elements that are already available + Errors []*PassportElementError `json:"errors"` + // URL for the privacy policy of the service; can be empty + PrivacyPolicyUrl string `json:"privacy_policy_url"` } func (entity *PassportAuthorizationForm) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PassportAuthorizationForm + type stub PassportAuthorizationForm - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PassportAuthorizationForm) GetClass() string { - return ClassPassportAuthorizationForm + return ClassPassportAuthorizationForm } func (*PassportAuthorizationForm) GetType() string { - return TypePassportAuthorizationForm + return TypePassportAuthorizationForm } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub EncryptedCredentials + type stub EncryptedCredentials - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*EncryptedCredentials) GetClass() string { - return ClassEncryptedCredentials + return ClassEncryptedCredentials } func (*EncryptedCredentials) GetType() string { - return TypeEncryptedCredentials + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub EncryptedPassportElement + type stub EncryptedPassportElement - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*EncryptedPassportElement) GetClass() string { - return ClassEncryptedPassportElement + return ClassEncryptedPassportElement } func (*EncryptedPassportElement) GetType() string { - return TypeEncryptedPassportElement + 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"` - } + 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 - } + 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 + 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 + fieldType, _ := UnmarshalPassportElementType(tmp.Type) + encryptedPassportElement.Type = fieldType - return nil + 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"` + meta + // Current hash of the entire element + ElementHash []byte `json:"element_hash"` } func (entity *InputPassportElementErrorSourceUnspecified) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementErrorSourceUnspecified + type stub InputPassportElementErrorSourceUnspecified - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementErrorSourceUnspecified) GetClass() string { - return ClassInputPassportElementErrorSource + return ClassInputPassportElementErrorSource } func (*InputPassportElementErrorSourceUnspecified) GetType() string { - return TypeInputPassportElementErrorSourceUnspecified + return TypeInputPassportElementErrorSourceUnspecified } func (*InputPassportElementErrorSourceUnspecified) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceUnspecified + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputPassportElementErrorSourceDataField + type stub InputPassportElementErrorSourceDataField - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementErrorSourceDataField) GetClass() string { - return ClassInputPassportElementErrorSource + return ClassInputPassportElementErrorSource } func (*InputPassportElementErrorSourceDataField) GetType() string { - return TypeInputPassportElementErrorSourceDataField + return TypeInputPassportElementErrorSourceDataField } func (*InputPassportElementErrorSourceDataField) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceDataField + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputPassportElementErrorSourceFrontSide + type stub InputPassportElementErrorSourceFrontSide - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementErrorSourceFrontSide) GetClass() string { - return ClassInputPassportElementErrorSource + return ClassInputPassportElementErrorSource } func (*InputPassportElementErrorSourceFrontSide) GetType() string { - return TypeInputPassportElementErrorSourceFrontSide + return TypeInputPassportElementErrorSourceFrontSide } func (*InputPassportElementErrorSourceFrontSide) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceFrontSide + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputPassportElementErrorSourceReverseSide + type stub InputPassportElementErrorSourceReverseSide - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementErrorSourceReverseSide) GetClass() string { - return ClassInputPassportElementErrorSource + return ClassInputPassportElementErrorSource } func (*InputPassportElementErrorSourceReverseSide) GetType() string { - return TypeInputPassportElementErrorSourceReverseSide + return TypeInputPassportElementErrorSourceReverseSide } func (*InputPassportElementErrorSourceReverseSide) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceReverseSide + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputPassportElementErrorSourceSelfie + type stub InputPassportElementErrorSourceSelfie - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementErrorSourceSelfie) GetClass() string { - return ClassInputPassportElementErrorSource + return ClassInputPassportElementErrorSource } func (*InputPassportElementErrorSourceSelfie) GetType() string { - return TypeInputPassportElementErrorSourceSelfie + return TypeInputPassportElementErrorSourceSelfie } func (*InputPassportElementErrorSourceSelfie) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceSelfie + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputPassportElementErrorSourceTranslationFile + type stub InputPassportElementErrorSourceTranslationFile - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementErrorSourceTranslationFile) GetClass() string { - return ClassInputPassportElementErrorSource + return ClassInputPassportElementErrorSource } func (*InputPassportElementErrorSourceTranslationFile) GetType() string { - return TypeInputPassportElementErrorSourceTranslationFile + return TypeInputPassportElementErrorSourceTranslationFile } func (*InputPassportElementErrorSourceTranslationFile) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceTranslationFile + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputPassportElementErrorSourceTranslationFiles + type stub InputPassportElementErrorSourceTranslationFiles - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementErrorSourceTranslationFiles) GetClass() string { - return ClassInputPassportElementErrorSource + return ClassInputPassportElementErrorSource } func (*InputPassportElementErrorSourceTranslationFiles) GetType() string { - return TypeInputPassportElementErrorSourceTranslationFiles + return TypeInputPassportElementErrorSourceTranslationFiles } func (*InputPassportElementErrorSourceTranslationFiles) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceTranslationFiles + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputPassportElementErrorSourceFile + type stub InputPassportElementErrorSourceFile - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementErrorSourceFile) GetClass() string { - return ClassInputPassportElementErrorSource + return ClassInputPassportElementErrorSource } func (*InputPassportElementErrorSourceFile) GetType() string { - return TypeInputPassportElementErrorSourceFile + return TypeInputPassportElementErrorSourceFile } func (*InputPassportElementErrorSourceFile) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceFile + 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"` + meta + // Current hashes of all attached files + FileHashes [][]byte `json:"file_hashes"` } func (entity *InputPassportElementErrorSourceFiles) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputPassportElementErrorSourceFiles + type stub InputPassportElementErrorSourceFiles - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementErrorSourceFiles) GetClass() string { - return ClassInputPassportElementErrorSource + return ClassInputPassportElementErrorSource } func (*InputPassportElementErrorSourceFiles) GetType() string { - return TypeInputPassportElementErrorSourceFiles + return TypeInputPassportElementErrorSourceFiles } func (*InputPassportElementErrorSourceFiles) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceFiles + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputPassportElementError + type stub InputPassportElementError - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputPassportElementError) GetClass() string { - return ClassInputPassportElementError + return ClassInputPassportElementError } func (*InputPassportElementError) GetType() string { - return TypeInputPassportElementError + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inputPassportElementError.Message = tmp.Message + inputPassportElementError.Message = tmp.Message - fieldType, _ := UnmarshalPassportElementType(tmp.Type) - inputPassportElementError.Type = fieldType + fieldType, _ := UnmarshalPassportElementType(tmp.Type) + inputPassportElementError.Type = fieldType - fieldSource, _ := UnmarshalInputPassportElementErrorSource(tmp.Source) - inputPassportElementError.Source = fieldSource + fieldSource, _ := UnmarshalInputPassportElementErrorSource(tmp.Source) + inputPassportElementError.Source = fieldSource - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub MessageText + type stub MessageText - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageText) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageText) GetType() string { - return TypeMessageText + return TypeMessageText } func (*MessageText) MessageContentType() string { - return TypeMessageText + return TypeMessageText } // An animation message (GIF-style). type MessageAnimation struct { - meta - // Message content - Animation *Animation `json:"animation"` - // Animation caption - Caption *FormattedText `json:"caption"` - // True, if the animation thumbnail must be blurred and the animation must be shown only while tapped - IsSecret bool `json:"is_secret"` + meta + // Message content + Animation *Animation `json:"animation"` + // Animation caption + Caption *FormattedText `json:"caption"` + // True, if the animation thumbnail must be blurred and the animation must be shown only while tapped + IsSecret bool `json:"is_secret"` } func (entity *MessageAnimation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageAnimation + type stub MessageAnimation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageAnimation) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageAnimation) GetType() string { - return TypeMessageAnimation + return TypeMessageAnimation } func (*MessageAnimation) MessageContentType() string { - return TypeMessageAnimation + return TypeMessageAnimation } // An audio message type MessageAudio struct { - meta - // Message content - Audio *Audio `json:"audio"` - // Audio caption - Caption *FormattedText `json:"caption"` + meta + // Message content + Audio *Audio `json:"audio"` + // Audio caption + Caption *FormattedText `json:"caption"` } func (entity *MessageAudio) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageAudio + type stub MessageAudio - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageAudio) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageAudio) GetType() string { - return TypeMessageAudio + return TypeMessageAudio } func (*MessageAudio) MessageContentType() string { - return TypeMessageAudio + return TypeMessageAudio } // A document message (general file) type MessageDocument struct { - meta - // Message content - Document *Document `json:"document"` - // Document caption - Caption *FormattedText `json:"caption"` + meta + // Message content + Document *Document `json:"document"` + // Document caption + Caption *FormattedText `json:"caption"` } func (entity *MessageDocument) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageDocument + type stub MessageDocument - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageDocument) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageDocument) GetType() string { - return TypeMessageDocument + return TypeMessageDocument } func (*MessageDocument) MessageContentType() string { - return TypeMessageDocument + return TypeMessageDocument } // A photo message type MessagePhoto struct { - meta - // Message content - Photo *Photo `json:"photo"` - // Photo caption - Caption *FormattedText `json:"caption"` - // True, if the photo must be blurred and must be shown only while tapped - IsSecret bool `json:"is_secret"` + meta + // Message content + Photo *Photo `json:"photo"` + // Photo caption + Caption *FormattedText `json:"caption"` + // True, if the photo must be blurred and must be shown only while tapped + IsSecret bool `json:"is_secret"` } func (entity *MessagePhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessagePhoto + type stub MessagePhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessagePhoto) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessagePhoto) GetType() string { - return TypeMessagePhoto + return TypeMessagePhoto } func (*MessagePhoto) MessageContentType() string { - return TypeMessagePhoto + return TypeMessagePhoto } // An expired photo message (self-destructed after TTL has elapsed) -type MessageExpiredPhoto struct{ - meta +type MessageExpiredPhoto struct { + meta } func (entity *MessageExpiredPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageExpiredPhoto + type stub MessageExpiredPhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageExpiredPhoto) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageExpiredPhoto) GetType() string { - return TypeMessageExpiredPhoto + return TypeMessageExpiredPhoto } func (*MessageExpiredPhoto) MessageContentType() string { - return TypeMessageExpiredPhoto + return TypeMessageExpiredPhoto } // A sticker message type MessageSticker struct { - meta - // Message content - Sticker *Sticker `json:"sticker"` + meta + // Message content + Sticker *Sticker `json:"sticker"` } func (entity *MessageSticker) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageSticker + type stub MessageSticker - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageSticker) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageSticker) GetType() string { - return TypeMessageSticker + return TypeMessageSticker } func (*MessageSticker) MessageContentType() string { - return TypeMessageSticker + return TypeMessageSticker } // A video message type MessageVideo struct { - meta - // Message content - Video *Video `json:"video"` - // Video caption - Caption *FormattedText `json:"caption"` - // True, if the video thumbnail must be blurred and the video must be shown only while tapped - IsSecret bool `json:"is_secret"` + meta + // Message content + Video *Video `json:"video"` + // Video caption + Caption *FormattedText `json:"caption"` + // True, if the video thumbnail must be blurred and the video must be shown only while tapped + IsSecret bool `json:"is_secret"` } func (entity *MessageVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageVideo + type stub MessageVideo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageVideo) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageVideo) GetType() string { - return TypeMessageVideo + return TypeMessageVideo } func (*MessageVideo) MessageContentType() string { - return TypeMessageVideo + return TypeMessageVideo } // An expired video message (self-destructed after TTL has elapsed) -type MessageExpiredVideo struct{ - meta +type MessageExpiredVideo struct { + meta } func (entity *MessageExpiredVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageExpiredVideo + type stub MessageExpiredVideo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageExpiredVideo) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageExpiredVideo) GetType() string { - return TypeMessageExpiredVideo + return TypeMessageExpiredVideo } func (*MessageExpiredVideo) MessageContentType() string { - return TypeMessageExpiredVideo + return TypeMessageExpiredVideo } // A video note message type MessageVideoNote struct { - meta - // Message content - VideoNote *VideoNote `json:"video_note"` - // True, if at least one of the recipients has viewed the video note - IsViewed bool `json:"is_viewed"` - // True, if the video note thumbnail must be blurred and the video note must be shown only while tapped - IsSecret bool `json:"is_secret"` + meta + // Message content + VideoNote *VideoNote `json:"video_note"` + // True, if at least one of the recipients has viewed the video note + IsViewed bool `json:"is_viewed"` + // True, if the video note thumbnail must be blurred and the video note must be shown only while tapped + IsSecret bool `json:"is_secret"` } func (entity *MessageVideoNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageVideoNote + type stub MessageVideoNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageVideoNote) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageVideoNote) GetType() string { - return TypeMessageVideoNote + return TypeMessageVideoNote } func (*MessageVideoNote) MessageContentType() string { - return TypeMessageVideoNote + return TypeMessageVideoNote } // A voice note message type MessageVoiceNote struct { - meta - // Message content - VoiceNote *VoiceNote `json:"voice_note"` - // Voice note caption - Caption *FormattedText `json:"caption"` - // True, if at least one of the recipients has listened to the voice note - IsListened bool `json:"is_listened"` + meta + // Message content + VoiceNote *VoiceNote `json:"voice_note"` + // Voice note caption + Caption *FormattedText `json:"caption"` + // True, if at least one of the recipients has listened to the voice note + IsListened bool `json:"is_listened"` } func (entity *MessageVoiceNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageVoiceNote + type stub MessageVoiceNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageVoiceNote) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageVoiceNote) GetType() string { - return TypeMessageVoiceNote + return TypeMessageVoiceNote } func (*MessageVoiceNote) MessageContentType() string { - return TypeMessageVoiceNote + return TypeMessageVoiceNote } // A message with a location type MessageLocation struct { - meta - // Message content - Location *Location `json:"location"` - // Time relative to the message sent date until which the location can be updated, in seconds - LivePeriod int32 `json:"live_period"` - // Left time for which the location can be updated, in seconds. updateMessageContent is not sent when this field changes - ExpiresIn int32 `json:"expires_in"` + meta + // Message content + Location *Location `json:"location"` + // Time relative to the message sent date until which the location can be updated, in seconds + LivePeriod int32 `json:"live_period"` + // Left time for which the location can be updated, in seconds. updateMessageContent is not sent when this field changes + ExpiresIn int32 `json:"expires_in"` } func (entity *MessageLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageLocation + type stub MessageLocation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageLocation) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageLocation) GetType() string { - return TypeMessageLocation + return TypeMessageLocation } func (*MessageLocation) MessageContentType() string { - return TypeMessageLocation + return TypeMessageLocation } // A message with information about a venue type MessageVenue struct { - meta - // Message content - Venue *Venue `json:"venue"` + meta + // Message content + Venue *Venue `json:"venue"` } func (entity *MessageVenue) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageVenue + type stub MessageVenue - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageVenue) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageVenue) GetType() string { - return TypeMessageVenue + return TypeMessageVenue } func (*MessageVenue) MessageContentType() string { - return TypeMessageVenue + return TypeMessageVenue } // A message with a user contact type MessageContact struct { - meta - // Message content - Contact *Contact `json:"contact"` + meta + // Message content + Contact *Contact `json:"contact"` } func (entity *MessageContact) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageContact + type stub MessageContact - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageContact) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageContact) GetType() string { - return TypeMessageContact + return TypeMessageContact } func (*MessageContact) MessageContentType() string { - return TypeMessageContact + return TypeMessageContact } // A message with a game type MessageGame struct { - meta - // Game - Game *Game `json:"game"` + meta + // Game + Game *Game `json:"game"` } func (entity *MessageGame) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageGame + type stub MessageGame - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageGame) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageGame) GetType() string { - return TypeMessageGame + return TypeMessageGame } func (*MessageGame) MessageContentType() string { - return TypeMessageGame + return TypeMessageGame } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub MessageInvoice + type stub MessageInvoice - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageInvoice) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageInvoice) GetType() string { - return TypeMessageInvoice + return TypeMessageInvoice } func (*MessageInvoice) MessageContentType() string { - return TypeMessageInvoice + return TypeMessageInvoice } // A message with information about an ended call type MessageCall struct { - meta - // Reason why the call was discarded - DiscardReason CallDiscardReason `json:"discard_reason"` - // Call duration, in seconds - Duration int32 `json:"duration"` + meta + // 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() + entity.meta.Type = entity.GetType() - type stub MessageCall + type stub MessageCall - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageCall) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageCall) GetType() string { - return TypeMessageCall + return TypeMessageCall } func (*MessageCall) MessageContentType() string { - return TypeMessageCall + return TypeMessageCall } func (messageCall *MessageCall) UnmarshalJSON(data []byte) error { - var tmp struct { - DiscardReason json.RawMessage `json:"discard_reason"` - Duration int32 `json:"duration"` - } + var tmp struct { + DiscardReason json.RawMessage `json:"discard_reason"` + Duration int32 `json:"duration"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - messageCall.Duration = tmp.Duration + messageCall.Duration = tmp.Duration - fieldDiscardReason, _ := UnmarshalCallDiscardReason(tmp.DiscardReason) - messageCall.DiscardReason = fieldDiscardReason + fieldDiscardReason, _ := UnmarshalCallDiscardReason(tmp.DiscardReason) + messageCall.DiscardReason = fieldDiscardReason - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub MessageBasicGroupChatCreate + type stub MessageBasicGroupChatCreate - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageBasicGroupChatCreate) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageBasicGroupChatCreate) GetType() string { - return TypeMessageBasicGroupChatCreate + return TypeMessageBasicGroupChatCreate } func (*MessageBasicGroupChatCreate) MessageContentType() string { - return TypeMessageBasicGroupChatCreate + return TypeMessageBasicGroupChatCreate } // A newly created supergroup or channel type MessageSupergroupChatCreate struct { - meta - // Title of the supergroup or channel - Title string `json:"title"` + meta + // Title of the supergroup or channel + Title string `json:"title"` } func (entity *MessageSupergroupChatCreate) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageSupergroupChatCreate + type stub MessageSupergroupChatCreate - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageSupergroupChatCreate) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageSupergroupChatCreate) GetType() string { - return TypeMessageSupergroupChatCreate + return TypeMessageSupergroupChatCreate } func (*MessageSupergroupChatCreate) MessageContentType() string { - return TypeMessageSupergroupChatCreate + return TypeMessageSupergroupChatCreate } // An updated chat title type MessageChatChangeTitle struct { - meta - // New chat title - Title string `json:"title"` + meta + // New chat title + Title string `json:"title"` } func (entity *MessageChatChangeTitle) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageChatChangeTitle + type stub MessageChatChangeTitle - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageChatChangeTitle) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageChatChangeTitle) GetType() string { - return TypeMessageChatChangeTitle + return TypeMessageChatChangeTitle } func (*MessageChatChangeTitle) MessageContentType() string { - return TypeMessageChatChangeTitle + return TypeMessageChatChangeTitle } // An updated chat photo type MessageChatChangePhoto struct { - meta - // New chat photo - Photo *Photo `json:"photo"` + meta + // New chat photo + Photo *Photo `json:"photo"` } func (entity *MessageChatChangePhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageChatChangePhoto + type stub MessageChatChangePhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageChatChangePhoto) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageChatChangePhoto) GetType() string { - return TypeMessageChatChangePhoto + return TypeMessageChatChangePhoto } func (*MessageChatChangePhoto) MessageContentType() string { - return TypeMessageChatChangePhoto + return TypeMessageChatChangePhoto } // A deleted chat photo -type MessageChatDeletePhoto struct{ - meta +type MessageChatDeletePhoto struct { + meta } func (entity *MessageChatDeletePhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageChatDeletePhoto + type stub MessageChatDeletePhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageChatDeletePhoto) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageChatDeletePhoto) GetType() string { - return TypeMessageChatDeletePhoto + return TypeMessageChatDeletePhoto } func (*MessageChatDeletePhoto) MessageContentType() string { - return TypeMessageChatDeletePhoto + return TypeMessageChatDeletePhoto } // New chat members were added type MessageChatAddMembers struct { - meta - // User identifiers of the new members - MemberUserIds []int32 `json:"member_user_ids"` + meta + // User identifiers of the new members + MemberUserIds []int32 `json:"member_user_ids"` } func (entity *MessageChatAddMembers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageChatAddMembers + type stub MessageChatAddMembers - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageChatAddMembers) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageChatAddMembers) GetType() string { - return TypeMessageChatAddMembers + return TypeMessageChatAddMembers } func (*MessageChatAddMembers) MessageContentType() string { - return TypeMessageChatAddMembers + return TypeMessageChatAddMembers } // A new member joined the chat by invite link -type MessageChatJoinByLink struct{ - meta +type MessageChatJoinByLink struct { + meta } func (entity *MessageChatJoinByLink) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageChatJoinByLink + type stub MessageChatJoinByLink - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageChatJoinByLink) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageChatJoinByLink) GetType() string { - return TypeMessageChatJoinByLink + return TypeMessageChatJoinByLink } func (*MessageChatJoinByLink) MessageContentType() string { - return TypeMessageChatJoinByLink + return TypeMessageChatJoinByLink } // A chat member was deleted type MessageChatDeleteMember struct { - meta - // User identifier of the deleted chat member - UserId int32 `json:"user_id"` + meta + // User identifier of the deleted chat member + UserId int32 `json:"user_id"` } func (entity *MessageChatDeleteMember) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageChatDeleteMember + type stub MessageChatDeleteMember - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageChatDeleteMember) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageChatDeleteMember) GetType() string { - return TypeMessageChatDeleteMember + return TypeMessageChatDeleteMember } func (*MessageChatDeleteMember) MessageContentType() string { - return TypeMessageChatDeleteMember + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub MessageChatUpgradeTo + type stub MessageChatUpgradeTo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageChatUpgradeTo) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageChatUpgradeTo) GetType() string { - return TypeMessageChatUpgradeTo + return TypeMessageChatUpgradeTo } func (*MessageChatUpgradeTo) MessageContentType() string { - return TypeMessageChatUpgradeTo + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub MessageChatUpgradeFrom + type stub MessageChatUpgradeFrom - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageChatUpgradeFrom) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageChatUpgradeFrom) GetType() string { - return TypeMessageChatUpgradeFrom + return TypeMessageChatUpgradeFrom } func (*MessageChatUpgradeFrom) MessageContentType() string { - return TypeMessageChatUpgradeFrom + return TypeMessageChatUpgradeFrom } // A message has been pinned type MessagePinMessage struct { - meta - // Identifier of the pinned message, can be an identifier of a deleted message - MessageId int64 `json:"message_id"` + meta + // Identifier of the pinned message, can be an identifier of a deleted message + MessageId int64 `json:"message_id"` } func (entity *MessagePinMessage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessagePinMessage + type stub MessagePinMessage - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessagePinMessage) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessagePinMessage) GetType() string { - return TypeMessagePinMessage + return TypeMessagePinMessage } func (*MessagePinMessage) MessageContentType() string { - return TypeMessagePinMessage + return TypeMessagePinMessage } // A screenshot of a message in the chat has been taken -type MessageScreenshotTaken struct{ - meta +type MessageScreenshotTaken struct { + meta } func (entity *MessageScreenshotTaken) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageScreenshotTaken + type stub MessageScreenshotTaken - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageScreenshotTaken) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageScreenshotTaken) GetType() string { - return TypeMessageScreenshotTaken + return TypeMessageScreenshotTaken } func (*MessageScreenshotTaken) MessageContentType() string { - return TypeMessageScreenshotTaken + 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"` + meta + // New TTL + Ttl int32 `json:"ttl"` } func (entity *MessageChatSetTtl) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageChatSetTtl + type stub MessageChatSetTtl - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageChatSetTtl) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageChatSetTtl) GetType() string { - return TypeMessageChatSetTtl + return TypeMessageChatSetTtl } func (*MessageChatSetTtl) MessageContentType() string { - return TypeMessageChatSetTtl + 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"` + meta + // Message text to be shown in the chat + Text string `json:"text"` } func (entity *MessageCustomServiceAction) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageCustomServiceAction + type stub MessageCustomServiceAction - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageCustomServiceAction) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageCustomServiceAction) GetType() string { - return TypeMessageCustomServiceAction + return TypeMessageCustomServiceAction } func (*MessageCustomServiceAction) MessageContentType() string { - return TypeMessageCustomServiceAction + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub MessageGameScore + type stub MessageGameScore - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageGameScore) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageGameScore) GetType() string { - return TypeMessageGameScore + return TypeMessageGameScore } func (*MessageGameScore) MessageContentType() string { - return TypeMessageGameScore + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub MessagePaymentSuccessful + type stub MessagePaymentSuccessful - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessagePaymentSuccessful) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessagePaymentSuccessful) GetType() string { - return TypeMessagePaymentSuccessful + return TypeMessagePaymentSuccessful } func (*MessagePaymentSuccessful) MessageContentType() string { - return TypeMessagePaymentSuccessful + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub MessagePaymentSuccessfulBot + type stub MessagePaymentSuccessfulBot - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessagePaymentSuccessfulBot) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessagePaymentSuccessfulBot) GetType() string { - return TypeMessagePaymentSuccessfulBot + return TypeMessagePaymentSuccessfulBot } func (*MessagePaymentSuccessfulBot) MessageContentType() string { - return TypeMessagePaymentSuccessfulBot + return TypeMessagePaymentSuccessfulBot } // A contact has registered with Telegram -type MessageContactRegistered struct{ - meta +type MessageContactRegistered struct { + meta } func (entity *MessageContactRegistered) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageContactRegistered + type stub MessageContactRegistered - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageContactRegistered) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageContactRegistered) GetType() string { - return TypeMessageContactRegistered + return TypeMessageContactRegistered } func (*MessageContactRegistered) MessageContentType() string { - return TypeMessageContactRegistered + 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"` + meta + // Domain name of the connected website + DomainName string `json:"domain_name"` } func (entity *MessageWebsiteConnected) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageWebsiteConnected + type stub MessageWebsiteConnected - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageWebsiteConnected) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageWebsiteConnected) GetType() string { - return TypeMessageWebsiteConnected + return TypeMessageWebsiteConnected } func (*MessageWebsiteConnected) MessageContentType() string { - return TypeMessageWebsiteConnected + return TypeMessageWebsiteConnected } // Telegram Passport data has been sent type MessagePassportDataSent struct { - meta - // List of Telegram Passport element types sent - Types []PassportElementType `json:"types"` + meta + // List of Telegram Passport element types sent + Types []PassportElementType `json:"types"` } func (entity *MessagePassportDataSent) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessagePassportDataSent + type stub MessagePassportDataSent - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessagePassportDataSent) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessagePassportDataSent) GetType() string { - return TypeMessagePassportDataSent + return TypeMessagePassportDataSent } func (*MessagePassportDataSent) MessageContentType() string { - return TypeMessagePassportDataSent + return TypeMessagePassportDataSent } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub MessagePassportDataReceived + type stub MessagePassportDataReceived - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessagePassportDataReceived) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessagePassportDataReceived) GetType() string { - return TypeMessagePassportDataReceived + return TypeMessagePassportDataReceived } func (*MessagePassportDataReceived) MessageContentType() string { - return TypeMessagePassportDataReceived + return TypeMessagePassportDataReceived } // Message content that is not supported by the client -type MessageUnsupported struct{ - meta +type MessageUnsupported struct { + meta } func (entity *MessageUnsupported) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MessageUnsupported + type stub MessageUnsupported - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MessageUnsupported) GetClass() string { - return ClassMessageContent + return ClassMessageContent } func (*MessageUnsupported) GetType() string { - return TypeMessageUnsupported + return TypeMessageUnsupported } func (*MessageUnsupported) MessageContentType() string { - return TypeMessageUnsupported + return TypeMessageUnsupported } // A mention of a user by their username -type TextEntityTypeMention struct{ - meta +type TextEntityTypeMention struct { + meta } func (entity *TextEntityTypeMention) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntityTypeMention + type stub TextEntityTypeMention - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypeMention) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypeMention) GetType() string { - return TypeTextEntityTypeMention + return TypeTextEntityTypeMention } func (*TextEntityTypeMention) TextEntityTypeType() string { - return TypeTextEntityTypeMention + return TypeTextEntityTypeMention } // A hashtag text, beginning with "#" -type TextEntityTypeHashtag struct{ - meta +type TextEntityTypeHashtag struct { + meta } func (entity *TextEntityTypeHashtag) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntityTypeHashtag + type stub TextEntityTypeHashtag - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypeHashtag) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypeHashtag) GetType() string { - return TypeTextEntityTypeHashtag + return TypeTextEntityTypeHashtag } func (*TextEntityTypeHashtag) TextEntityTypeType() string { - return TypeTextEntityTypeHashtag + return TypeTextEntityTypeHashtag } // A cashtag text, beginning with "$" and consisting of capital english letters (i.e. "$USD") -type TextEntityTypeCashtag struct{ - meta +type TextEntityTypeCashtag struct { + meta } func (entity *TextEntityTypeCashtag) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntityTypeCashtag + type stub TextEntityTypeCashtag - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypeCashtag) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypeCashtag) GetType() string { - return TypeTextEntityTypeCashtag + return TypeTextEntityTypeCashtag } func (*TextEntityTypeCashtag) TextEntityTypeType() string { - return TypeTextEntityTypeCashtag + return TypeTextEntityTypeCashtag } // A bot command, beginning with "/". This shouldn't be highlighted if there are no bots in the chat -type TextEntityTypeBotCommand struct{ - meta +type TextEntityTypeBotCommand struct { + meta } func (entity *TextEntityTypeBotCommand) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntityTypeBotCommand + type stub TextEntityTypeBotCommand - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypeBotCommand) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypeBotCommand) GetType() string { - return TypeTextEntityTypeBotCommand + return TypeTextEntityTypeBotCommand } func (*TextEntityTypeBotCommand) TextEntityTypeType() string { - return TypeTextEntityTypeBotCommand + return TypeTextEntityTypeBotCommand } // An HTTP URL -type TextEntityTypeUrl struct{ - meta +type TextEntityTypeUrl struct { + meta } func (entity *TextEntityTypeUrl) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntityTypeUrl + type stub TextEntityTypeUrl - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypeUrl) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypeUrl) GetType() string { - return TypeTextEntityTypeUrl + return TypeTextEntityTypeUrl } func (*TextEntityTypeUrl) TextEntityTypeType() string { - return TypeTextEntityTypeUrl + return TypeTextEntityTypeUrl } // An email address -type TextEntityTypeEmailAddress struct{ - meta +type TextEntityTypeEmailAddress struct { + meta } func (entity *TextEntityTypeEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntityTypeEmailAddress + type stub TextEntityTypeEmailAddress - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypeEmailAddress) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypeEmailAddress) GetType() string { - return TypeTextEntityTypeEmailAddress + return TypeTextEntityTypeEmailAddress } func (*TextEntityTypeEmailAddress) TextEntityTypeType() string { - return TypeTextEntityTypeEmailAddress + return TypeTextEntityTypeEmailAddress } // A bold text -type TextEntityTypeBold struct{ - meta +type TextEntityTypeBold struct { + meta } func (entity *TextEntityTypeBold) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntityTypeBold + type stub TextEntityTypeBold - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypeBold) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypeBold) GetType() string { - return TypeTextEntityTypeBold + return TypeTextEntityTypeBold } func (*TextEntityTypeBold) TextEntityTypeType() string { - return TypeTextEntityTypeBold + return TypeTextEntityTypeBold } // An italic text -type TextEntityTypeItalic struct{ - meta +type TextEntityTypeItalic struct { + meta } func (entity *TextEntityTypeItalic) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntityTypeItalic + type stub TextEntityTypeItalic - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypeItalic) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypeItalic) GetType() string { - return TypeTextEntityTypeItalic + return TypeTextEntityTypeItalic } func (*TextEntityTypeItalic) TextEntityTypeType() string { - return TypeTextEntityTypeItalic + return TypeTextEntityTypeItalic } // Text that must be formatted as if inside a code HTML tag -type TextEntityTypeCode struct{ - meta +type TextEntityTypeCode struct { + meta } func (entity *TextEntityTypeCode) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntityTypeCode + type stub TextEntityTypeCode - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypeCode) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypeCode) GetType() string { - return TypeTextEntityTypeCode + return TypeTextEntityTypeCode } func (*TextEntityTypeCode) TextEntityTypeType() string { - return TypeTextEntityTypeCode + return TypeTextEntityTypeCode } // Text that must be formatted as if inside a pre HTML tag -type TextEntityTypePre struct{ - meta +type TextEntityTypePre struct { + meta } func (entity *TextEntityTypePre) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntityTypePre + type stub TextEntityTypePre - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypePre) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypePre) GetType() string { - return TypeTextEntityTypePre + return TypeTextEntityTypePre } func (*TextEntityTypePre) TextEntityTypeType() string { - return TypeTextEntityTypePre + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub TextEntityTypePreCode + type stub TextEntityTypePreCode - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypePreCode) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypePreCode) GetType() string { - return TypeTextEntityTypePreCode + return TypeTextEntityTypePreCode } func (*TextEntityTypePreCode) TextEntityTypeType() string { - return TypeTextEntityTypePreCode + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub TextEntityTypeTextUrl + type stub TextEntityTypeTextUrl - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypeTextUrl) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypeTextUrl) GetType() string { - return TypeTextEntityTypeTextUrl + return TypeTextEntityTypeTextUrl } func (*TextEntityTypeTextUrl) TextEntityTypeType() string { - return TypeTextEntityTypeTextUrl + 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"` + meta + // Identifier of the mentioned user + UserId int32 `json:"user_id"` } func (entity *TextEntityTypeMentionName) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntityTypeMentionName + type stub TextEntityTypeMentionName - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypeMentionName) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypeMentionName) GetType() string { - return TypeTextEntityTypeMentionName + return TypeTextEntityTypeMentionName } func (*TextEntityTypeMentionName) TextEntityTypeType() string { - return TypeTextEntityTypeMentionName + return TypeTextEntityTypeMentionName } // A phone number -type TextEntityTypePhoneNumber struct{ - meta +type TextEntityTypePhoneNumber struct { + meta } func (entity *TextEntityTypePhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntityTypePhoneNumber + type stub TextEntityTypePhoneNumber - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntityTypePhoneNumber) GetClass() string { - return ClassTextEntityType + return ClassTextEntityType } func (*TextEntityTypePhoneNumber) GetType() string { - return TypeTextEntityTypePhoneNumber + return TypeTextEntityTypePhoneNumber } func (*TextEntityTypePhoneNumber) TextEntityTypeType() string { - return TypeTextEntityTypePhoneNumber + return TypeTextEntityTypePhoneNumber } // A thumbnail to be sent along with a file; should be in JPEG or WEBP format for stickers, and less than 200 kB in size type InputThumbnail struct { - meta - // Thumbnail file to send. Sending thumbnails by file_id is currently not supported - Thumbnail InputFile `json:"thumbnail"` - // Thumbnail width, usually shouldn't exceed 90. Use 0 if unknown - Width int32 `json:"width"` - // Thumbnail height, usually shouldn't exceed 90. Use 0 if unknown - Height int32 `json:"height"` + meta + // Thumbnail file to send. Sending thumbnails by file_id is currently not supported + Thumbnail InputFile `json:"thumbnail"` + // Thumbnail width, usually shouldn't exceed 90. Use 0 if unknown + Width int32 `json:"width"` + // Thumbnail height, usually shouldn't exceed 90. Use 0 if unknown + Height int32 `json:"height"` } func (entity *InputThumbnail) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputThumbnail + type stub InputThumbnail - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputThumbnail) GetClass() string { - return ClassInputThumbnail + return ClassInputThumbnail } func (*InputThumbnail) GetType() string { - return TypeInputThumbnail + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inputThumbnail.Width = tmp.Width - inputThumbnail.Height = tmp.Height + inputThumbnail.Width = tmp.Width + inputThumbnail.Height = tmp.Height - fieldThumbnail, _ := UnmarshalInputFile(tmp.Thumbnail) - inputThumbnail.Thumbnail = fieldThumbnail + fieldThumbnail, _ := UnmarshalInputFile(tmp.Thumbnail) + inputThumbnail.Thumbnail = fieldThumbnail - return nil + return nil } // A text message type InputMessageText struct { - meta - // Formatted text to be sent; 1-GetOption("message_text_length_max") characters. Only Bold, Italic, Code, Pre, PreCode and TextUrl entities are allowed to be specified manually - Text *FormattedText `json:"text"` - // True, if rich web page previews for URLs in the message text should be disabled - DisableWebPagePreview bool `json:"disable_web_page_preview"` - // True, if a chat message draft should be deleted - ClearDraft bool `json:"clear_draft"` + meta + // Formatted text to be sent; 1-GetOption("message_text_length_max") characters. Only Bold, Italic, Code, Pre, PreCode and TextUrl entities are allowed to be specified manually + Text *FormattedText `json:"text"` + // True, if rich web page previews for URLs in the message text should be disabled + DisableWebPagePreview bool `json:"disable_web_page_preview"` + // True, if a chat message draft should be deleted + ClearDraft bool `json:"clear_draft"` } func (entity *InputMessageText) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputMessageText + type stub InputMessageText - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageText) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageText) GetType() string { - return TypeInputMessageText + return TypeInputMessageText } func (*InputMessageText) InputMessageContentType() string { - return TypeInputMessageText + 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"` - // 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"` + meta + // Animation file to be sent + Animation InputFile `json:"animation"` + // Animation thumbnail, if available + Thumbnail *InputThumbnail `json:"thumbnail"` + // Duration of the animation, in seconds + Duration int32 `json:"duration"` + // Width of the animation; may be replaced by the server + Width int32 `json:"width"` + // Height of the animation; may be replaced by the server + Height int32 `json:"height"` + // Animation caption; 0-GetOption("message_caption_length_max") characters + Caption *FormattedText `json:"caption"` } func (entity *InputMessageAnimation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputMessageAnimation + type stub InputMessageAnimation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageAnimation) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageAnimation) GetType() string { - return TypeInputMessageAnimation + return TypeInputMessageAnimation } func (*InputMessageAnimation) InputMessageContentType() string { - return TypeInputMessageAnimation + return TypeInputMessageAnimation } func (inputMessageAnimation *InputMessageAnimation) UnmarshalJSON(data []byte) error { - var tmp struct { - Animation json.RawMessage `json:"animation"` - Thumbnail *InputThumbnail `json:"thumbnail"` - Duration int32 `json:"duration"` - Width int32 `json:"width"` - Height int32 `json:"height"` - Caption *FormattedText `json:"caption"` - } + var tmp struct { + Animation json.RawMessage `json:"animation"` + Thumbnail *InputThumbnail `json:"thumbnail"` + Duration int32 `json:"duration"` + Width int32 `json:"width"` + Height int32 `json:"height"` + Caption *FormattedText `json:"caption"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inputMessageAnimation.Thumbnail = tmp.Thumbnail - inputMessageAnimation.Duration = tmp.Duration - inputMessageAnimation.Width = tmp.Width - inputMessageAnimation.Height = tmp.Height - inputMessageAnimation.Caption = tmp.Caption + inputMessageAnimation.Thumbnail = tmp.Thumbnail + inputMessageAnimation.Duration = tmp.Duration + inputMessageAnimation.Width = tmp.Width + inputMessageAnimation.Height = tmp.Height + inputMessageAnimation.Caption = tmp.Caption - fieldAnimation, _ := UnmarshalInputFile(tmp.Animation) - inputMessageAnimation.Animation = fieldAnimation + fieldAnimation, _ := UnmarshalInputFile(tmp.Animation) + inputMessageAnimation.Animation = fieldAnimation - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputMessageAudio + type stub InputMessageAudio - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageAudio) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageAudio) GetType() string { - return TypeInputMessageAudio + return TypeInputMessageAudio } func (*InputMessageAudio) InputMessageContentType() string { - return TypeInputMessageAudio + 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"` - } + 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 - } + 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 + 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 + fieldAudio, _ := UnmarshalInputFile(tmp.Audio) + inputMessageAudio.Audio = fieldAudio - return nil + 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"` - // Document caption; 0-GetOption("message_caption_length_max") characters - Caption *FormattedText `json:"caption"` + meta + // Document to be sent + Document InputFile `json:"document"` + // Document thumbnail, if available + Thumbnail *InputThumbnail `json:"thumbnail"` + // Document caption; 0-GetOption("message_caption_length_max") characters + Caption *FormattedText `json:"caption"` } func (entity *InputMessageDocument) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputMessageDocument + type stub InputMessageDocument - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageDocument) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageDocument) GetType() string { - return TypeInputMessageDocument + return TypeInputMessageDocument } func (*InputMessageDocument) InputMessageContentType() string { - return TypeInputMessageDocument + return TypeInputMessageDocument } func (inputMessageDocument *InputMessageDocument) UnmarshalJSON(data []byte) error { - var tmp struct { - Document json.RawMessage `json:"document"` - Thumbnail *InputThumbnail `json:"thumbnail"` - Caption *FormattedText `json:"caption"` - } + var tmp struct { + Document json.RawMessage `json:"document"` + Thumbnail *InputThumbnail `json:"thumbnail"` + Caption *FormattedText `json:"caption"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inputMessageDocument.Thumbnail = tmp.Thumbnail - inputMessageDocument.Caption = tmp.Caption + inputMessageDocument.Thumbnail = tmp.Thumbnail + inputMessageDocument.Caption = tmp.Caption - fieldDocument, _ := UnmarshalInputFile(tmp.Document) - inputMessageDocument.Document = fieldDocument + fieldDocument, _ := UnmarshalInputFile(tmp.Document) + inputMessageDocument.Document = fieldDocument - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputMessagePhoto + type stub InputMessagePhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessagePhoto) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessagePhoto) GetType() string { - return TypeInputMessagePhoto + return TypeInputMessagePhoto } func (*InputMessagePhoto) InputMessageContentType() string { - return TypeInputMessagePhoto + 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"` - } + 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 - } + 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 + 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 + fieldPhoto, _ := UnmarshalInputFile(tmp.Photo) + inputMessagePhoto.Photo = fieldPhoto - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputMessageSticker + type stub InputMessageSticker - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageSticker) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageSticker) GetType() string { - return TypeInputMessageSticker + return TypeInputMessageSticker } func (*InputMessageSticker) InputMessageContentType() string { - return TypeInputMessageSticker + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inputMessageSticker.Thumbnail = tmp.Thumbnail - inputMessageSticker.Width = tmp.Width - inputMessageSticker.Height = tmp.Height + inputMessageSticker.Thumbnail = tmp.Thumbnail + inputMessageSticker.Width = tmp.Width + inputMessageSticker.Height = tmp.Height - fieldSticker, _ := UnmarshalInputFile(tmp.Sticker) - inputMessageSticker.Sticker = fieldSticker + fieldSticker, _ := UnmarshalInputFile(tmp.Sticker) + inputMessageSticker.Sticker = fieldSticker - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputMessageVideo + type stub InputMessageVideo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageVideo) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageVideo) GetType() string { - return TypeInputMessageVideo + return TypeInputMessageVideo } func (*InputMessageVideo) InputMessageContentType() string { - return TypeInputMessageVideo + 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"` - } + 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 - } + 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 + 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 + fieldVideo, _ := UnmarshalInputFile(tmp.Video) + inputMessageVideo.Video = fieldVideo - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputMessageVideoNote + type stub InputMessageVideoNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageVideoNote) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageVideoNote) GetType() string { - return TypeInputMessageVideoNote + return TypeInputMessageVideoNote } func (*InputMessageVideoNote) InputMessageContentType() string { - return TypeInputMessageVideoNote + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inputMessageVideoNote.Thumbnail = tmp.Thumbnail - inputMessageVideoNote.Duration = tmp.Duration - inputMessageVideoNote.Length = tmp.Length + inputMessageVideoNote.Thumbnail = tmp.Thumbnail + inputMessageVideoNote.Duration = tmp.Duration + inputMessageVideoNote.Length = tmp.Length - fieldVideoNote, _ := UnmarshalInputFile(tmp.VideoNote) - inputMessageVideoNote.VideoNote = fieldVideoNote + fieldVideoNote, _ := UnmarshalInputFile(tmp.VideoNote) + inputMessageVideoNote.VideoNote = fieldVideoNote - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputMessageVoiceNote + type stub InputMessageVoiceNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageVoiceNote) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageVoiceNote) GetType() string { - return TypeInputMessageVoiceNote + return TypeInputMessageVoiceNote } func (*InputMessageVoiceNote) InputMessageContentType() string { - return TypeInputMessageVoiceNote + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inputMessageVoiceNote.Duration = tmp.Duration - inputMessageVoiceNote.Waveform = tmp.Waveform - inputMessageVoiceNote.Caption = tmp.Caption + inputMessageVoiceNote.Duration = tmp.Duration + inputMessageVoiceNote.Waveform = tmp.Waveform + inputMessageVoiceNote.Caption = tmp.Caption - fieldVoiceNote, _ := UnmarshalInputFile(tmp.VoiceNote) - inputMessageVoiceNote.VoiceNote = fieldVoiceNote + fieldVoiceNote, _ := UnmarshalInputFile(tmp.VoiceNote) + inputMessageVoiceNote.VoiceNote = fieldVoiceNote - return nil + 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 bebetween 60 and 86400 for a live location and 0 otherwise - LivePeriod int32 `json:"live_period"` + meta + // Location to be sent + Location *Location `json:"location"` + // Period for which the location can be updated, in seconds; should bebetween 60 and 86400 for a live location and 0 otherwise + LivePeriod int32 `json:"live_period"` } func (entity *InputMessageLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputMessageLocation + type stub InputMessageLocation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageLocation) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageLocation) GetType() string { - return TypeInputMessageLocation + return TypeInputMessageLocation } func (*InputMessageLocation) InputMessageContentType() string { - return TypeInputMessageLocation + return TypeInputMessageLocation } // A message with information about a venue type InputMessageVenue struct { - meta - // Venue to send - Venue *Venue `json:"venue"` + meta + // Venue to send + Venue *Venue `json:"venue"` } func (entity *InputMessageVenue) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputMessageVenue + type stub InputMessageVenue - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageVenue) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageVenue) GetType() string { - return TypeInputMessageVenue + return TypeInputMessageVenue } func (*InputMessageVenue) InputMessageContentType() string { - return TypeInputMessageVenue + return TypeInputMessageVenue } // A message containing a user contact type InputMessageContact struct { - meta - // Contact to send - Contact *Contact `json:"contact"` + meta + // Contact to send + Contact *Contact `json:"contact"` } func (entity *InputMessageContact) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputMessageContact + type stub InputMessageContact - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageContact) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageContact) GetType() string { - return TypeInputMessageContact + return TypeInputMessageContact } func (*InputMessageContact) InputMessageContentType() string { - return TypeInputMessageContact + return TypeInputMessageContact } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputMessageGame + type stub InputMessageGame - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageGame) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageGame) GetType() string { - return TypeInputMessageGame + return TypeInputMessageGame } func (*InputMessageGame) InputMessageContentType() string { - return TypeInputMessageGame + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputMessageInvoice + type stub InputMessageInvoice - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageInvoice) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageInvoice) GetType() string { - return TypeInputMessageInvoice + return TypeInputMessageInvoice } func (*InputMessageInvoice) InputMessageContentType() string { - return TypeInputMessageInvoice + return TypeInputMessageInvoice } // 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"` + 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"` } func (entity *InputMessageForwarded) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputMessageForwarded + type stub InputMessageForwarded - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputMessageForwarded) GetClass() string { - return ClassInputMessageContent + return ClassInputMessageContent } func (*InputMessageForwarded) GetType() string { - return TypeInputMessageForwarded + return TypeInputMessageForwarded } func (*InputMessageForwarded) InputMessageContentType() string { - return TypeInputMessageForwarded + return TypeInputMessageForwarded } // Returns all found messages, no filter is applied -type SearchMessagesFilterEmpty struct{ - meta +type SearchMessagesFilterEmpty struct { + meta } func (entity *SearchMessagesFilterEmpty) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterEmpty + type stub SearchMessagesFilterEmpty - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterEmpty) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterEmpty) GetType() string { - return TypeSearchMessagesFilterEmpty + return TypeSearchMessagesFilterEmpty } func (*SearchMessagesFilterEmpty) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterEmpty + return TypeSearchMessagesFilterEmpty } // Returns only animation messages -type SearchMessagesFilterAnimation struct{ - meta +type SearchMessagesFilterAnimation struct { + meta } func (entity *SearchMessagesFilterAnimation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterAnimation + type stub SearchMessagesFilterAnimation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterAnimation) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterAnimation) GetType() string { - return TypeSearchMessagesFilterAnimation + return TypeSearchMessagesFilterAnimation } func (*SearchMessagesFilterAnimation) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterAnimation + return TypeSearchMessagesFilterAnimation } // Returns only audio messages -type SearchMessagesFilterAudio struct{ - meta +type SearchMessagesFilterAudio struct { + meta } func (entity *SearchMessagesFilterAudio) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterAudio + type stub SearchMessagesFilterAudio - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterAudio) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterAudio) GetType() string { - return TypeSearchMessagesFilterAudio + return TypeSearchMessagesFilterAudio } func (*SearchMessagesFilterAudio) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterAudio + return TypeSearchMessagesFilterAudio } // Returns only document messages -type SearchMessagesFilterDocument struct{ - meta +type SearchMessagesFilterDocument struct { + meta } func (entity *SearchMessagesFilterDocument) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterDocument + type stub SearchMessagesFilterDocument - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterDocument) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterDocument) GetType() string { - return TypeSearchMessagesFilterDocument + return TypeSearchMessagesFilterDocument } func (*SearchMessagesFilterDocument) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterDocument + return TypeSearchMessagesFilterDocument } // Returns only photo messages -type SearchMessagesFilterPhoto struct{ - meta +type SearchMessagesFilterPhoto struct { + meta } func (entity *SearchMessagesFilterPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterPhoto + type stub SearchMessagesFilterPhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterPhoto) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterPhoto) GetType() string { - return TypeSearchMessagesFilterPhoto + return TypeSearchMessagesFilterPhoto } func (*SearchMessagesFilterPhoto) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterPhoto + return TypeSearchMessagesFilterPhoto } // Returns only video messages -type SearchMessagesFilterVideo struct{ - meta +type SearchMessagesFilterVideo struct { + meta } func (entity *SearchMessagesFilterVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterVideo + type stub SearchMessagesFilterVideo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterVideo) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterVideo) GetType() string { - return TypeSearchMessagesFilterVideo + return TypeSearchMessagesFilterVideo } func (*SearchMessagesFilterVideo) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterVideo + return TypeSearchMessagesFilterVideo } // Returns only voice note messages -type SearchMessagesFilterVoiceNote struct{ - meta +type SearchMessagesFilterVoiceNote struct { + meta } func (entity *SearchMessagesFilterVoiceNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterVoiceNote + type stub SearchMessagesFilterVoiceNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterVoiceNote) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterVoiceNote) GetType() string { - return TypeSearchMessagesFilterVoiceNote + return TypeSearchMessagesFilterVoiceNote } func (*SearchMessagesFilterVoiceNote) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterVoiceNote + return TypeSearchMessagesFilterVoiceNote } // Returns only photo and video messages -type SearchMessagesFilterPhotoAndVideo struct{ - meta +type SearchMessagesFilterPhotoAndVideo struct { + meta } func (entity *SearchMessagesFilterPhotoAndVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterPhotoAndVideo + type stub SearchMessagesFilterPhotoAndVideo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterPhotoAndVideo) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterPhotoAndVideo) GetType() string { - return TypeSearchMessagesFilterPhotoAndVideo + return TypeSearchMessagesFilterPhotoAndVideo } func (*SearchMessagesFilterPhotoAndVideo) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterPhotoAndVideo + return TypeSearchMessagesFilterPhotoAndVideo } // Returns only messages containing URLs -type SearchMessagesFilterUrl struct{ - meta +type SearchMessagesFilterUrl struct { + meta } func (entity *SearchMessagesFilterUrl) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterUrl + type stub SearchMessagesFilterUrl - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterUrl) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterUrl) GetType() string { - return TypeSearchMessagesFilterUrl + return TypeSearchMessagesFilterUrl } func (*SearchMessagesFilterUrl) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterUrl + return TypeSearchMessagesFilterUrl } // Returns only messages containing chat photos -type SearchMessagesFilterChatPhoto struct{ - meta +type SearchMessagesFilterChatPhoto struct { + meta } func (entity *SearchMessagesFilterChatPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterChatPhoto + type stub SearchMessagesFilterChatPhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterChatPhoto) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterChatPhoto) GetType() string { - return TypeSearchMessagesFilterChatPhoto + return TypeSearchMessagesFilterChatPhoto } func (*SearchMessagesFilterChatPhoto) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterChatPhoto + return TypeSearchMessagesFilterChatPhoto } // Returns only call messages -type SearchMessagesFilterCall struct{ - meta +type SearchMessagesFilterCall struct { + meta } func (entity *SearchMessagesFilterCall) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterCall + type stub SearchMessagesFilterCall - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterCall) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterCall) GetType() string { - return TypeSearchMessagesFilterCall + return TypeSearchMessagesFilterCall } func (*SearchMessagesFilterCall) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterCall + return TypeSearchMessagesFilterCall } // Returns only incoming call messages with missed/declined discard reasons -type SearchMessagesFilterMissedCall struct{ - meta +type SearchMessagesFilterMissedCall struct { + meta } func (entity *SearchMessagesFilterMissedCall) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterMissedCall + type stub SearchMessagesFilterMissedCall - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterMissedCall) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterMissedCall) GetType() string { - return TypeSearchMessagesFilterMissedCall + return TypeSearchMessagesFilterMissedCall } func (*SearchMessagesFilterMissedCall) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterMissedCall + return TypeSearchMessagesFilterMissedCall } // Returns only video note messages -type SearchMessagesFilterVideoNote struct{ - meta +type SearchMessagesFilterVideoNote struct { + meta } func (entity *SearchMessagesFilterVideoNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterVideoNote + type stub SearchMessagesFilterVideoNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterVideoNote) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterVideoNote) GetType() string { - return TypeSearchMessagesFilterVideoNote + return TypeSearchMessagesFilterVideoNote } func (*SearchMessagesFilterVideoNote) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterVideoNote + return TypeSearchMessagesFilterVideoNote } // Returns only voice and video note messages -type SearchMessagesFilterVoiceAndVideoNote struct{ - meta +type SearchMessagesFilterVoiceAndVideoNote struct { + meta } func (entity *SearchMessagesFilterVoiceAndVideoNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterVoiceAndVideoNote + type stub SearchMessagesFilterVoiceAndVideoNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterVoiceAndVideoNote) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterVoiceAndVideoNote) GetType() string { - return TypeSearchMessagesFilterVoiceAndVideoNote + return TypeSearchMessagesFilterVoiceAndVideoNote } func (*SearchMessagesFilterVoiceAndVideoNote) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterVoiceAndVideoNote + return TypeSearchMessagesFilterVoiceAndVideoNote } // Returns only messages with mentions of the current user, or messages that are replies to their messages -type SearchMessagesFilterMention struct{ - meta +type SearchMessagesFilterMention struct { + meta } func (entity *SearchMessagesFilterMention) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterMention + type stub SearchMessagesFilterMention - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterMention) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterMention) GetType() string { - return TypeSearchMessagesFilterMention + return TypeSearchMessagesFilterMention } func (*SearchMessagesFilterMention) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterMention + return TypeSearchMessagesFilterMention } // Returns only messages with unread mentions of the current user or messages that are replies to their messages. When using this filter the results can't be additionally filtered by a query or by the sending user -type SearchMessagesFilterUnreadMention struct{ - meta +type SearchMessagesFilterUnreadMention struct { + meta } func (entity *SearchMessagesFilterUnreadMention) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub SearchMessagesFilterUnreadMention + type stub SearchMessagesFilterUnreadMention - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*SearchMessagesFilterUnreadMention) GetClass() string { - return ClassSearchMessagesFilter + return ClassSearchMessagesFilter } func (*SearchMessagesFilterUnreadMention) GetType() string { - return TypeSearchMessagesFilterUnreadMention + return TypeSearchMessagesFilterUnreadMention } func (*SearchMessagesFilterUnreadMention) SearchMessagesFilterType() string { - return TypeSearchMessagesFilterUnreadMention + return TypeSearchMessagesFilterUnreadMention } // The user is typing a message -type ChatActionTyping struct{ - meta +type ChatActionTyping struct { + meta } func (entity *ChatActionTyping) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionTyping + type stub ChatActionTyping - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionTyping) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionTyping) GetType() string { - return TypeChatActionTyping + return TypeChatActionTyping } func (*ChatActionTyping) ChatActionType() string { - return TypeChatActionTyping + return TypeChatActionTyping } // The user is recording a video -type ChatActionRecordingVideo struct{ - meta +type ChatActionRecordingVideo struct { + meta } func (entity *ChatActionRecordingVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionRecordingVideo + type stub ChatActionRecordingVideo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionRecordingVideo) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionRecordingVideo) GetType() string { - return TypeChatActionRecordingVideo + return TypeChatActionRecordingVideo } func (*ChatActionRecordingVideo) ChatActionType() string { - return TypeChatActionRecordingVideo + return TypeChatActionRecordingVideo } // The user is uploading a video type ChatActionUploadingVideo struct { - meta - // Upload progress, as a percentage - Progress int32 `json:"progress"` + meta + // Upload progress, as a percentage + Progress int32 `json:"progress"` } func (entity *ChatActionUploadingVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionUploadingVideo + type stub ChatActionUploadingVideo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionUploadingVideo) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionUploadingVideo) GetType() string { - return TypeChatActionUploadingVideo + return TypeChatActionUploadingVideo } func (*ChatActionUploadingVideo) ChatActionType() string { - return TypeChatActionUploadingVideo + return TypeChatActionUploadingVideo } // The user is recording a voice note -type ChatActionRecordingVoiceNote struct{ - meta +type ChatActionRecordingVoiceNote struct { + meta } func (entity *ChatActionRecordingVoiceNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionRecordingVoiceNote + type stub ChatActionRecordingVoiceNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionRecordingVoiceNote) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionRecordingVoiceNote) GetType() string { - return TypeChatActionRecordingVoiceNote + return TypeChatActionRecordingVoiceNote } func (*ChatActionRecordingVoiceNote) ChatActionType() string { - return TypeChatActionRecordingVoiceNote + return TypeChatActionRecordingVoiceNote } // The user is uploading a voice note type ChatActionUploadingVoiceNote struct { - meta - // Upload progress, as a percentage - Progress int32 `json:"progress"` + meta + // Upload progress, as a percentage + Progress int32 `json:"progress"` } func (entity *ChatActionUploadingVoiceNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionUploadingVoiceNote + type stub ChatActionUploadingVoiceNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionUploadingVoiceNote) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionUploadingVoiceNote) GetType() string { - return TypeChatActionUploadingVoiceNote + return TypeChatActionUploadingVoiceNote } func (*ChatActionUploadingVoiceNote) ChatActionType() string { - return TypeChatActionUploadingVoiceNote + return TypeChatActionUploadingVoiceNote } // The user is uploading a photo type ChatActionUploadingPhoto struct { - meta - // Upload progress, as a percentage - Progress int32 `json:"progress"` + meta + // Upload progress, as a percentage + Progress int32 `json:"progress"` } func (entity *ChatActionUploadingPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionUploadingPhoto + type stub ChatActionUploadingPhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionUploadingPhoto) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionUploadingPhoto) GetType() string { - return TypeChatActionUploadingPhoto + return TypeChatActionUploadingPhoto } func (*ChatActionUploadingPhoto) ChatActionType() string { - return TypeChatActionUploadingPhoto + return TypeChatActionUploadingPhoto } // The user is uploading a document type ChatActionUploadingDocument struct { - meta - // Upload progress, as a percentage - Progress int32 `json:"progress"` + meta + // Upload progress, as a percentage + Progress int32 `json:"progress"` } func (entity *ChatActionUploadingDocument) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionUploadingDocument + type stub ChatActionUploadingDocument - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionUploadingDocument) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionUploadingDocument) GetType() string { - return TypeChatActionUploadingDocument + return TypeChatActionUploadingDocument } func (*ChatActionUploadingDocument) ChatActionType() string { - return TypeChatActionUploadingDocument + return TypeChatActionUploadingDocument } // The user is picking a location or venue to send -type ChatActionChoosingLocation struct{ - meta +type ChatActionChoosingLocation struct { + meta } func (entity *ChatActionChoosingLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionChoosingLocation + type stub ChatActionChoosingLocation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionChoosingLocation) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionChoosingLocation) GetType() string { - return TypeChatActionChoosingLocation + return TypeChatActionChoosingLocation } func (*ChatActionChoosingLocation) ChatActionType() string { - return TypeChatActionChoosingLocation + return TypeChatActionChoosingLocation } // The user is picking a contact to send -type ChatActionChoosingContact struct{ - meta +type ChatActionChoosingContact struct { + meta } func (entity *ChatActionChoosingContact) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionChoosingContact + type stub ChatActionChoosingContact - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionChoosingContact) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionChoosingContact) GetType() string { - return TypeChatActionChoosingContact + return TypeChatActionChoosingContact } func (*ChatActionChoosingContact) ChatActionType() string { - return TypeChatActionChoosingContact + return TypeChatActionChoosingContact } // The user has started to play a game -type ChatActionStartPlayingGame struct{ - meta +type ChatActionStartPlayingGame struct { + meta } func (entity *ChatActionStartPlayingGame) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionStartPlayingGame + type stub ChatActionStartPlayingGame - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionStartPlayingGame) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionStartPlayingGame) GetType() string { - return TypeChatActionStartPlayingGame + return TypeChatActionStartPlayingGame } func (*ChatActionStartPlayingGame) ChatActionType() string { - return TypeChatActionStartPlayingGame + return TypeChatActionStartPlayingGame } // The user is recording a video note -type ChatActionRecordingVideoNote struct{ - meta +type ChatActionRecordingVideoNote struct { + meta } func (entity *ChatActionRecordingVideoNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionRecordingVideoNote + type stub ChatActionRecordingVideoNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionRecordingVideoNote) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionRecordingVideoNote) GetType() string { - return TypeChatActionRecordingVideoNote + return TypeChatActionRecordingVideoNote } func (*ChatActionRecordingVideoNote) ChatActionType() string { - return TypeChatActionRecordingVideoNote + return TypeChatActionRecordingVideoNote } // The user is uploading a video note type ChatActionUploadingVideoNote struct { - meta - // Upload progress, as a percentage - Progress int32 `json:"progress"` + meta + // Upload progress, as a percentage + Progress int32 `json:"progress"` } func (entity *ChatActionUploadingVideoNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionUploadingVideoNote + type stub ChatActionUploadingVideoNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionUploadingVideoNote) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionUploadingVideoNote) GetType() string { - return TypeChatActionUploadingVideoNote + return TypeChatActionUploadingVideoNote } func (*ChatActionUploadingVideoNote) ChatActionType() string { - return TypeChatActionUploadingVideoNote + return TypeChatActionUploadingVideoNote } // The user has cancelled the previous action -type ChatActionCancel struct{ - meta +type ChatActionCancel struct { + meta } func (entity *ChatActionCancel) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatActionCancel + type stub ChatActionCancel - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatActionCancel) GetClass() string { - return ClassChatAction + return ClassChatAction } func (*ChatActionCancel) GetType() string { - return TypeChatActionCancel + return TypeChatActionCancel } func (*ChatActionCancel) ChatActionType() string { - return TypeChatActionCancel + return TypeChatActionCancel } // The user status was never changed -type UserStatusEmpty struct{ - meta +type UserStatusEmpty struct { + meta } func (entity *UserStatusEmpty) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserStatusEmpty + type stub UserStatusEmpty - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserStatusEmpty) GetClass() string { - return ClassUserStatus + return ClassUserStatus } func (*UserStatusEmpty) GetType() string { - return TypeUserStatusEmpty + return TypeUserStatusEmpty } func (*UserStatusEmpty) UserStatusType() string { - return TypeUserStatusEmpty + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UserStatusOnline + type stub UserStatusOnline - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserStatusOnline) GetClass() string { - return ClassUserStatus + return ClassUserStatus } func (*UserStatusOnline) GetType() string { - return TypeUserStatusOnline + return TypeUserStatusOnline } func (*UserStatusOnline) UserStatusType() string { - return TypeUserStatusOnline + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UserStatusOffline + type stub UserStatusOffline - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserStatusOffline) GetClass() string { - return ClassUserStatus + return ClassUserStatus } func (*UserStatusOffline) GetType() string { - return TypeUserStatusOffline + return TypeUserStatusOffline } func (*UserStatusOffline) UserStatusType() string { - return TypeUserStatusOffline + return TypeUserStatusOffline } // The user was online recently -type UserStatusRecently struct{ - meta +type UserStatusRecently struct { + meta } func (entity *UserStatusRecently) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserStatusRecently + type stub UserStatusRecently - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserStatusRecently) GetClass() string { - return ClassUserStatus + return ClassUserStatus } func (*UserStatusRecently) GetType() string { - return TypeUserStatusRecently + return TypeUserStatusRecently } func (*UserStatusRecently) UserStatusType() string { - return TypeUserStatusRecently + return TypeUserStatusRecently } // The user is offline, but was online last week -type UserStatusLastWeek struct{ - meta +type UserStatusLastWeek struct { + meta } func (entity *UserStatusLastWeek) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserStatusLastWeek + type stub UserStatusLastWeek - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserStatusLastWeek) GetClass() string { - return ClassUserStatus + return ClassUserStatus } func (*UserStatusLastWeek) GetType() string { - return TypeUserStatusLastWeek + return TypeUserStatusLastWeek } func (*UserStatusLastWeek) UserStatusType() string { - return TypeUserStatusLastWeek + return TypeUserStatusLastWeek } // The user is offline, but was online last month -type UserStatusLastMonth struct{ - meta +type UserStatusLastMonth struct { + meta } func (entity *UserStatusLastMonth) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserStatusLastMonth + type stub UserStatusLastMonth - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserStatusLastMonth) GetClass() string { - return ClassUserStatus + return ClassUserStatus } func (*UserStatusLastMonth) GetType() string { - return TypeUserStatusLastMonth + return TypeUserStatusLastMonth } func (*UserStatusLastMonth) UserStatusType() string { - return TypeUserStatusLastMonth + return TypeUserStatusLastMonth } // Represents a list of stickers type Stickers struct { - meta - // List of stickers - Stickers []*Sticker `json:"stickers"` + meta + // List of stickers + Stickers []*Sticker `json:"stickers"` } func (entity *Stickers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Stickers + type stub Stickers - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Stickers) GetClass() string { - return ClassStickers + return ClassStickers } func (*Stickers) GetType() string { - return TypeStickers + return TypeStickers } // Represents a list of all emoji corresponding to a sticker in a sticker set. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object type StickerEmojis struct { - meta - // List of emojis - Emojis []string `json:"emojis"` + meta + // List of emojis + Emojis []string `json:"emojis"` } func (entity *StickerEmojis) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StickerEmojis + type stub StickerEmojis - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerEmojis) GetClass() string { - return ClassStickerEmojis + return ClassStickerEmojis } func (*StickerEmojis) GetType() string { - return TypeStickerEmojis + return TypeStickerEmojis } // 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"` - // 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, 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 - Emojis []*StickerEmojis `json:"emojis"` + 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"` + // 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, 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 + Emojis []*StickerEmojis `json:"emojis"` } func (entity *StickerSet) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StickerSet + type stub StickerSet - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerSet) GetClass() string { - return ClassStickerSet + return ClassStickerSet } func (*StickerSet) GetType() string { - return TypeStickerSet + 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"` - // 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, if the stickers in the set are masks - IsMasks bool `json:"is_masks"` - // True for already viewed trending sticker sets - IsViewed bool `json:"is_viewed"` - // Total number of stickers in the set - Size int32 `json:"size"` - // Contains up to the first 5 stickers from the set, depending on the context. If the client needs more stickers the full set should be requested - Covers []*Sticker `json:"covers"` + 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"` + // 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, if the stickers in the set are masks + IsMasks bool `json:"is_masks"` + // True for already viewed trending sticker sets + IsViewed bool `json:"is_viewed"` + // Total number of stickers in the set + Size int32 `json:"size"` + // Contains up to the first 5 stickers from the set, depending on the context. If the client needs more stickers the full set should be requested + Covers []*Sticker `json:"covers"` } func (entity *StickerSetInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StickerSetInfo + type stub StickerSetInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerSetInfo) GetClass() string { - return ClassStickerSetInfo + return ClassStickerSetInfo } func (*StickerSetInfo) GetType() string { - return TypeStickerSetInfo + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub StickerSets + type stub StickerSets - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerSets) GetClass() string { - return ClassStickerSets + return ClassStickerSets } func (*StickerSets) GetType() string { - return TypeStickerSets + return TypeStickerSets } // The call wasn't discarded, or the reason is unknown -type CallDiscardReasonEmpty struct{ - meta +type CallDiscardReasonEmpty struct { + meta } func (entity *CallDiscardReasonEmpty) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CallDiscardReasonEmpty + type stub CallDiscardReasonEmpty - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallDiscardReasonEmpty) GetClass() string { - return ClassCallDiscardReason + return ClassCallDiscardReason } func (*CallDiscardReasonEmpty) GetType() string { - return TypeCallDiscardReasonEmpty + return TypeCallDiscardReasonEmpty } func (*CallDiscardReasonEmpty) CallDiscardReasonType() string { - return TypeCallDiscardReasonEmpty + 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 +type CallDiscardReasonMissed struct { + meta } func (entity *CallDiscardReasonMissed) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CallDiscardReasonMissed + type stub CallDiscardReasonMissed - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallDiscardReasonMissed) GetClass() string { - return ClassCallDiscardReason + return ClassCallDiscardReason } func (*CallDiscardReasonMissed) GetType() string { - return TypeCallDiscardReasonMissed + return TypeCallDiscardReasonMissed } func (*CallDiscardReasonMissed) CallDiscardReasonType() string { - return TypeCallDiscardReasonMissed + return TypeCallDiscardReasonMissed } // The call was ended before the conversation started. It was declined by the other party -type CallDiscardReasonDeclined struct{ - meta +type CallDiscardReasonDeclined struct { + meta } func (entity *CallDiscardReasonDeclined) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CallDiscardReasonDeclined + type stub CallDiscardReasonDeclined - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallDiscardReasonDeclined) GetClass() string { - return ClassCallDiscardReason + return ClassCallDiscardReason } func (*CallDiscardReasonDeclined) GetType() string { - return TypeCallDiscardReasonDeclined + return TypeCallDiscardReasonDeclined } func (*CallDiscardReasonDeclined) CallDiscardReasonType() string { - return TypeCallDiscardReasonDeclined + return TypeCallDiscardReasonDeclined } // The call was ended during the conversation because the users were disconnected -type CallDiscardReasonDisconnected struct{ - meta +type CallDiscardReasonDisconnected struct { + meta } func (entity *CallDiscardReasonDisconnected) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CallDiscardReasonDisconnected + type stub CallDiscardReasonDisconnected - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallDiscardReasonDisconnected) GetClass() string { - return ClassCallDiscardReason + return ClassCallDiscardReason } func (*CallDiscardReasonDisconnected) GetType() string { - return TypeCallDiscardReasonDisconnected + return TypeCallDiscardReasonDisconnected } func (*CallDiscardReasonDisconnected) CallDiscardReasonType() string { - return TypeCallDiscardReasonDisconnected + return TypeCallDiscardReasonDisconnected } // The call was ended because one of the parties hung up -type CallDiscardReasonHungUp struct{ - meta +type CallDiscardReasonHungUp struct { + meta } func (entity *CallDiscardReasonHungUp) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CallDiscardReasonHungUp + type stub CallDiscardReasonHungUp - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallDiscardReasonHungUp) GetClass() string { - return ClassCallDiscardReason + return ClassCallDiscardReason } func (*CallDiscardReasonHungUp) GetType() string { - return TypeCallDiscardReasonHungUp + return TypeCallDiscardReasonHungUp } func (*CallDiscardReasonHungUp) CallDiscardReasonType() string { - return TypeCallDiscardReasonHungUp + return TypeCallDiscardReasonHungUp } // Specifies the supported call protocols type CallProtocol struct { - meta - // True, if UDP peer-to-peer connections are supported - UdpP2p bool `json:"udp_p2p"` - // True, if connection through UDP reflectors is supported - UdpReflector bool `json:"udp_reflector"` - // Minimum supported API layer; use 65 - MinLayer int32 `json:"min_layer"` - // Maximum supported API layer; use 65 - MaxLayer int32 `json:"max_layer"` + meta + // True, if UDP peer-to-peer connections are supported + UdpP2p bool `json:"udp_p2p"` + // True, if connection through UDP reflectors is supported + UdpReflector bool `json:"udp_reflector"` + // Minimum supported API layer; use 65 + MinLayer int32 `json:"min_layer"` + // Maximum supported API layer; use 65 + MaxLayer int32 `json:"max_layer"` } func (entity *CallProtocol) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CallProtocol + type stub CallProtocol - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallProtocol) GetClass() string { - return ClassCallProtocol + return ClassCallProtocol } func (*CallProtocol) GetType() string { - return TypeCallProtocol + return TypeCallProtocol } // Describes the address of UDP reflectors type CallConnection struct { - meta - // Reflector identifier - Id JsonInt64 `json:"id"` - // IPv4 reflector address - Ip string `json:"ip"` - // IPv6 reflector address - Ipv6 string `json:"ipv6"` - // Reflector port number - Port int32 `json:"port"` - // Connection peer tag - PeerTag []byte `json:"peer_tag"` + meta + // Reflector identifier + Id JsonInt64 `json:"id"` + // IPv4 reflector address + Ip string `json:"ip"` + // IPv6 reflector address + Ipv6 string `json:"ipv6"` + // Reflector port number + Port int32 `json:"port"` + // Connection peer tag + PeerTag []byte `json:"peer_tag"` } func (entity *CallConnection) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CallConnection + type stub CallConnection - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallConnection) GetClass() string { - return ClassCallConnection + return ClassCallConnection } func (*CallConnection) GetType() string { - return TypeCallConnection + return TypeCallConnection } // Contains the call identifier type CallId struct { - meta - // Call identifier - Id int32 `json:"id"` + meta + // Call identifier + Id int32 `json:"id"` } func (entity *CallId) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CallId + type stub CallId - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallId) GetClass() string { - return ClassCallId + return ClassCallId } func (*CallId) GetType() string { - return TypeCallId + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub CallStatePending + type stub CallStatePending - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallStatePending) GetClass() string { - return ClassCallState + return ClassCallState } func (*CallStatePending) GetType() string { - return TypeCallStatePending + return TypeCallStatePending } func (*CallStatePending) CallStateType() string { - return TypeCallStatePending + return TypeCallStatePending } // The call has been answered and encryption keys are being exchanged -type CallStateExchangingKeys struct{ - meta +type CallStateExchangingKeys struct { + meta } func (entity *CallStateExchangingKeys) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CallStateExchangingKeys + type stub CallStateExchangingKeys - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallStateExchangingKeys) GetClass() string { - return ClassCallState + return ClassCallState } func (*CallStateExchangingKeys) GetType() string { - return TypeCallStateExchangingKeys + return TypeCallStateExchangingKeys } func (*CallStateExchangingKeys) CallStateType() string { - return TypeCallStateExchangingKeys + return TypeCallStateExchangingKeys } // The call is ready to use type CallStateReady struct { - meta - // Call protocols supported by the peer - Protocol *CallProtocol `json:"protocol"` - // Available UDP reflectors - Connections []*CallConnection `json:"connections"` - // A JSON-encoded call config - Config string `json:"config"` - // Call encryption key - EncryptionKey []byte `json:"encryption_key"` - // Encryption key emojis fingerprint - Emojis []string `json:"emojis"` + meta + // Call protocols supported by the peer + Protocol *CallProtocol `json:"protocol"` + // Available UDP reflectors + Connections []*CallConnection `json:"connections"` + // A JSON-encoded call config + Config string `json:"config"` + // Call encryption key + EncryptionKey []byte `json:"encryption_key"` + // Encryption key emojis fingerprint + Emojis []string `json:"emojis"` } func (entity *CallStateReady) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CallStateReady + type stub CallStateReady - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallStateReady) GetClass() string { - return ClassCallState + return ClassCallState } func (*CallStateReady) GetType() string { - return TypeCallStateReady + return TypeCallStateReady } func (*CallStateReady) CallStateType() string { - return TypeCallStateReady + return TypeCallStateReady } // The call is hanging up after discardCall has been called -type CallStateHangingUp struct{ - meta +type CallStateHangingUp struct { + meta } func (entity *CallStateHangingUp) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CallStateHangingUp + type stub CallStateHangingUp - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallStateHangingUp) GetClass() string { - return ClassCallState + return ClassCallState } func (*CallStateHangingUp) GetType() string { - return TypeCallStateHangingUp + return TypeCallStateHangingUp } func (*CallStateHangingUp) CallStateType() string { - return TypeCallStateHangingUp + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub CallStateDiscarded + type stub CallStateDiscarded - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallStateDiscarded) GetClass() string { - return ClassCallState + return ClassCallState } func (*CallStateDiscarded) GetType() string { - return TypeCallStateDiscarded + return TypeCallStateDiscarded } func (*CallStateDiscarded) CallStateType() string { - return TypeCallStateDiscarded + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - callStateDiscarded.NeedRating = tmp.NeedRating - callStateDiscarded.NeedDebugInformation = tmp.NeedDebugInformation + callStateDiscarded.NeedRating = tmp.NeedRating + callStateDiscarded.NeedDebugInformation = tmp.NeedDebugInformation - fieldReason, _ := UnmarshalCallDiscardReason(tmp.Reason) - callStateDiscarded.Reason = fieldReason + fieldReason, _ := UnmarshalCallDiscardReason(tmp.Reason) + callStateDiscarded.Reason = fieldReason - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub CallStateError + type stub CallStateError - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallStateError) GetClass() string { - return ClassCallState + return ClassCallState } func (*CallStateError) GetType() string { - return TypeCallStateError + return TypeCallStateError } func (*CallStateError) CallStateType() string { - return TypeCallStateError + return TypeCallStateError } // Describes a call type Call struct { - meta - // Call identifier, not persistent - Id int32 `json:"id"` - // Peer user identifier - UserId int32 `json:"user_id"` - // True, if the call is outgoing - IsOutgoing bool `json:"is_outgoing"` - // Call state - State CallState `json:"state"` + meta + // Call identifier, not persistent + Id int32 `json:"id"` + // Peer user identifier + UserId int32 `json:"user_id"` + // True, if the call is outgoing + IsOutgoing bool `json:"is_outgoing"` + // Call state + State CallState `json:"state"` } func (entity *Call) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Call + type stub Call - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Call) GetClass() string { - return ClassCall + return ClassCall } func (*Call) GetType() string { - return TypeCall + return TypeCall } func (call *Call) UnmarshalJSON(data []byte) error { - var tmp struct { - Id int32 `json:"id"` - UserId int32 `json:"user_id"` - IsOutgoing bool `json:"is_outgoing"` - State json.RawMessage `json:"state"` - } + var tmp struct { + Id int32 `json:"id"` + UserId int32 `json:"user_id"` + IsOutgoing bool `json:"is_outgoing"` + State json.RawMessage `json:"state"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - call.Id = tmp.Id - call.UserId = tmp.UserId - call.IsOutgoing = tmp.IsOutgoing + call.Id = tmp.Id + call.UserId = tmp.UserId + call.IsOutgoing = tmp.IsOutgoing - fieldState, _ := UnmarshalCallState(tmp.State) - call.State = fieldState + fieldState, _ := UnmarshalCallState(tmp.State) + call.State = fieldState - return nil + return nil } // Represents a list of animations type Animations struct { - meta - // List of animations - Animations []*Animation `json:"animations"` + meta + // List of animations + Animations []*Animation `json:"animations"` } func (entity *Animations) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Animations + type stub Animations - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Animations) GetClass() string { - return ClassAnimations + return ClassAnimations } func (*Animations) GetType() string { - return TypeAnimations + return TypeAnimations } // Represents the result of an ImportContacts request type ImportedContacts struct { - meta - // User identifiers of the imported contacts in the same order as they were specified in the request; 0 if the contact is not yet a registered user - UserIds []int32 `json:"user_ids"` - // The number of users that imported the corresponding contact; 0 for already registered users or if unavailable - ImporterCount []int32 `json:"importer_count"` + 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() + entity.meta.Type = entity.GetType() - type stub ImportedContacts + type stub ImportedContacts - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ImportedContacts) GetClass() string { - return ClassImportedContacts + return ClassImportedContacts } func (*ImportedContacts) GetType() string { - return TypeImportedContacts + return TypeImportedContacts } // Represents a link to an animated GIF type InputInlineQueryResultAnimatedGif struct { - meta - // Unique identifier of the query result - Id string `json:"id"` - // Title of the query result - Title string `json:"title"` - // URL of the static result thumbnail (JPEG or GIF), if it exists - ThumbnailUrl string `json:"thumbnail_url"` - // The URL of the GIF-file (file size must not exceed 1MB) - GifUrl string `json:"gif_url"` - // Duration of the GIF, in seconds - GifDuration int32 `json:"gif_duration"` - // Width of the GIF - GifWidth int32 `json:"gif_width"` - // Height of the GIF - GifHeight int32 `json:"gif_height"` - // The message reply markup. Must be of type replyMarkupInlineKeyboard or null - ReplyMarkup ReplyMarkup `json:"reply_markup"` - // The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAnimation, InputMessageLocation, InputMessageVenue or InputMessageContact - InputMessageContent InputMessageContent `json:"input_message_content"` + meta + // Unique identifier of the query result + Id string `json:"id"` + // Title of the query result + Title string `json:"title"` + // URL of the static result thumbnail (JPEG or GIF), if it exists + ThumbnailUrl string `json:"thumbnail_url"` + // The URL of the GIF-file (file size must not exceed 1MB) + GifUrl string `json:"gif_url"` + // Duration of the GIF, in seconds + GifDuration int32 `json:"gif_duration"` + // Width of the GIF + GifWidth int32 `json:"gif_width"` + // Height of the GIF + GifHeight int32 `json:"gif_height"` + // The message reply markup. Must be of type replyMarkupInlineKeyboard or null + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAnimation, InputMessageLocation, InputMessageVenue or InputMessageContact + InputMessageContent InputMessageContent `json:"input_message_content"` } func (entity *InputInlineQueryResultAnimatedGif) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultAnimatedGif + type stub InputInlineQueryResultAnimatedGif - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultAnimatedGif) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultAnimatedGif) GetType() string { - return TypeInputInlineQueryResultAnimatedGif + return TypeInputInlineQueryResultAnimatedGif } func (*InputInlineQueryResultAnimatedGif) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultAnimatedGif + return TypeInputInlineQueryResultAnimatedGif } func (inputInlineQueryResultAnimatedGif *InputInlineQueryResultAnimatedGif) UnmarshalJSON(data []byte) error { - var tmp struct { - Id string `json:"id"` - Title string `json:"title"` - ThumbnailUrl string `json:"thumbnail_url"` - GifUrl string `json:"gif_url"` - GifDuration int32 `json:"gif_duration"` - GifWidth int32 `json:"gif_width"` - GifHeight int32 `json:"gif_height"` - ReplyMarkup json.RawMessage `json:"reply_markup"` - InputMessageContent json.RawMessage `json:"input_message_content"` - } + var tmp struct { + Id string `json:"id"` + Title string `json:"title"` + ThumbnailUrl string `json:"thumbnail_url"` + GifUrl string `json:"gif_url"` + GifDuration int32 `json:"gif_duration"` + GifWidth int32 `json:"gif_width"` + GifHeight int32 `json:"gif_height"` + ReplyMarkup json.RawMessage `json:"reply_markup"` + InputMessageContent json.RawMessage `json:"input_message_content"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inputInlineQueryResultAnimatedGif.Id = tmp.Id - inputInlineQueryResultAnimatedGif.Title = tmp.Title - inputInlineQueryResultAnimatedGif.ThumbnailUrl = tmp.ThumbnailUrl - inputInlineQueryResultAnimatedGif.GifUrl = tmp.GifUrl - inputInlineQueryResultAnimatedGif.GifDuration = tmp.GifDuration - inputInlineQueryResultAnimatedGif.GifWidth = tmp.GifWidth - inputInlineQueryResultAnimatedGif.GifHeight = tmp.GifHeight + inputInlineQueryResultAnimatedGif.Id = tmp.Id + inputInlineQueryResultAnimatedGif.Title = tmp.Title + inputInlineQueryResultAnimatedGif.ThumbnailUrl = tmp.ThumbnailUrl + inputInlineQueryResultAnimatedGif.GifUrl = tmp.GifUrl + inputInlineQueryResultAnimatedGif.GifDuration = tmp.GifDuration + inputInlineQueryResultAnimatedGif.GifWidth = tmp.GifWidth + inputInlineQueryResultAnimatedGif.GifHeight = tmp.GifHeight - fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) - inputInlineQueryResultAnimatedGif.ReplyMarkup = fieldReplyMarkup + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultAnimatedGif.ReplyMarkup = fieldReplyMarkup - fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) - inputInlineQueryResultAnimatedGif.InputMessageContent = fieldInputMessageContent + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultAnimatedGif.InputMessageContent = fieldInputMessageContent - return nil + return nil } // Represents a link to an animated (i.e. without sound) H.264/MPEG-4 AVC video type InputInlineQueryResultAnimatedMpeg4 struct { - meta - // Unique identifier of the query result - Id string `json:"id"` - // Title of the result - Title string `json:"title"` - // URL of the static result thumbnail (JPEG or GIF), if it exists - ThumbnailUrl string `json:"thumbnail_url"` - // The URL of the MPEG4-file (file size must not exceed 1MB) - Mpeg4Url string `json:"mpeg4_url"` - // Duration of the video, in seconds - Mpeg4Duration int32 `json:"mpeg4_duration"` - // Width of the video - Mpeg4Width int32 `json:"mpeg4_width"` - // Height of the video - Mpeg4Height int32 `json:"mpeg4_height"` - // The message reply markup. Must be of type replyMarkupInlineKeyboard or null - ReplyMarkup ReplyMarkup `json:"reply_markup"` - // The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAnimation, InputMessageLocation, InputMessageVenue or InputMessageContact - InputMessageContent InputMessageContent `json:"input_message_content"` + meta + // Unique identifier of the query result + Id string `json:"id"` + // Title of the result + Title string `json:"title"` + // URL of the static result thumbnail (JPEG or GIF), if it exists + ThumbnailUrl string `json:"thumbnail_url"` + // The URL of the MPEG4-file (file size must not exceed 1MB) + Mpeg4Url string `json:"mpeg4_url"` + // Duration of the video, in seconds + Mpeg4Duration int32 `json:"mpeg4_duration"` + // Width of the video + Mpeg4Width int32 `json:"mpeg4_width"` + // Height of the video + Mpeg4Height int32 `json:"mpeg4_height"` + // The message reply markup. Must be of type replyMarkupInlineKeyboard or null + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAnimation, InputMessageLocation, InputMessageVenue or InputMessageContact + InputMessageContent InputMessageContent `json:"input_message_content"` } func (entity *InputInlineQueryResultAnimatedMpeg4) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultAnimatedMpeg4 + type stub InputInlineQueryResultAnimatedMpeg4 - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultAnimatedMpeg4) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultAnimatedMpeg4) GetType() string { - return TypeInputInlineQueryResultAnimatedMpeg4 + return TypeInputInlineQueryResultAnimatedMpeg4 } func (*InputInlineQueryResultAnimatedMpeg4) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultAnimatedMpeg4 + return TypeInputInlineQueryResultAnimatedMpeg4 } func (inputInlineQueryResultAnimatedMpeg4 *InputInlineQueryResultAnimatedMpeg4) UnmarshalJSON(data []byte) error { - var tmp struct { - Id string `json:"id"` - Title string `json:"title"` - ThumbnailUrl string `json:"thumbnail_url"` - Mpeg4Url string `json:"mpeg4_url"` - Mpeg4Duration int32 `json:"mpeg4_duration"` - Mpeg4Width int32 `json:"mpeg4_width"` - Mpeg4Height int32 `json:"mpeg4_height"` - ReplyMarkup json.RawMessage `json:"reply_markup"` - InputMessageContent json.RawMessage `json:"input_message_content"` - } + var tmp struct { + Id string `json:"id"` + Title string `json:"title"` + ThumbnailUrl string `json:"thumbnail_url"` + Mpeg4Url string `json:"mpeg4_url"` + Mpeg4Duration int32 `json:"mpeg4_duration"` + Mpeg4Width int32 `json:"mpeg4_width"` + Mpeg4Height int32 `json:"mpeg4_height"` + ReplyMarkup json.RawMessage `json:"reply_markup"` + InputMessageContent json.RawMessage `json:"input_message_content"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inputInlineQueryResultAnimatedMpeg4.Id = tmp.Id - inputInlineQueryResultAnimatedMpeg4.Title = tmp.Title - inputInlineQueryResultAnimatedMpeg4.ThumbnailUrl = tmp.ThumbnailUrl - inputInlineQueryResultAnimatedMpeg4.Mpeg4Url = tmp.Mpeg4Url - inputInlineQueryResultAnimatedMpeg4.Mpeg4Duration = tmp.Mpeg4Duration - inputInlineQueryResultAnimatedMpeg4.Mpeg4Width = tmp.Mpeg4Width - inputInlineQueryResultAnimatedMpeg4.Mpeg4Height = tmp.Mpeg4Height + inputInlineQueryResultAnimatedMpeg4.Id = tmp.Id + inputInlineQueryResultAnimatedMpeg4.Title = tmp.Title + inputInlineQueryResultAnimatedMpeg4.ThumbnailUrl = tmp.ThumbnailUrl + inputInlineQueryResultAnimatedMpeg4.Mpeg4Url = tmp.Mpeg4Url + inputInlineQueryResultAnimatedMpeg4.Mpeg4Duration = tmp.Mpeg4Duration + inputInlineQueryResultAnimatedMpeg4.Mpeg4Width = tmp.Mpeg4Width + inputInlineQueryResultAnimatedMpeg4.Mpeg4Height = tmp.Mpeg4Height - fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) - inputInlineQueryResultAnimatedMpeg4.ReplyMarkup = fieldReplyMarkup + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultAnimatedMpeg4.ReplyMarkup = fieldReplyMarkup - fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) - inputInlineQueryResultAnimatedMpeg4.InputMessageContent = fieldInputMessageContent + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultAnimatedMpeg4.InputMessageContent = fieldInputMessageContent - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultArticle + type stub InputInlineQueryResultArticle - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultArticle) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultArticle) GetType() string { - return TypeInputInlineQueryResultArticle + return TypeInputInlineQueryResultArticle } func (*InputInlineQueryResultArticle) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultArticle + 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"` - } + 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 - } + 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 + 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 + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultArticle.ReplyMarkup = fieldReplyMarkup - fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) - inputInlineQueryResultArticle.InputMessageContent = fieldInputMessageContent + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultArticle.InputMessageContent = fieldInputMessageContent - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultAudio + type stub InputInlineQueryResultAudio - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultAudio) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultAudio) GetType() string { - return TypeInputInlineQueryResultAudio + return TypeInputInlineQueryResultAudio } func (*InputInlineQueryResultAudio) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultAudio + 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"` - } + 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 - } + 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 + 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 + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultAudio.ReplyMarkup = fieldReplyMarkup - fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) - inputInlineQueryResultAudio.InputMessageContent = fieldInputMessageContent + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultAudio.InputMessageContent = fieldInputMessageContent - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultContact + type stub InputInlineQueryResultContact - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultContact) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultContact) GetType() string { - return TypeInputInlineQueryResultContact + return TypeInputInlineQueryResultContact } func (*InputInlineQueryResultContact) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultContact + 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"` - } + 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 - } + 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 + 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 + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultContact.ReplyMarkup = fieldReplyMarkup - fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) - inputInlineQueryResultContact.InputMessageContent = fieldInputMessageContent + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultContact.InputMessageContent = fieldInputMessageContent - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultDocument + type stub InputInlineQueryResultDocument - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultDocument) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultDocument) GetType() string { - return TypeInputInlineQueryResultDocument + return TypeInputInlineQueryResultDocument } func (*InputInlineQueryResultDocument) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultDocument + 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"` - } + 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 - } + 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 + 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 + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultDocument.ReplyMarkup = fieldReplyMarkup - fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) - inputInlineQueryResultDocument.InputMessageContent = fieldInputMessageContent + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultDocument.InputMessageContent = fieldInputMessageContent - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultGame + type stub InputInlineQueryResultGame - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultGame) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultGame) GetType() string { - return TypeInputInlineQueryResultGame + return TypeInputInlineQueryResultGame } func (*InputInlineQueryResultGame) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultGame + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inputInlineQueryResultGame.Id = tmp.Id - inputInlineQueryResultGame.GameShortName = tmp.GameShortName + inputInlineQueryResultGame.Id = tmp.Id + inputInlineQueryResultGame.GameShortName = tmp.GameShortName - fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) - inputInlineQueryResultGame.ReplyMarkup = fieldReplyMarkup + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultGame.ReplyMarkup = fieldReplyMarkup - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultLocation + type stub InputInlineQueryResultLocation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultLocation) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultLocation) GetType() string { - return TypeInputInlineQueryResultLocation + return TypeInputInlineQueryResultLocation } func (*InputInlineQueryResultLocation) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultLocation + 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"` - } + 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 - } + 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 + 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 + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultLocation.ReplyMarkup = fieldReplyMarkup - fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) - inputInlineQueryResultLocation.InputMessageContent = fieldInputMessageContent + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultLocation.InputMessageContent = fieldInputMessageContent - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultPhoto + type stub InputInlineQueryResultPhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultPhoto) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultPhoto) GetType() string { - return TypeInputInlineQueryResultPhoto + return TypeInputInlineQueryResultPhoto } func (*InputInlineQueryResultPhoto) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultPhoto + 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"` - } + 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 - } + 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 + 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 + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultPhoto.ReplyMarkup = fieldReplyMarkup - fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) - inputInlineQueryResultPhoto.InputMessageContent = fieldInputMessageContent + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultPhoto.InputMessageContent = fieldInputMessageContent - return nil + return nil } // Represents a link to a WEBP 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 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"` + 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 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() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultSticker + type stub InputInlineQueryResultSticker - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultSticker) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultSticker) GetType() string { - return TypeInputInlineQueryResultSticker + return TypeInputInlineQueryResultSticker } func (*InputInlineQueryResultSticker) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultSticker + 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"` - } + 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 - } + 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 + 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 + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultSticker.ReplyMarkup = fieldReplyMarkup - fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) - inputInlineQueryResultSticker.InputMessageContent = fieldInputMessageContent + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultSticker.InputMessageContent = fieldInputMessageContent - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultVenue + type stub InputInlineQueryResultVenue - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultVenue) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultVenue) GetType() string { - return TypeInputInlineQueryResultVenue + return TypeInputInlineQueryResultVenue } func (*InputInlineQueryResultVenue) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultVenue + 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"` - } + 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 - } + 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 + 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 + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultVenue.ReplyMarkup = fieldReplyMarkup - fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) - inputInlineQueryResultVenue.InputMessageContent = fieldInputMessageContent + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultVenue.InputMessageContent = fieldInputMessageContent - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultVideo + type stub InputInlineQueryResultVideo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultVideo) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultVideo) GetType() string { - return TypeInputInlineQueryResultVideo + return TypeInputInlineQueryResultVideo } func (*InputInlineQueryResultVideo) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultVideo + 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"` - } + 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 - } + 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 + 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 + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultVideo.ReplyMarkup = fieldReplyMarkup - fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) - inputInlineQueryResultVideo.InputMessageContent = fieldInputMessageContent + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultVideo.InputMessageContent = fieldInputMessageContent - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InputInlineQueryResultVoiceNote + type stub InputInlineQueryResultVoiceNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputInlineQueryResultVoiceNote) GetClass() string { - return ClassInputInlineQueryResult + return ClassInputInlineQueryResult } func (*InputInlineQueryResultVoiceNote) GetType() string { - return TypeInputInlineQueryResultVoiceNote + return TypeInputInlineQueryResultVoiceNote } func (*InputInlineQueryResultVoiceNote) InputInlineQueryResultType() string { - return TypeInputInlineQueryResultVoiceNote + 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"` - } + 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 - } + 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 + inputInlineQueryResultVoiceNote.Id = tmp.Id + inputInlineQueryResultVoiceNote.Title = tmp.Title + inputInlineQueryResultVoiceNote.VoiceNoteUrl = tmp.VoiceNoteUrl + inputInlineQueryResultVoiceNote.VoiceNoteDuration = tmp.VoiceNoteDuration - fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) - inputInlineQueryResultVoiceNote.ReplyMarkup = fieldReplyMarkup + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + inputInlineQueryResultVoiceNote.ReplyMarkup = fieldReplyMarkup - fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) - inputInlineQueryResultVoiceNote.InputMessageContent = fieldInputMessageContent + fieldInputMessageContent, _ := UnmarshalInputMessageContent(tmp.InputMessageContent) + inputInlineQueryResultVoiceNote.InputMessageContent = fieldInputMessageContent - return nil + 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; may be null - Thumbnail *PhotoSize `json:"thumbnail"` + 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; may be null + Thumbnail *PhotoSize `json:"thumbnail"` } func (entity *InlineQueryResultArticle) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InlineQueryResultArticle + type stub InlineQueryResultArticle - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResultArticle) GetClass() string { - return ClassInlineQueryResult + return ClassInlineQueryResult } func (*InlineQueryResultArticle) GetType() string { - return TypeInlineQueryResultArticle + return TypeInlineQueryResultArticle } func (*InlineQueryResultArticle) InlineQueryResultType() string { - return TypeInlineQueryResultArticle + 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; may be null - Thumbnail *PhotoSize `json:"thumbnail"` + meta + // Unique identifier of the query result + Id string `json:"id"` + // A user contact + Contact *Contact `json:"contact"` + // Result thumbnail; may be null + Thumbnail *PhotoSize `json:"thumbnail"` } func (entity *InlineQueryResultContact) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InlineQueryResultContact + type stub InlineQueryResultContact - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResultContact) GetClass() string { - return ClassInlineQueryResult + return ClassInlineQueryResult } func (*InlineQueryResultContact) GetType() string { - return TypeInlineQueryResultContact + return TypeInlineQueryResultContact } func (*InlineQueryResultContact) InlineQueryResultType() string { - return TypeInlineQueryResultContact + 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; may be null - Thumbnail *PhotoSize `json:"thumbnail"` + 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; may be null + Thumbnail *PhotoSize `json:"thumbnail"` } func (entity *InlineQueryResultLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InlineQueryResultLocation + type stub InlineQueryResultLocation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResultLocation) GetClass() string { - return ClassInlineQueryResult + return ClassInlineQueryResult } func (*InlineQueryResultLocation) GetType() string { - return TypeInlineQueryResultLocation + return TypeInlineQueryResultLocation } func (*InlineQueryResultLocation) InlineQueryResultType() string { - return TypeInlineQueryResultLocation + 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; may be null - Thumbnail *PhotoSize `json:"thumbnail"` + meta + // Unique identifier of the query result + Id string `json:"id"` + // Venue result + Venue *Venue `json:"venue"` + // Result thumbnail; may be null + Thumbnail *PhotoSize `json:"thumbnail"` } func (entity *InlineQueryResultVenue) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InlineQueryResultVenue + type stub InlineQueryResultVenue - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResultVenue) GetClass() string { - return ClassInlineQueryResult + return ClassInlineQueryResult } func (*InlineQueryResultVenue) GetType() string { - return TypeInlineQueryResultVenue + return TypeInlineQueryResultVenue } func (*InlineQueryResultVenue) InlineQueryResultType() string { - return TypeInlineQueryResultVenue + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InlineQueryResultGame + type stub InlineQueryResultGame - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResultGame) GetClass() string { - return ClassInlineQueryResult + return ClassInlineQueryResult } func (*InlineQueryResultGame) GetType() string { - return TypeInlineQueryResultGame + return TypeInlineQueryResultGame } func (*InlineQueryResultGame) InlineQueryResultType() string { - return TypeInlineQueryResultGame + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InlineQueryResultAnimation + type stub InlineQueryResultAnimation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResultAnimation) GetClass() string { - return ClassInlineQueryResult + return ClassInlineQueryResult } func (*InlineQueryResultAnimation) GetType() string { - return TypeInlineQueryResultAnimation + return TypeInlineQueryResultAnimation } func (*InlineQueryResultAnimation) InlineQueryResultType() string { - return TypeInlineQueryResultAnimation + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InlineQueryResultAudio + type stub InlineQueryResultAudio - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResultAudio) GetClass() string { - return ClassInlineQueryResult + return ClassInlineQueryResult } func (*InlineQueryResultAudio) GetType() string { - return TypeInlineQueryResultAudio + return TypeInlineQueryResultAudio } func (*InlineQueryResultAudio) InlineQueryResultType() string { - return TypeInlineQueryResultAudio + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InlineQueryResultDocument + type stub InlineQueryResultDocument - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResultDocument) GetClass() string { - return ClassInlineQueryResult + return ClassInlineQueryResult } func (*InlineQueryResultDocument) GetType() string { - return TypeInlineQueryResultDocument + return TypeInlineQueryResultDocument } func (*InlineQueryResultDocument) InlineQueryResultType() string { - return TypeInlineQueryResultDocument + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InlineQueryResultPhoto + type stub InlineQueryResultPhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResultPhoto) GetClass() string { - return ClassInlineQueryResult + return ClassInlineQueryResult } func (*InlineQueryResultPhoto) GetType() string { - return TypeInlineQueryResultPhoto + return TypeInlineQueryResultPhoto } func (*InlineQueryResultPhoto) InlineQueryResultType() string { - return TypeInlineQueryResultPhoto + return TypeInlineQueryResultPhoto } // Represents a sticker type InlineQueryResultSticker struct { - meta - // Unique identifier of the query result - Id string `json:"id"` - // Sticker - Sticker *Sticker `json:"sticker"` + 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() + entity.meta.Type = entity.GetType() - type stub InlineQueryResultSticker + type stub InlineQueryResultSticker - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResultSticker) GetClass() string { - return ClassInlineQueryResult + return ClassInlineQueryResult } func (*InlineQueryResultSticker) GetType() string { - return TypeInlineQueryResultSticker + return TypeInlineQueryResultSticker } func (*InlineQueryResultSticker) InlineQueryResultType() string { - return TypeInlineQueryResultSticker + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InlineQueryResultVideo + type stub InlineQueryResultVideo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResultVideo) GetClass() string { - return ClassInlineQueryResult + return ClassInlineQueryResult } func (*InlineQueryResultVideo) GetType() string { - return TypeInlineQueryResultVideo + return TypeInlineQueryResultVideo } func (*InlineQueryResultVideo) InlineQueryResultType() string { - return TypeInlineQueryResultVideo + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InlineQueryResultVoiceNote + type stub InlineQueryResultVoiceNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResultVoiceNote) GetClass() string { - return ClassInlineQueryResult + return ClassInlineQueryResult } func (*InlineQueryResultVoiceNote) GetType() string { - return TypeInlineQueryResultVoiceNote + return TypeInlineQueryResultVoiceNote } func (*InlineQueryResultVoiceNote) InlineQueryResultType() string { - return TypeInlineQueryResultVoiceNote + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub InlineQueryResults + type stub InlineQueryResults - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InlineQueryResults) GetClass() string { - return ClassInlineQueryResults + return ClassInlineQueryResults } func (*InlineQueryResults) GetType() string { - return TypeInlineQueryResults + return TypeInlineQueryResults } // The payload from a general callback button type CallbackQueryPayloadData struct { - meta - // Data that was attached to the callback button - Data []byte `json:"data"` + meta + // Data that was attached to the callback button + Data []byte `json:"data"` } func (entity *CallbackQueryPayloadData) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CallbackQueryPayloadData + type stub CallbackQueryPayloadData - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallbackQueryPayloadData) GetClass() string { - return ClassCallbackQueryPayload + return ClassCallbackQueryPayload } func (*CallbackQueryPayloadData) GetType() string { - return TypeCallbackQueryPayloadData + return TypeCallbackQueryPayloadData } func (*CallbackQueryPayloadData) CallbackQueryPayloadType() string { - return TypeCallbackQueryPayloadData + return TypeCallbackQueryPayloadData } // The payload from 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"` + 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() + entity.meta.Type = entity.GetType() - type stub CallbackQueryPayloadGame + type stub CallbackQueryPayloadGame - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallbackQueryPayloadGame) GetClass() string { - return ClassCallbackQueryPayload + return ClassCallbackQueryPayload } func (*CallbackQueryPayloadGame) GetType() string { - return TypeCallbackQueryPayloadGame + return TypeCallbackQueryPayloadGame } func (*CallbackQueryPayloadGame) CallbackQueryPayloadType() string { - return TypeCallbackQueryPayloadGame + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub CallbackQueryAnswer + type stub CallbackQueryAnswer - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CallbackQueryAnswer) GetClass() string { - return ClassCallbackQueryAnswer + return ClassCallbackQueryAnswer } func (*CallbackQueryAnswer) GetType() string { - return TypeCallbackQueryAnswer + return TypeCallbackQueryAnswer } // Contains the result of a custom request type CustomRequestResult struct { - meta - // A JSON-serialized result - Result string `json:"result"` + meta + // A JSON-serialized result + Result string `json:"result"` } func (entity *CustomRequestResult) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CustomRequestResult + type stub CustomRequestResult - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CustomRequestResult) GetClass() string { - return ClassCustomRequestResult + return ClassCustomRequestResult } func (*CustomRequestResult) GetType() string { - return TypeCustomRequestResult + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub GameHighScore + type stub GameHighScore - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*GameHighScore) GetClass() string { - return ClassGameHighScore + return ClassGameHighScore } func (*GameHighScore) GetType() string { - return TypeGameHighScore + return TypeGameHighScore } // Contains a list of game high scores type GameHighScores struct { - meta - // A list of game high scores - Scores []*GameHighScore `json:"scores"` + meta + // A list of game high scores + Scores []*GameHighScore `json:"scores"` } func (entity *GameHighScores) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub GameHighScores + type stub GameHighScores - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*GameHighScores) GetClass() string { - return ClassGameHighScores + return ClassGameHighScores } func (*GameHighScores) GetType() string { - return TypeGameHighScores + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatEventMessageEdited + type stub ChatEventMessageEdited - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventMessageEdited) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventMessageEdited) GetType() string { - return TypeChatEventMessageEdited + return TypeChatEventMessageEdited } func (*ChatEventMessageEdited) ChatEventActionType() string { - return TypeChatEventMessageEdited + return TypeChatEventMessageEdited } // A message was deleted type ChatEventMessageDeleted struct { - meta - // Deleted message - Message *Message `json:"message"` + meta + // Deleted message + Message *Message `json:"message"` } func (entity *ChatEventMessageDeleted) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatEventMessageDeleted + type stub ChatEventMessageDeleted - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventMessageDeleted) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventMessageDeleted) GetType() string { - return TypeChatEventMessageDeleted + return TypeChatEventMessageDeleted } func (*ChatEventMessageDeleted) ChatEventActionType() string { - return TypeChatEventMessageDeleted + return TypeChatEventMessageDeleted } // A message was pinned type ChatEventMessagePinned struct { - meta - // Pinned message - Message *Message `json:"message"` + meta + // Pinned message + Message *Message `json:"message"` } func (entity *ChatEventMessagePinned) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatEventMessagePinned + type stub ChatEventMessagePinned - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventMessagePinned) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventMessagePinned) GetType() string { - return TypeChatEventMessagePinned + return TypeChatEventMessagePinned } func (*ChatEventMessagePinned) ChatEventActionType() string { - return TypeChatEventMessagePinned + return TypeChatEventMessagePinned } // A message was unpinned -type ChatEventMessageUnpinned struct{ - meta +type ChatEventMessageUnpinned struct { + meta } func (entity *ChatEventMessageUnpinned) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatEventMessageUnpinned + type stub ChatEventMessageUnpinned - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventMessageUnpinned) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventMessageUnpinned) GetType() string { - return TypeChatEventMessageUnpinned + return TypeChatEventMessageUnpinned } func (*ChatEventMessageUnpinned) ChatEventActionType() string { - return TypeChatEventMessageUnpinned + return TypeChatEventMessageUnpinned } // A new member joined the chat -type ChatEventMemberJoined struct{ - meta +type ChatEventMemberJoined struct { + meta } func (entity *ChatEventMemberJoined) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatEventMemberJoined + type stub ChatEventMemberJoined - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventMemberJoined) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventMemberJoined) GetType() string { - return TypeChatEventMemberJoined + return TypeChatEventMemberJoined } func (*ChatEventMemberJoined) ChatEventActionType() string { - return TypeChatEventMemberJoined + return TypeChatEventMemberJoined } // A member left the chat -type ChatEventMemberLeft struct{ - meta +type ChatEventMemberLeft struct { + meta } func (entity *ChatEventMemberLeft) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatEventMemberLeft + type stub ChatEventMemberLeft - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventMemberLeft) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventMemberLeft) GetType() string { - return TypeChatEventMemberLeft + return TypeChatEventMemberLeft } func (*ChatEventMemberLeft) ChatEventActionType() string { - return TypeChatEventMemberLeft + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatEventMemberInvited + type stub ChatEventMemberInvited - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventMemberInvited) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventMemberInvited) GetType() string { - return TypeChatEventMemberInvited + return TypeChatEventMemberInvited } func (*ChatEventMemberInvited) ChatEventActionType() string { - return TypeChatEventMemberInvited + return TypeChatEventMemberInvited } func (chatEventMemberInvited *ChatEventMemberInvited) UnmarshalJSON(data []byte) error { - var tmp struct { - UserId int32 `json:"user_id"` - Status json.RawMessage `json:"status"` - } + var tmp struct { + UserId int32 `json:"user_id"` + Status json.RawMessage `json:"status"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - chatEventMemberInvited.UserId = tmp.UserId + chatEventMemberInvited.UserId = tmp.UserId - fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) - chatEventMemberInvited.Status = fieldStatus + fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) + chatEventMemberInvited.Status = fieldStatus - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatEventMemberPromoted + type stub ChatEventMemberPromoted - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventMemberPromoted) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventMemberPromoted) GetType() string { - return TypeChatEventMemberPromoted + return TypeChatEventMemberPromoted } func (*ChatEventMemberPromoted) ChatEventActionType() string { - return TypeChatEventMemberPromoted + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - chatEventMemberPromoted.UserId = tmp.UserId + chatEventMemberPromoted.UserId = tmp.UserId - fieldOldStatus, _ := UnmarshalChatMemberStatus(tmp.OldStatus) - chatEventMemberPromoted.OldStatus = fieldOldStatus + fieldOldStatus, _ := UnmarshalChatMemberStatus(tmp.OldStatus) + chatEventMemberPromoted.OldStatus = fieldOldStatus - fieldNewStatus, _ := UnmarshalChatMemberStatus(tmp.NewStatus) - chatEventMemberPromoted.NewStatus = fieldNewStatus + fieldNewStatus, _ := UnmarshalChatMemberStatus(tmp.NewStatus) + chatEventMemberPromoted.NewStatus = fieldNewStatus - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatEventMemberRestricted + type stub ChatEventMemberRestricted - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventMemberRestricted) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventMemberRestricted) GetType() string { - return TypeChatEventMemberRestricted + return TypeChatEventMemberRestricted } func (*ChatEventMemberRestricted) ChatEventActionType() string { - return TypeChatEventMemberRestricted + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - chatEventMemberRestricted.UserId = tmp.UserId + chatEventMemberRestricted.UserId = tmp.UserId - fieldOldStatus, _ := UnmarshalChatMemberStatus(tmp.OldStatus) - chatEventMemberRestricted.OldStatus = fieldOldStatus + fieldOldStatus, _ := UnmarshalChatMemberStatus(tmp.OldStatus) + chatEventMemberRestricted.OldStatus = fieldOldStatus - fieldNewStatus, _ := UnmarshalChatMemberStatus(tmp.NewStatus) - chatEventMemberRestricted.NewStatus = fieldNewStatus + fieldNewStatus, _ := UnmarshalChatMemberStatus(tmp.NewStatus) + chatEventMemberRestricted.NewStatus = fieldNewStatus - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatEventTitleChanged + type stub ChatEventTitleChanged - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventTitleChanged) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventTitleChanged) GetType() string { - return TypeChatEventTitleChanged + return TypeChatEventTitleChanged } func (*ChatEventTitleChanged) ChatEventActionType() string { - return TypeChatEventTitleChanged + return TypeChatEventTitleChanged } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatEventDescriptionChanged + type stub ChatEventDescriptionChanged - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventDescriptionChanged) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventDescriptionChanged) GetType() string { - return TypeChatEventDescriptionChanged + return TypeChatEventDescriptionChanged } func (*ChatEventDescriptionChanged) ChatEventActionType() string { - return TypeChatEventDescriptionChanged + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatEventUsernameChanged + type stub ChatEventUsernameChanged - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventUsernameChanged) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventUsernameChanged) GetType() string { - return TypeChatEventUsernameChanged + return TypeChatEventUsernameChanged } func (*ChatEventUsernameChanged) ChatEventActionType() string { - return TypeChatEventUsernameChanged + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatEventPhotoChanged + type stub ChatEventPhotoChanged - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventPhotoChanged) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventPhotoChanged) GetType() string { - return TypeChatEventPhotoChanged + return TypeChatEventPhotoChanged } func (*ChatEventPhotoChanged) ChatEventActionType() string { - return TypeChatEventPhotoChanged + return TypeChatEventPhotoChanged } // The anyone_can_invite setting of a supergroup chat was toggled type ChatEventInvitesToggled struct { - meta - // New value of anyone_can_invite - AnyoneCanInvite bool `json:"anyone_can_invite"` + meta + // New value of anyone_can_invite + AnyoneCanInvite bool `json:"anyone_can_invite"` } func (entity *ChatEventInvitesToggled) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatEventInvitesToggled + type stub ChatEventInvitesToggled - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventInvitesToggled) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventInvitesToggled) GetType() string { - return TypeChatEventInvitesToggled + return TypeChatEventInvitesToggled } func (*ChatEventInvitesToggled) ChatEventActionType() string { - return TypeChatEventInvitesToggled + return TypeChatEventInvitesToggled } // The sign_messages setting of a channel was toggled type ChatEventSignMessagesToggled struct { - meta - // New value of sign_messages - SignMessages bool `json:"sign_messages"` + meta + // New value of sign_messages + SignMessages bool `json:"sign_messages"` } func (entity *ChatEventSignMessagesToggled) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatEventSignMessagesToggled + type stub ChatEventSignMessagesToggled - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventSignMessagesToggled) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventSignMessagesToggled) GetType() string { - return TypeChatEventSignMessagesToggled + return TypeChatEventSignMessagesToggled } func (*ChatEventSignMessagesToggled) ChatEventActionType() string { - return TypeChatEventSignMessagesToggled + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatEventStickerSetChanged + type stub ChatEventStickerSetChanged - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventStickerSetChanged) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventStickerSetChanged) GetType() string { - return TypeChatEventStickerSetChanged + return TypeChatEventStickerSetChanged } func (*ChatEventStickerSetChanged) ChatEventActionType() string { - return TypeChatEventStickerSetChanged + return TypeChatEventStickerSetChanged } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatEventIsAllHistoryAvailableToggled + type stub ChatEventIsAllHistoryAvailableToggled - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventIsAllHistoryAvailableToggled) GetClass() string { - return ClassChatEventAction + return ClassChatEventAction } func (*ChatEventIsAllHistoryAvailableToggled) GetType() string { - return TypeChatEventIsAllHistoryAvailableToggled + return TypeChatEventIsAllHistoryAvailableToggled } func (*ChatEventIsAllHistoryAvailableToggled) ChatEventActionType() string { - return TypeChatEventIsAllHistoryAvailableToggled + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatEvent + type stub ChatEvent - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEvent) GetClass() string { - return ClassChatEvent + return ClassChatEvent } func (*ChatEvent) GetType() string { - return TypeChatEvent + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - chatEvent.Id = tmp.Id - chatEvent.Date = tmp.Date - chatEvent.UserId = tmp.UserId + chatEvent.Id = tmp.Id + chatEvent.Date = tmp.Date + chatEvent.UserId = tmp.UserId - fieldAction, _ := UnmarshalChatEventAction(tmp.Action) - chatEvent.Action = fieldAction + fieldAction, _ := UnmarshalChatEventAction(tmp.Action) + chatEvent.Action = fieldAction - return nil + return nil } // Contains a list of chat events type ChatEvents struct { - meta - // List of events - Events []*ChatEvent `json:"events"` + meta + // List of events + Events []*ChatEvent `json:"events"` } func (entity *ChatEvents) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatEvents + type stub ChatEvents - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEvents) GetClass() string { - return ClassChatEvents + return ClassChatEvents } func (*ChatEvents) GetType() string { - return TypeChatEvents + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ChatEventLogFilters + type stub ChatEventLogFilters - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatEventLogFilters) GetClass() string { - return ClassChatEventLogFilters + return ClassChatEventLogFilters } func (*ChatEventLogFilters) GetType() string { - return TypeChatEventLogFilters + return TypeChatEventLogFilters } // An ordinary language pack string type LanguagePackStringValueOrdinary struct { - meta - // String value - Value string `json:"value"` + meta + // String value + Value string `json:"value"` } func (entity *LanguagePackStringValueOrdinary) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub LanguagePackStringValueOrdinary + type stub LanguagePackStringValueOrdinary - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LanguagePackStringValueOrdinary) GetClass() string { - return ClassLanguagePackStringValue + return ClassLanguagePackStringValue } func (*LanguagePackStringValueOrdinary) GetType() string { - return TypeLanguagePackStringValueOrdinary + return TypeLanguagePackStringValueOrdinary } func (*LanguagePackStringValueOrdinary) LanguagePackStringValueType() string { - return TypeLanguagePackStringValueOrdinary + return TypeLanguagePackStringValueOrdinary } // A language pack string which has different forms based on the number of some object it mentions 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"` + 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() + entity.meta.Type = entity.GetType() - type stub LanguagePackStringValuePluralized + type stub LanguagePackStringValuePluralized - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LanguagePackStringValuePluralized) GetClass() string { - return ClassLanguagePackStringValue + return ClassLanguagePackStringValue } func (*LanguagePackStringValuePluralized) GetType() string { - return TypeLanguagePackStringValuePluralized + return TypeLanguagePackStringValuePluralized } func (*LanguagePackStringValuePluralized) LanguagePackStringValueType() string { - return TypeLanguagePackStringValuePluralized + return TypeLanguagePackStringValuePluralized } // A deleted language pack string, the value should be taken from the built-in english language pack -type LanguagePackStringValueDeleted struct{ - meta +type LanguagePackStringValueDeleted struct { + meta } func (entity *LanguagePackStringValueDeleted) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub LanguagePackStringValueDeleted + type stub LanguagePackStringValueDeleted - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LanguagePackStringValueDeleted) GetClass() string { - return ClassLanguagePackStringValue + return ClassLanguagePackStringValue } func (*LanguagePackStringValueDeleted) GetType() string { - return TypeLanguagePackStringValueDeleted + return TypeLanguagePackStringValueDeleted } func (*LanguagePackStringValueDeleted) LanguagePackStringValueType() string { - return TypeLanguagePackStringValueDeleted + return TypeLanguagePackStringValueDeleted } // Represents one language pack string type LanguagePackString struct { - meta - // String key - Key string `json:"key"` - // String value - Value LanguagePackStringValue `json:"value"` + meta + // String key + Key string `json:"key"` + // String value + Value LanguagePackStringValue `json:"value"` } func (entity *LanguagePackString) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub LanguagePackString + type stub LanguagePackString - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LanguagePackString) GetClass() string { - return ClassLanguagePackString + return ClassLanguagePackString } func (*LanguagePackString) GetType() string { - return TypeLanguagePackString + return TypeLanguagePackString } func (languagePackString *LanguagePackString) UnmarshalJSON(data []byte) error { - var tmp struct { - Key string `json:"key"` - Value json.RawMessage `json:"value"` - } + var tmp struct { + Key string `json:"key"` + Value json.RawMessage `json:"value"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - languagePackString.Key = tmp.Key + languagePackString.Key = tmp.Key - fieldValue, _ := UnmarshalLanguagePackStringValue(tmp.Value) - languagePackString.Value = fieldValue + fieldValue, _ := UnmarshalLanguagePackStringValue(tmp.Value) + languagePackString.Value = fieldValue - return nil + return nil } // Contains a list of language pack strings type LanguagePackStrings struct { - meta - // A list of language pack strings - Strings []*LanguagePackString `json:"strings"` + meta + // A list of language pack strings + Strings []*LanguagePackString `json:"strings"` } func (entity *LanguagePackStrings) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub LanguagePackStrings + type stub LanguagePackStrings - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LanguagePackStrings) GetClass() string { - return ClassLanguagePackStrings + return ClassLanguagePackStrings } func (*LanguagePackStrings) GetType() string { - return TypeLanguagePackStrings + return TypeLanguagePackStrings } // Contains information about a language pack type LanguagePackInfo struct { - meta - // Unique language pack identifier - Id string `json:"id"` - // Language name - Name string `json:"name"` - // Name of the language in that language - NativeName string `json:"native_name"` - // Total number of non-deleted strings from the language pack available locally - LocalStringCount int32 `json:"local_string_count"` + meta + // Unique language pack identifier + Id string `json:"id"` + // Language name + Name string `json:"name"` + // Name of the language in that language + NativeName string `json:"native_name"` + // Total number of non-deleted strings from the language pack available locally + LocalStringCount int32 `json:"local_string_count"` } func (entity *LanguagePackInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub LanguagePackInfo + type stub LanguagePackInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LanguagePackInfo) GetClass() string { - return ClassLanguagePackInfo + return ClassLanguagePackInfo } func (*LanguagePackInfo) GetType() string { - return TypeLanguagePackInfo + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub LocalizationTargetInfo + type stub LocalizationTargetInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LocalizationTargetInfo) GetClass() string { - return ClassLocalizationTargetInfo + return ClassLocalizationTargetInfo } func (*LocalizationTargetInfo) GetType() string { - return TypeLocalizationTargetInfo + return TypeLocalizationTargetInfo } // A token for Google Cloud Messaging type DeviceTokenGoogleCloudMessaging struct { - meta - // Device registration token; may be empty to de-register a device - Token string `json:"token"` + meta + // Device registration token; may be empty to de-register a device + Token string `json:"token"` } func (entity *DeviceTokenGoogleCloudMessaging) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub DeviceTokenGoogleCloudMessaging + type stub DeviceTokenGoogleCloudMessaging - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DeviceTokenGoogleCloudMessaging) GetClass() string { - return ClassDeviceToken + return ClassDeviceToken } func (*DeviceTokenGoogleCloudMessaging) GetType() string { - return TypeDeviceTokenGoogleCloudMessaging + return TypeDeviceTokenGoogleCloudMessaging } func (*DeviceTokenGoogleCloudMessaging) DeviceTokenType() string { - return TypeDeviceTokenGoogleCloudMessaging + return TypeDeviceTokenGoogleCloudMessaging } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub DeviceTokenApplePush + type stub DeviceTokenApplePush - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DeviceTokenApplePush) GetClass() string { - return ClassDeviceToken + return ClassDeviceToken } func (*DeviceTokenApplePush) GetType() string { - return TypeDeviceTokenApplePush + return TypeDeviceTokenApplePush } func (*DeviceTokenApplePush) DeviceTokenType() string { - return TypeDeviceTokenApplePush + 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"` + 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 *DeviceTokenApplePushVoIP) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub DeviceTokenApplePushVoIP + type stub DeviceTokenApplePushVoIP - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DeviceTokenApplePushVoIP) GetClass() string { - return ClassDeviceToken + return ClassDeviceToken } func (*DeviceTokenApplePushVoIP) GetType() string { - return TypeDeviceTokenApplePushVoIP + return TypeDeviceTokenApplePushVoIP } func (*DeviceTokenApplePushVoIP) DeviceTokenType() string { - return TypeDeviceTokenApplePushVoIP + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub DeviceTokenWindowsPush + type stub DeviceTokenWindowsPush - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DeviceTokenWindowsPush) GetClass() string { - return ClassDeviceToken + return ClassDeviceToken } func (*DeviceTokenWindowsPush) GetType() string { - return TypeDeviceTokenWindowsPush + return TypeDeviceTokenWindowsPush } func (*DeviceTokenWindowsPush) DeviceTokenType() string { - return TypeDeviceTokenWindowsPush + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub DeviceTokenMicrosoftPush + type stub DeviceTokenMicrosoftPush - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DeviceTokenMicrosoftPush) GetClass() string { - return ClassDeviceToken + return ClassDeviceToken } func (*DeviceTokenMicrosoftPush) GetType() string { - return TypeDeviceTokenMicrosoftPush + return TypeDeviceTokenMicrosoftPush } func (*DeviceTokenMicrosoftPush) DeviceTokenType() string { - return TypeDeviceTokenMicrosoftPush + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub DeviceTokenMicrosoftPushVoIP + type stub DeviceTokenMicrosoftPushVoIP - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DeviceTokenMicrosoftPushVoIP) GetClass() string { - return ClassDeviceToken + return ClassDeviceToken } func (*DeviceTokenMicrosoftPushVoIP) GetType() string { - return TypeDeviceTokenMicrosoftPushVoIP + return TypeDeviceTokenMicrosoftPushVoIP } func (*DeviceTokenMicrosoftPushVoIP) DeviceTokenType() string { - return TypeDeviceTokenMicrosoftPushVoIP + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub DeviceTokenWebPush + type stub DeviceTokenWebPush - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DeviceTokenWebPush) GetClass() string { - return ClassDeviceToken + return ClassDeviceToken } func (*DeviceTokenWebPush) GetType() string { - return TypeDeviceTokenWebPush + return TypeDeviceTokenWebPush } func (*DeviceTokenWebPush) DeviceTokenType() string { - return TypeDeviceTokenWebPush + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub DeviceTokenSimplePush + type stub DeviceTokenSimplePush - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DeviceTokenSimplePush) GetClass() string { - return ClassDeviceToken + return ClassDeviceToken } func (*DeviceTokenSimplePush) GetType() string { - return TypeDeviceTokenSimplePush + return TypeDeviceTokenSimplePush } func (*DeviceTokenSimplePush) DeviceTokenType() string { - return TypeDeviceTokenSimplePush + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub DeviceTokenUbuntuPush + type stub DeviceTokenUbuntuPush - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DeviceTokenUbuntuPush) GetClass() string { - return ClassDeviceToken + return ClassDeviceToken } func (*DeviceTokenUbuntuPush) GetType() string { - return TypeDeviceTokenUbuntuPush + return TypeDeviceTokenUbuntuPush } func (*DeviceTokenUbuntuPush) DeviceTokenType() string { - return TypeDeviceTokenUbuntuPush + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub DeviceTokenBlackBerryPush + type stub DeviceTokenBlackBerryPush - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DeviceTokenBlackBerryPush) GetClass() string { - return ClassDeviceToken + return ClassDeviceToken } func (*DeviceTokenBlackBerryPush) GetType() string { - return TypeDeviceTokenBlackBerryPush + return TypeDeviceTokenBlackBerryPush } func (*DeviceTokenBlackBerryPush) DeviceTokenType() string { - return TypeDeviceTokenBlackBerryPush + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub DeviceTokenTizenPush + type stub DeviceTokenTizenPush - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DeviceTokenTizenPush) GetClass() string { - return ClassDeviceToken + return ClassDeviceToken } func (*DeviceTokenTizenPush) GetType() string { - return TypeDeviceTokenTizenPush + return TypeDeviceTokenTizenPush } func (*DeviceTokenTizenPush) DeviceTokenType() string { - return TypeDeviceTokenTizenPush + return TypeDeviceTokenTizenPush } // Contains information about a wallpaper type Wallpaper struct { - meta - // Unique persistent wallpaper identifier - Id int32 `json:"id"` - // Available variants of the wallpaper in different sizes. These photos can only be downloaded; they can't be sent in a message - Sizes []*PhotoSize `json:"sizes"` - // Main color of the wallpaper in RGB24 format; should be treated as background color if no photos are specified - Color int32 `json:"color"` + meta + // Unique persistent wallpaper identifier + Id int32 `json:"id"` + // Available variants of the wallpaper in different sizes. These photos can only be downloaded; they can't be sent in a message + Sizes []*PhotoSize `json:"sizes"` + // Main color of the wallpaper in RGB24 format; should be treated as background color if no photos are specified + Color int32 `json:"color"` } func (entity *Wallpaper) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Wallpaper + type stub Wallpaper - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Wallpaper) GetClass() string { - return ClassWallpaper + return ClassWallpaper } func (*Wallpaper) GetType() string { - return TypeWallpaper + return TypeWallpaper } // Contains a list of wallpapers type Wallpapers struct { - meta - // A list of wallpapers - Wallpapers []*Wallpaper `json:"wallpapers"` + meta + // A list of wallpapers + Wallpapers []*Wallpaper `json:"wallpapers"` } func (entity *Wallpapers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Wallpapers + type stub Wallpapers - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Wallpapers) GetClass() string { - return ClassWallpapers + return ClassWallpapers } func (*Wallpapers) GetType() string { - return TypeWallpapers + return TypeWallpapers } // Contains a list of hashtags type Hashtags struct { - meta - // A list of hashtags - Hashtags []string `json:"hashtags"` + meta + // A list of hashtags + Hashtags []string `json:"hashtags"` } func (entity *Hashtags) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Hashtags + type stub Hashtags - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Hashtags) GetClass() string { - return ClassHashtags + return ClassHashtags } func (*Hashtags) GetType() string { - return TypeHashtags + return TypeHashtags } // The username can be set -type CheckChatUsernameResultOk struct{ - meta +type CheckChatUsernameResultOk struct { + meta } func (entity *CheckChatUsernameResultOk) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CheckChatUsernameResultOk + type stub CheckChatUsernameResultOk - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CheckChatUsernameResultOk) GetClass() string { - return ClassCheckChatUsernameResult + return ClassCheckChatUsernameResult } func (*CheckChatUsernameResultOk) GetType() string { - return TypeCheckChatUsernameResultOk + return TypeCheckChatUsernameResultOk } func (*CheckChatUsernameResultOk) CheckChatUsernameResultType() string { - return TypeCheckChatUsernameResultOk + return TypeCheckChatUsernameResultOk } // The username is invalid -type CheckChatUsernameResultUsernameInvalid struct{ - meta +type CheckChatUsernameResultUsernameInvalid struct { + meta } func (entity *CheckChatUsernameResultUsernameInvalid) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CheckChatUsernameResultUsernameInvalid + type stub CheckChatUsernameResultUsernameInvalid - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CheckChatUsernameResultUsernameInvalid) GetClass() string { - return ClassCheckChatUsernameResult + return ClassCheckChatUsernameResult } func (*CheckChatUsernameResultUsernameInvalid) GetType() string { - return TypeCheckChatUsernameResultUsernameInvalid + return TypeCheckChatUsernameResultUsernameInvalid } func (*CheckChatUsernameResultUsernameInvalid) CheckChatUsernameResultType() string { - return TypeCheckChatUsernameResultUsernameInvalid + return TypeCheckChatUsernameResultUsernameInvalid } // The username is occupied -type CheckChatUsernameResultUsernameOccupied struct{ - meta +type CheckChatUsernameResultUsernameOccupied struct { + meta } func (entity *CheckChatUsernameResultUsernameOccupied) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CheckChatUsernameResultUsernameOccupied + type stub CheckChatUsernameResultUsernameOccupied - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CheckChatUsernameResultUsernameOccupied) GetClass() string { - return ClassCheckChatUsernameResult + return ClassCheckChatUsernameResult } func (*CheckChatUsernameResultUsernameOccupied) GetType() string { - return TypeCheckChatUsernameResultUsernameOccupied + return TypeCheckChatUsernameResultUsernameOccupied } func (*CheckChatUsernameResultUsernameOccupied) CheckChatUsernameResultType() string { - return TypeCheckChatUsernameResultUsernameOccupied + return TypeCheckChatUsernameResultUsernameOccupied } // The user has too much public chats, one of them should be made private first -type CheckChatUsernameResultPublicChatsTooMuch struct{ - meta +type CheckChatUsernameResultPublicChatsTooMuch struct { + meta } func (entity *CheckChatUsernameResultPublicChatsTooMuch) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CheckChatUsernameResultPublicChatsTooMuch + type stub CheckChatUsernameResultPublicChatsTooMuch - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CheckChatUsernameResultPublicChatsTooMuch) GetClass() string { - return ClassCheckChatUsernameResult + return ClassCheckChatUsernameResult } func (*CheckChatUsernameResultPublicChatsTooMuch) GetType() string { - return TypeCheckChatUsernameResultPublicChatsTooMuch + return TypeCheckChatUsernameResultPublicChatsTooMuch } func (*CheckChatUsernameResultPublicChatsTooMuch) CheckChatUsernameResultType() string { - return TypeCheckChatUsernameResultPublicChatsTooMuch + return TypeCheckChatUsernameResultPublicChatsTooMuch } // The user can't be a member of a public supergroup -type CheckChatUsernameResultPublicGroupsUnavailable struct{ - meta +type CheckChatUsernameResultPublicGroupsUnavailable struct { + meta } func (entity *CheckChatUsernameResultPublicGroupsUnavailable) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub CheckChatUsernameResultPublicGroupsUnavailable + type stub CheckChatUsernameResultPublicGroupsUnavailable - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*CheckChatUsernameResultPublicGroupsUnavailable) GetClass() string { - return ClassCheckChatUsernameResult + return ClassCheckChatUsernameResult } func (*CheckChatUsernameResultPublicGroupsUnavailable) GetType() string { - return TypeCheckChatUsernameResultPublicGroupsUnavailable + return TypeCheckChatUsernameResultPublicGroupsUnavailable } func (*CheckChatUsernameResultPublicGroupsUnavailable) CheckChatUsernameResultType() string { - return TypeCheckChatUsernameResultPublicGroupsUnavailable + return TypeCheckChatUsernameResultPublicGroupsUnavailable } // Boolean option type OptionValueBoolean struct { - meta - // The value of the option - Value bool `json:"value"` + meta + // The value of the option + Value bool `json:"value"` } func (entity *OptionValueBoolean) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub OptionValueBoolean + type stub OptionValueBoolean - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*OptionValueBoolean) GetClass() string { - return ClassOptionValue + return ClassOptionValue } func (*OptionValueBoolean) GetType() string { - return TypeOptionValueBoolean + return TypeOptionValueBoolean } func (*OptionValueBoolean) OptionValueType() string { - return TypeOptionValueBoolean + return TypeOptionValueBoolean } // An unknown option or an option which has a default value -type OptionValueEmpty struct{ - meta +type OptionValueEmpty struct { + meta } func (entity *OptionValueEmpty) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub OptionValueEmpty + type stub OptionValueEmpty - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*OptionValueEmpty) GetClass() string { - return ClassOptionValue + return ClassOptionValue } func (*OptionValueEmpty) GetType() string { - return TypeOptionValueEmpty + return TypeOptionValueEmpty } func (*OptionValueEmpty) OptionValueType() string { - return TypeOptionValueEmpty + return TypeOptionValueEmpty } // An integer option type OptionValueInteger struct { - meta - // The value of the option - Value int32 `json:"value"` + meta + // The value of the option + Value int32 `json:"value"` } func (entity *OptionValueInteger) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub OptionValueInteger + type stub OptionValueInteger - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*OptionValueInteger) GetClass() string { - return ClassOptionValue + return ClassOptionValue } func (*OptionValueInteger) GetType() string { - return TypeOptionValueInteger + return TypeOptionValueInteger } func (*OptionValueInteger) OptionValueType() string { - return TypeOptionValueInteger + return TypeOptionValueInteger } // A string option type OptionValueString struct { - meta - // The value of the option - Value string `json:"value"` + meta + // The value of the option + Value string `json:"value"` } func (entity *OptionValueString) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub OptionValueString + type stub OptionValueString - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*OptionValueString) GetClass() string { - return ClassOptionValue + return ClassOptionValue } func (*OptionValueString) GetType() string { - return TypeOptionValueString + return TypeOptionValueString } func (*OptionValueString) OptionValueType() string { - return TypeOptionValueString + return TypeOptionValueString } // A rule to allow all users to do something -type UserPrivacySettingRuleAllowAll struct{ - meta +type UserPrivacySettingRuleAllowAll struct { + meta } func (entity *UserPrivacySettingRuleAllowAll) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserPrivacySettingRuleAllowAll + type stub UserPrivacySettingRuleAllowAll - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserPrivacySettingRuleAllowAll) GetClass() string { - return ClassUserPrivacySettingRule + return ClassUserPrivacySettingRule } func (*UserPrivacySettingRuleAllowAll) GetType() string { - return TypeUserPrivacySettingRuleAllowAll + return TypeUserPrivacySettingRuleAllowAll } func (*UserPrivacySettingRuleAllowAll) UserPrivacySettingRuleType() string { - return TypeUserPrivacySettingRuleAllowAll + return TypeUserPrivacySettingRuleAllowAll } // A rule to allow all of a user's contacts to do something -type UserPrivacySettingRuleAllowContacts struct{ - meta +type UserPrivacySettingRuleAllowContacts struct { + meta } func (entity *UserPrivacySettingRuleAllowContacts) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserPrivacySettingRuleAllowContacts + type stub UserPrivacySettingRuleAllowContacts - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserPrivacySettingRuleAllowContacts) GetClass() string { - return ClassUserPrivacySettingRule + return ClassUserPrivacySettingRule } func (*UserPrivacySettingRuleAllowContacts) GetType() string { - return TypeUserPrivacySettingRuleAllowContacts + return TypeUserPrivacySettingRuleAllowContacts } func (*UserPrivacySettingRuleAllowContacts) UserPrivacySettingRuleType() string { - return TypeUserPrivacySettingRuleAllowContacts + return TypeUserPrivacySettingRuleAllowContacts } // A rule to allow certain specified users to do something type UserPrivacySettingRuleAllowUsers struct { - meta - // The user identifiers - UserIds []int32 `json:"user_ids"` + meta + // The user identifiers + UserIds []int32 `json:"user_ids"` } func (entity *UserPrivacySettingRuleAllowUsers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserPrivacySettingRuleAllowUsers + type stub UserPrivacySettingRuleAllowUsers - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserPrivacySettingRuleAllowUsers) GetClass() string { - return ClassUserPrivacySettingRule + return ClassUserPrivacySettingRule } func (*UserPrivacySettingRuleAllowUsers) GetType() string { - return TypeUserPrivacySettingRuleAllowUsers + return TypeUserPrivacySettingRuleAllowUsers } func (*UserPrivacySettingRuleAllowUsers) UserPrivacySettingRuleType() string { - return TypeUserPrivacySettingRuleAllowUsers + return TypeUserPrivacySettingRuleAllowUsers } // A rule to restrict all users from doing something -type UserPrivacySettingRuleRestrictAll struct{ - meta +type UserPrivacySettingRuleRestrictAll struct { + meta } func (entity *UserPrivacySettingRuleRestrictAll) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserPrivacySettingRuleRestrictAll + type stub UserPrivacySettingRuleRestrictAll - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserPrivacySettingRuleRestrictAll) GetClass() string { - return ClassUserPrivacySettingRule + return ClassUserPrivacySettingRule } func (*UserPrivacySettingRuleRestrictAll) GetType() string { - return TypeUserPrivacySettingRuleRestrictAll + return TypeUserPrivacySettingRuleRestrictAll } func (*UserPrivacySettingRuleRestrictAll) UserPrivacySettingRuleType() string { - return TypeUserPrivacySettingRuleRestrictAll + return TypeUserPrivacySettingRuleRestrictAll } // A rule to restrict all contacts of a user from doing something -type UserPrivacySettingRuleRestrictContacts struct{ - meta +type UserPrivacySettingRuleRestrictContacts struct { + meta } func (entity *UserPrivacySettingRuleRestrictContacts) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserPrivacySettingRuleRestrictContacts + type stub UserPrivacySettingRuleRestrictContacts - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserPrivacySettingRuleRestrictContacts) GetClass() string { - return ClassUserPrivacySettingRule + return ClassUserPrivacySettingRule } func (*UserPrivacySettingRuleRestrictContacts) GetType() string { - return TypeUserPrivacySettingRuleRestrictContacts + return TypeUserPrivacySettingRuleRestrictContacts } func (*UserPrivacySettingRuleRestrictContacts) UserPrivacySettingRuleType() string { - return TypeUserPrivacySettingRuleRestrictContacts + return TypeUserPrivacySettingRuleRestrictContacts } // A rule to restrict all specified users from doing something type UserPrivacySettingRuleRestrictUsers struct { - meta - // The user identifiers - UserIds []int32 `json:"user_ids"` + meta + // The user identifiers + UserIds []int32 `json:"user_ids"` } func (entity *UserPrivacySettingRuleRestrictUsers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserPrivacySettingRuleRestrictUsers + type stub UserPrivacySettingRuleRestrictUsers - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserPrivacySettingRuleRestrictUsers) GetClass() string { - return ClassUserPrivacySettingRule + return ClassUserPrivacySettingRule } func (*UserPrivacySettingRuleRestrictUsers) GetType() string { - return TypeUserPrivacySettingRuleRestrictUsers + return TypeUserPrivacySettingRuleRestrictUsers } func (*UserPrivacySettingRuleRestrictUsers) UserPrivacySettingRuleType() string { - return TypeUserPrivacySettingRuleRestrictUsers + return TypeUserPrivacySettingRuleRestrictUsers } // 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"` + meta + // A list of rules + Rules []UserPrivacySettingRule `json:"rules"` } func (entity *UserPrivacySettingRules) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserPrivacySettingRules + type stub UserPrivacySettingRules - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserPrivacySettingRules) GetClass() string { - return ClassUserPrivacySettingRules + return ClassUserPrivacySettingRules } func (*UserPrivacySettingRules) GetType() string { - return TypeUserPrivacySettingRules + return TypeUserPrivacySettingRules } // A privacy setting for managing whether the user's online status is visible -type UserPrivacySettingShowStatus struct{ - meta +type UserPrivacySettingShowStatus struct { + meta } func (entity *UserPrivacySettingShowStatus) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserPrivacySettingShowStatus + type stub UserPrivacySettingShowStatus - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserPrivacySettingShowStatus) GetClass() string { - return ClassUserPrivacySetting + return ClassUserPrivacySetting } func (*UserPrivacySettingShowStatus) GetType() string { - return TypeUserPrivacySettingShowStatus + return TypeUserPrivacySettingShowStatus } func (*UserPrivacySettingShowStatus) UserPrivacySettingType() string { - return TypeUserPrivacySettingShowStatus + return TypeUserPrivacySettingShowStatus } // A privacy setting for managing whether the user can be invited to chats -type UserPrivacySettingAllowChatInvites struct{ - meta +type UserPrivacySettingAllowChatInvites struct { + meta } func (entity *UserPrivacySettingAllowChatInvites) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserPrivacySettingAllowChatInvites + type stub UserPrivacySettingAllowChatInvites - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserPrivacySettingAllowChatInvites) GetClass() string { - return ClassUserPrivacySetting + return ClassUserPrivacySetting } func (*UserPrivacySettingAllowChatInvites) GetType() string { - return TypeUserPrivacySettingAllowChatInvites + return TypeUserPrivacySettingAllowChatInvites } func (*UserPrivacySettingAllowChatInvites) UserPrivacySettingType() string { - return TypeUserPrivacySettingAllowChatInvites + return TypeUserPrivacySettingAllowChatInvites } // A privacy setting for managing whether the user can be called -type UserPrivacySettingAllowCalls struct{ - meta +type UserPrivacySettingAllowCalls struct { + meta } func (entity *UserPrivacySettingAllowCalls) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UserPrivacySettingAllowCalls + type stub UserPrivacySettingAllowCalls - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UserPrivacySettingAllowCalls) GetClass() string { - return ClassUserPrivacySetting + return ClassUserPrivacySetting } func (*UserPrivacySettingAllowCalls) GetType() string { - return TypeUserPrivacySettingAllowCalls + return TypeUserPrivacySettingAllowCalls } func (*UserPrivacySettingAllowCalls) UserPrivacySettingType() string { - return TypeUserPrivacySettingAllowCalls + return TypeUserPrivacySettingAllowCalls } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub AccountTtl + type stub AccountTtl - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AccountTtl) GetClass() string { - return ClassAccountTtl + return ClassAccountTtl } func (*AccountTtl) GetType() string { - return TypeAccountTtl + return TypeAccountTtl } // Contains information about one session in a Telegram application used by the current user type Session struct { - meta - // Session identifier - Id JsonInt64 `json:"id"` - // True, if this session is the current session - IsCurrent bool `json:"is_current"` - // 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"` + meta + // Session identifier + Id JsonInt64 `json:"id"` + // True, if this session is the current session + IsCurrent bool `json:"is_current"` + // 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() + entity.meta.Type = entity.GetType() - type stub Session + type stub Session - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Session) GetClass() string { - return ClassSession + return ClassSession } func (*Session) GetType() string { - return TypeSession + return TypeSession } // Contains a list of sessions type Sessions struct { - meta - // List of sessions - Sessions []*Session `json:"sessions"` + meta + // List of sessions + Sessions []*Session `json:"sessions"` } func (entity *Sessions) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Sessions + type stub Sessions - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Sessions) GetClass() string { - return ClassSessions + return ClassSessions } func (*Sessions) GetType() string { - return TypeSessions + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ConnectedWebsite + type stub ConnectedWebsite - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ConnectedWebsite) GetClass() string { - return ClassConnectedWebsite + return ClassConnectedWebsite } func (*ConnectedWebsite) GetType() string { - return TypeConnectedWebsite + 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"` + meta + // List of connected websites + Websites []*ConnectedWebsite `json:"websites"` } func (entity *ConnectedWebsites) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ConnectedWebsites + type stub ConnectedWebsites - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ConnectedWebsites) GetClass() string { - return ClassConnectedWebsites + return ClassConnectedWebsites } func (*ConnectedWebsites) GetType() string { - return TypeConnectedWebsites + return TypeConnectedWebsites } // Contains information about the availability of the "Report spam" action for a chat type ChatReportSpamState struct { - meta - // True, if a prompt with the "Report spam" action should be shown to the user - CanReportSpam bool `json:"can_report_spam"` + meta + // True, if a prompt with the "Report spam" action should be shown to the user + CanReportSpam bool `json:"can_report_spam"` } func (entity *ChatReportSpamState) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatReportSpamState + type stub ChatReportSpamState - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatReportSpamState) GetClass() string { - return ClassChatReportSpamState + return ClassChatReportSpamState } func (*ChatReportSpamState) GetType() string { - return TypeChatReportSpamState + return TypeChatReportSpamState } // The chat contains spam messages -type ChatReportReasonSpam struct{ - meta +type ChatReportReasonSpam struct { + meta } func (entity *ChatReportReasonSpam) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatReportReasonSpam + type stub ChatReportReasonSpam - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatReportReasonSpam) GetClass() string { - return ClassChatReportReason + return ClassChatReportReason } func (*ChatReportReasonSpam) GetType() string { - return TypeChatReportReasonSpam + return TypeChatReportReasonSpam } func (*ChatReportReasonSpam) ChatReportReasonType() string { - return TypeChatReportReasonSpam + return TypeChatReportReasonSpam } // The chat promotes violence -type ChatReportReasonViolence struct{ - meta +type ChatReportReasonViolence struct { + meta } func (entity *ChatReportReasonViolence) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatReportReasonViolence + type stub ChatReportReasonViolence - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatReportReasonViolence) GetClass() string { - return ClassChatReportReason + return ClassChatReportReason } func (*ChatReportReasonViolence) GetType() string { - return TypeChatReportReasonViolence + return TypeChatReportReasonViolence } func (*ChatReportReasonViolence) ChatReportReasonType() string { - return TypeChatReportReasonViolence + return TypeChatReportReasonViolence } // The chat contains pornographic messages -type ChatReportReasonPornography struct{ - meta +type ChatReportReasonPornography struct { + meta } func (entity *ChatReportReasonPornography) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatReportReasonPornography + type stub ChatReportReasonPornography - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatReportReasonPornography) GetClass() string { - return ClassChatReportReason + return ClassChatReportReason } func (*ChatReportReasonPornography) GetType() string { - return TypeChatReportReasonPornography + return TypeChatReportReasonPornography } func (*ChatReportReasonPornography) ChatReportReasonType() string { - return TypeChatReportReasonPornography + return TypeChatReportReasonPornography } // The chat contains copyrighted content -type ChatReportReasonCopyright struct{ - meta +type ChatReportReasonCopyright struct { + meta } func (entity *ChatReportReasonCopyright) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatReportReasonCopyright + type stub ChatReportReasonCopyright - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatReportReasonCopyright) GetClass() string { - return ClassChatReportReason + return ClassChatReportReason } func (*ChatReportReasonCopyright) GetType() string { - return TypeChatReportReasonCopyright + return TypeChatReportReasonCopyright } func (*ChatReportReasonCopyright) ChatReportReasonType() string { - return TypeChatReportReasonCopyright + return TypeChatReportReasonCopyright } // A custom reason provided by the user type ChatReportReasonCustom struct { - meta - // Report text - Text string `json:"text"` + meta + // Report text + Text string `json:"text"` } func (entity *ChatReportReasonCustom) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ChatReportReasonCustom + type stub ChatReportReasonCustom - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ChatReportReasonCustom) GetClass() string { - return ClassChatReportReason + return ClassChatReportReason } func (*ChatReportReasonCustom) GetType() string { - return TypeChatReportReasonCustom + return TypeChatReportReasonCustom } func (*ChatReportReasonCustom) ChatReportReasonType() string { - return TypeChatReportReasonCustom + return TypeChatReportReasonCustom } // Contains a public HTTPS link to a message in a public supergroup or channel type PublicMessageLink struct { - meta - // Message link - Link string `json:"link"` - // HTML-code for embedding the message - Html string `json:"html"` + meta + // Message link + Link string `json:"link"` + // HTML-code for embedding the message + Html string `json:"html"` } func (entity *PublicMessageLink) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PublicMessageLink + type stub PublicMessageLink - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PublicMessageLink) GetClass() string { - return ClassPublicMessageLink + return ClassPublicMessageLink } func (*PublicMessageLink) GetType() string { - return TypePublicMessageLink + return TypePublicMessageLink } // The data is not a file -type FileTypeNone struct{ - meta +type FileTypeNone struct { + meta } func (entity *FileTypeNone) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeNone + type stub FileTypeNone - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeNone) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeNone) GetType() string { - return TypeFileTypeNone + return TypeFileTypeNone } func (*FileTypeNone) FileTypeType() string { - return TypeFileTypeNone + return TypeFileTypeNone } // The file is an animation -type FileTypeAnimation struct{ - meta +type FileTypeAnimation struct { + meta } func (entity *FileTypeAnimation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeAnimation + type stub FileTypeAnimation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeAnimation) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeAnimation) GetType() string { - return TypeFileTypeAnimation + return TypeFileTypeAnimation } func (*FileTypeAnimation) FileTypeType() string { - return TypeFileTypeAnimation + return TypeFileTypeAnimation } // The file is an audio file -type FileTypeAudio struct{ - meta +type FileTypeAudio struct { + meta } func (entity *FileTypeAudio) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeAudio + type stub FileTypeAudio - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeAudio) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeAudio) GetType() string { - return TypeFileTypeAudio + return TypeFileTypeAudio } func (*FileTypeAudio) FileTypeType() string { - return TypeFileTypeAudio + return TypeFileTypeAudio } // The file is a document -type FileTypeDocument struct{ - meta +type FileTypeDocument struct { + meta } func (entity *FileTypeDocument) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeDocument + type stub FileTypeDocument - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeDocument) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeDocument) GetType() string { - return TypeFileTypeDocument + return TypeFileTypeDocument } func (*FileTypeDocument) FileTypeType() string { - return TypeFileTypeDocument + return TypeFileTypeDocument } // The file is a photo -type FileTypePhoto struct{ - meta +type FileTypePhoto struct { + meta } func (entity *FileTypePhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypePhoto + type stub FileTypePhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypePhoto) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypePhoto) GetType() string { - return TypeFileTypePhoto + return TypeFileTypePhoto } func (*FileTypePhoto) FileTypeType() string { - return TypeFileTypePhoto + return TypeFileTypePhoto } // The file is a profile photo -type FileTypeProfilePhoto struct{ - meta +type FileTypeProfilePhoto struct { + meta } func (entity *FileTypeProfilePhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeProfilePhoto + type stub FileTypeProfilePhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeProfilePhoto) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeProfilePhoto) GetType() string { - return TypeFileTypeProfilePhoto + return TypeFileTypeProfilePhoto } func (*FileTypeProfilePhoto) FileTypeType() string { - return TypeFileTypeProfilePhoto + return TypeFileTypeProfilePhoto } // The file was sent to a secret chat (the file type is not known to the server) -type FileTypeSecret struct{ - meta +type FileTypeSecret struct { + meta } func (entity *FileTypeSecret) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeSecret + type stub FileTypeSecret - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeSecret) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeSecret) GetType() string { - return TypeFileTypeSecret + return TypeFileTypeSecret } func (*FileTypeSecret) FileTypeType() string { - return TypeFileTypeSecret + return TypeFileTypeSecret } // The file is a thumbnail of a file from a secret chat -type FileTypeSecretThumbnail struct{ - meta +type FileTypeSecretThumbnail struct { + meta } func (entity *FileTypeSecretThumbnail) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeSecretThumbnail + type stub FileTypeSecretThumbnail - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeSecretThumbnail) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeSecretThumbnail) GetType() string { - return TypeFileTypeSecretThumbnail + return TypeFileTypeSecretThumbnail } func (*FileTypeSecretThumbnail) FileTypeType() string { - return TypeFileTypeSecretThumbnail + return TypeFileTypeSecretThumbnail } // The file is a file from Secure storage used for storing Telegram Passport files -type FileTypeSecure struct{ - meta +type FileTypeSecure struct { + meta } func (entity *FileTypeSecure) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeSecure + type stub FileTypeSecure - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeSecure) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeSecure) GetType() string { - return TypeFileTypeSecure + return TypeFileTypeSecure } func (*FileTypeSecure) FileTypeType() string { - return TypeFileTypeSecure + return TypeFileTypeSecure } // The file is a sticker -type FileTypeSticker struct{ - meta +type FileTypeSticker struct { + meta } func (entity *FileTypeSticker) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeSticker + type stub FileTypeSticker - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeSticker) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeSticker) GetType() string { - return TypeFileTypeSticker + return TypeFileTypeSticker } func (*FileTypeSticker) FileTypeType() string { - return TypeFileTypeSticker + return TypeFileTypeSticker } // The file is a thumbnail of another file -type FileTypeThumbnail struct{ - meta +type FileTypeThumbnail struct { + meta } func (entity *FileTypeThumbnail) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeThumbnail + type stub FileTypeThumbnail - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeThumbnail) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeThumbnail) GetType() string { - return TypeFileTypeThumbnail + return TypeFileTypeThumbnail } func (*FileTypeThumbnail) FileTypeType() string { - return TypeFileTypeThumbnail + return TypeFileTypeThumbnail } // The file type is not yet known -type FileTypeUnknown struct{ - meta +type FileTypeUnknown struct { + meta } func (entity *FileTypeUnknown) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeUnknown + type stub FileTypeUnknown - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeUnknown) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeUnknown) GetType() string { - return TypeFileTypeUnknown + return TypeFileTypeUnknown } func (*FileTypeUnknown) FileTypeType() string { - return TypeFileTypeUnknown + return TypeFileTypeUnknown } // The file is a video -type FileTypeVideo struct{ - meta +type FileTypeVideo struct { + meta } func (entity *FileTypeVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeVideo + type stub FileTypeVideo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeVideo) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeVideo) GetType() string { - return TypeFileTypeVideo + return TypeFileTypeVideo } func (*FileTypeVideo) FileTypeType() string { - return TypeFileTypeVideo + return TypeFileTypeVideo } // The file is a video note -type FileTypeVideoNote struct{ - meta +type FileTypeVideoNote struct { + meta } func (entity *FileTypeVideoNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeVideoNote + type stub FileTypeVideoNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeVideoNote) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeVideoNote) GetType() string { - return TypeFileTypeVideoNote + return TypeFileTypeVideoNote } func (*FileTypeVideoNote) FileTypeType() string { - return TypeFileTypeVideoNote + return TypeFileTypeVideoNote } // The file is a voice note -type FileTypeVoiceNote struct{ - meta +type FileTypeVoiceNote struct { + meta } func (entity *FileTypeVoiceNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeVoiceNote + type stub FileTypeVoiceNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeVoiceNote) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeVoiceNote) GetType() string { - return TypeFileTypeVoiceNote + return TypeFileTypeVoiceNote } func (*FileTypeVoiceNote) FileTypeType() string { - return TypeFileTypeVoiceNote + return TypeFileTypeVoiceNote } // The file is a wallpaper -type FileTypeWallpaper struct{ - meta +type FileTypeWallpaper struct { + meta } func (entity *FileTypeWallpaper) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FileTypeWallpaper + type stub FileTypeWallpaper - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FileTypeWallpaper) GetClass() string { - return ClassFileType + return ClassFileType } func (*FileTypeWallpaper) GetType() string { - return TypeFileTypeWallpaper + return TypeFileTypeWallpaper } func (*FileTypeWallpaper) FileTypeType() string { - return TypeFileTypeWallpaper + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub StorageStatisticsByFileType + type stub StorageStatisticsByFileType - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StorageStatisticsByFileType) GetClass() string { - return ClassStorageStatisticsByFileType + return ClassStorageStatisticsByFileType } func (*StorageStatisticsByFileType) GetType() string { - return TypeStorageStatisticsByFileType + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - storageStatisticsByFileType.Size = tmp.Size - storageStatisticsByFileType.Count = tmp.Count + storageStatisticsByFileType.Size = tmp.Size + storageStatisticsByFileType.Count = tmp.Count - fieldFileType, _ := UnmarshalFileType(tmp.FileType) - storageStatisticsByFileType.FileType = fieldFileType + fieldFileType, _ := UnmarshalFileType(tmp.FileType) + storageStatisticsByFileType.FileType = fieldFileType - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub StorageStatisticsByChat + type stub StorageStatisticsByChat - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StorageStatisticsByChat) GetClass() string { - return ClassStorageStatisticsByChat + return ClassStorageStatisticsByChat } func (*StorageStatisticsByChat) GetType() string { - return TypeStorageStatisticsByChat + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub StorageStatistics + type stub StorageStatistics - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StorageStatistics) GetClass() string { - return ClassStorageStatistics + return ClassStorageStatistics } func (*StorageStatistics) GetType() string { - return TypeStorageStatistics + 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"` + 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"` } func (entity *StorageStatisticsFast) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StorageStatisticsFast + type stub StorageStatisticsFast - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StorageStatisticsFast) GetClass() string { - return ClassStorageStatisticsFast + return ClassStorageStatisticsFast } func (*StorageStatisticsFast) GetType() string { - return TypeStorageStatisticsFast + return TypeStorageStatisticsFast } // The network is not available -type NetworkTypeNone struct{ - meta +type NetworkTypeNone struct { + meta } func (entity *NetworkTypeNone) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub NetworkTypeNone + type stub NetworkTypeNone - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*NetworkTypeNone) GetClass() string { - return ClassNetworkType + return ClassNetworkType } func (*NetworkTypeNone) GetType() string { - return TypeNetworkTypeNone + return TypeNetworkTypeNone } func (*NetworkTypeNone) NetworkTypeType() string { - return TypeNetworkTypeNone + return TypeNetworkTypeNone } // A mobile network -type NetworkTypeMobile struct{ - meta +type NetworkTypeMobile struct { + meta } func (entity *NetworkTypeMobile) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub NetworkTypeMobile + type stub NetworkTypeMobile - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*NetworkTypeMobile) GetClass() string { - return ClassNetworkType + return ClassNetworkType } func (*NetworkTypeMobile) GetType() string { - return TypeNetworkTypeMobile + return TypeNetworkTypeMobile } func (*NetworkTypeMobile) NetworkTypeType() string { - return TypeNetworkTypeMobile + return TypeNetworkTypeMobile } // A mobile roaming network -type NetworkTypeMobileRoaming struct{ - meta +type NetworkTypeMobileRoaming struct { + meta } func (entity *NetworkTypeMobileRoaming) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub NetworkTypeMobileRoaming + type stub NetworkTypeMobileRoaming - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*NetworkTypeMobileRoaming) GetClass() string { - return ClassNetworkType + return ClassNetworkType } func (*NetworkTypeMobileRoaming) GetType() string { - return TypeNetworkTypeMobileRoaming + return TypeNetworkTypeMobileRoaming } func (*NetworkTypeMobileRoaming) NetworkTypeType() string { - return TypeNetworkTypeMobileRoaming + return TypeNetworkTypeMobileRoaming } // A Wi-Fi network -type NetworkTypeWiFi struct{ - meta +type NetworkTypeWiFi struct { + meta } func (entity *NetworkTypeWiFi) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub NetworkTypeWiFi + type stub NetworkTypeWiFi - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*NetworkTypeWiFi) GetClass() string { - return ClassNetworkType + return ClassNetworkType } func (*NetworkTypeWiFi) GetType() string { - return TypeNetworkTypeWiFi + return TypeNetworkTypeWiFi } func (*NetworkTypeWiFi) NetworkTypeType() string { - return TypeNetworkTypeWiFi + return TypeNetworkTypeWiFi } // A different network type (e.g., Ethernet network) -type NetworkTypeOther struct{ - meta +type NetworkTypeOther struct { + meta } func (entity *NetworkTypeOther) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub NetworkTypeOther + type stub NetworkTypeOther - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*NetworkTypeOther) GetClass() string { - return ClassNetworkType + return ClassNetworkType } func (*NetworkTypeOther) GetType() string { - return TypeNetworkTypeOther + return TypeNetworkTypeOther } func (*NetworkTypeOther) NetworkTypeType() string { - return TypeNetworkTypeOther + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub NetworkStatisticsEntryFile + type stub NetworkStatisticsEntryFile - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*NetworkStatisticsEntryFile) GetClass() string { - return ClassNetworkStatisticsEntry + return ClassNetworkStatisticsEntry } func (*NetworkStatisticsEntryFile) GetType() string { - return TypeNetworkStatisticsEntryFile + return TypeNetworkStatisticsEntryFile } func (*NetworkStatisticsEntryFile) NetworkStatisticsEntryType() string { - return TypeNetworkStatisticsEntryFile + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - networkStatisticsEntryFile.SentBytes = tmp.SentBytes - networkStatisticsEntryFile.ReceivedBytes = tmp.ReceivedBytes + networkStatisticsEntryFile.SentBytes = tmp.SentBytes + networkStatisticsEntryFile.ReceivedBytes = tmp.ReceivedBytes - fieldFileType, _ := UnmarshalFileType(tmp.FileType) - networkStatisticsEntryFile.FileType = fieldFileType + fieldFileType, _ := UnmarshalFileType(tmp.FileType) + networkStatisticsEntryFile.FileType = fieldFileType - fieldNetworkType, _ := UnmarshalNetworkType(tmp.NetworkType) - networkStatisticsEntryFile.NetworkType = fieldNetworkType + fieldNetworkType, _ := UnmarshalNetworkType(tmp.NetworkType) + networkStatisticsEntryFile.NetworkType = fieldNetworkType - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub NetworkStatisticsEntryCall + type stub NetworkStatisticsEntryCall - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*NetworkStatisticsEntryCall) GetClass() string { - return ClassNetworkStatisticsEntry + return ClassNetworkStatisticsEntry } func (*NetworkStatisticsEntryCall) GetType() string { - return TypeNetworkStatisticsEntryCall + return TypeNetworkStatisticsEntryCall } func (*NetworkStatisticsEntryCall) NetworkStatisticsEntryType() string { - return TypeNetworkStatisticsEntryCall + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - networkStatisticsEntryCall.SentBytes = tmp.SentBytes - networkStatisticsEntryCall.ReceivedBytes = tmp.ReceivedBytes - networkStatisticsEntryCall.Duration = tmp.Duration + networkStatisticsEntryCall.SentBytes = tmp.SentBytes + networkStatisticsEntryCall.ReceivedBytes = tmp.ReceivedBytes + networkStatisticsEntryCall.Duration = tmp.Duration - fieldNetworkType, _ := UnmarshalNetworkType(tmp.NetworkType) - networkStatisticsEntryCall.NetworkType = fieldNetworkType + fieldNetworkType, _ := UnmarshalNetworkType(tmp.NetworkType) + networkStatisticsEntryCall.NetworkType = fieldNetworkType - return nil + return nil } // A full list of available network statistic entries type NetworkStatistics struct { - meta - // Point in time (Unix timestamp) when the app began collecting statistics - SinceDate int32 `json:"since_date"` - // Network statistics entries - Entries []NetworkStatisticsEntry `json:"entries"` + meta + // Point in time (Unix timestamp) when the app began collecting statistics + SinceDate int32 `json:"since_date"` + // Network statistics entries + Entries []NetworkStatisticsEntry `json:"entries"` } func (entity *NetworkStatistics) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub NetworkStatistics + type stub NetworkStatistics - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*NetworkStatistics) GetClass() string { - return ClassNetworkStatistics + return ClassNetworkStatistics } func (*NetworkStatistics) GetType() string { - return TypeNetworkStatistics + return TypeNetworkStatistics } // Currently waiting for the network to become available. Use SetNetworkType to change the available network type -type ConnectionStateWaitingForNetwork struct{ - meta +type ConnectionStateWaitingForNetwork struct { + meta } func (entity *ConnectionStateWaitingForNetwork) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ConnectionStateWaitingForNetwork + type stub ConnectionStateWaitingForNetwork - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ConnectionStateWaitingForNetwork) GetClass() string { - return ClassConnectionState + return ClassConnectionState } func (*ConnectionStateWaitingForNetwork) GetType() string { - return TypeConnectionStateWaitingForNetwork + return TypeConnectionStateWaitingForNetwork } func (*ConnectionStateWaitingForNetwork) ConnectionStateType() string { - return TypeConnectionStateWaitingForNetwork + return TypeConnectionStateWaitingForNetwork } // Currently establishing a connection with a proxy server -type ConnectionStateConnectingToProxy struct{ - meta +type ConnectionStateConnectingToProxy struct { + meta } func (entity *ConnectionStateConnectingToProxy) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ConnectionStateConnectingToProxy + type stub ConnectionStateConnectingToProxy - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ConnectionStateConnectingToProxy) GetClass() string { - return ClassConnectionState + return ClassConnectionState } func (*ConnectionStateConnectingToProxy) GetType() string { - return TypeConnectionStateConnectingToProxy + return TypeConnectionStateConnectingToProxy } func (*ConnectionStateConnectingToProxy) ConnectionStateType() string { - return TypeConnectionStateConnectingToProxy + return TypeConnectionStateConnectingToProxy } // Currently establishing a connection to the Telegram servers -type ConnectionStateConnecting struct{ - meta +type ConnectionStateConnecting struct { + meta } func (entity *ConnectionStateConnecting) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ConnectionStateConnecting + type stub ConnectionStateConnecting - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ConnectionStateConnecting) GetClass() string { - return ClassConnectionState + return ClassConnectionState } func (*ConnectionStateConnecting) GetType() string { - return TypeConnectionStateConnecting + return TypeConnectionStateConnecting } func (*ConnectionStateConnecting) ConnectionStateType() string { - return TypeConnectionStateConnecting + return TypeConnectionStateConnecting } // Downloading data received while the client was offline -type ConnectionStateUpdating struct{ - meta +type ConnectionStateUpdating struct { + meta } func (entity *ConnectionStateUpdating) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ConnectionStateUpdating + type stub ConnectionStateUpdating - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ConnectionStateUpdating) GetClass() string { - return ClassConnectionState + return ClassConnectionState } func (*ConnectionStateUpdating) GetType() string { - return TypeConnectionStateUpdating + return TypeConnectionStateUpdating } func (*ConnectionStateUpdating) ConnectionStateType() string { - return TypeConnectionStateUpdating + return TypeConnectionStateUpdating } // There is a working connection to the Telegram servers -type ConnectionStateReady struct{ - meta +type ConnectionStateReady struct { + meta } func (entity *ConnectionStateReady) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ConnectionStateReady + type stub ConnectionStateReady - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ConnectionStateReady) GetClass() string { - return ClassConnectionState + return ClassConnectionState } func (*ConnectionStateReady) GetType() string { - return TypeConnectionStateReady + return TypeConnectionStateReady } func (*ConnectionStateReady) ConnectionStateType() string { - return TypeConnectionStateReady + return TypeConnectionStateReady } // A category containing frequently used private chats with non-bot users -type TopChatCategoryUsers struct{ - meta +type TopChatCategoryUsers struct { + meta } func (entity *TopChatCategoryUsers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TopChatCategoryUsers + type stub TopChatCategoryUsers - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TopChatCategoryUsers) GetClass() string { - return ClassTopChatCategory + return ClassTopChatCategory } func (*TopChatCategoryUsers) GetType() string { - return TypeTopChatCategoryUsers + return TypeTopChatCategoryUsers } func (*TopChatCategoryUsers) TopChatCategoryType() string { - return TypeTopChatCategoryUsers + return TypeTopChatCategoryUsers } // A category containing frequently used private chats with bot users -type TopChatCategoryBots struct{ - meta +type TopChatCategoryBots struct { + meta } func (entity *TopChatCategoryBots) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TopChatCategoryBots + type stub TopChatCategoryBots - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TopChatCategoryBots) GetClass() string { - return ClassTopChatCategory + return ClassTopChatCategory } func (*TopChatCategoryBots) GetType() string { - return TypeTopChatCategoryBots + return TypeTopChatCategoryBots } func (*TopChatCategoryBots) TopChatCategoryType() string { - return TypeTopChatCategoryBots + return TypeTopChatCategoryBots } // A category containing frequently used basic groups and supergroups -type TopChatCategoryGroups struct{ - meta +type TopChatCategoryGroups struct { + meta } func (entity *TopChatCategoryGroups) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TopChatCategoryGroups + type stub TopChatCategoryGroups - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TopChatCategoryGroups) GetClass() string { - return ClassTopChatCategory + return ClassTopChatCategory } func (*TopChatCategoryGroups) GetType() string { - return TypeTopChatCategoryGroups + return TypeTopChatCategoryGroups } func (*TopChatCategoryGroups) TopChatCategoryType() string { - return TypeTopChatCategoryGroups + return TypeTopChatCategoryGroups } // A category containing frequently used channels -type TopChatCategoryChannels struct{ - meta +type TopChatCategoryChannels struct { + meta } func (entity *TopChatCategoryChannels) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TopChatCategoryChannels + type stub TopChatCategoryChannels - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TopChatCategoryChannels) GetClass() string { - return ClassTopChatCategory + return ClassTopChatCategory } func (*TopChatCategoryChannels) GetType() string { - return TypeTopChatCategoryChannels + return TypeTopChatCategoryChannels } func (*TopChatCategoryChannels) TopChatCategoryType() string { - return TypeTopChatCategoryChannels + return TypeTopChatCategoryChannels } // A category containing frequently used chats with inline bots sorted by their usage in inline mode -type TopChatCategoryInlineBots struct{ - meta +type TopChatCategoryInlineBots struct { + meta } func (entity *TopChatCategoryInlineBots) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TopChatCategoryInlineBots + type stub TopChatCategoryInlineBots - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TopChatCategoryInlineBots) GetClass() string { - return ClassTopChatCategory + return ClassTopChatCategory } func (*TopChatCategoryInlineBots) GetType() string { - return TypeTopChatCategoryInlineBots + return TypeTopChatCategoryInlineBots } func (*TopChatCategoryInlineBots) TopChatCategoryType() string { - return TypeTopChatCategoryInlineBots + return TypeTopChatCategoryInlineBots } // A category containing frequently used chats used for calls -type TopChatCategoryCalls struct{ - meta +type TopChatCategoryCalls struct { + meta } func (entity *TopChatCategoryCalls) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TopChatCategoryCalls + type stub TopChatCategoryCalls - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TopChatCategoryCalls) GetClass() string { - return ClassTopChatCategory + return ClassTopChatCategory } func (*TopChatCategoryCalls) GetType() string { - return TypeTopChatCategoryCalls + return TypeTopChatCategoryCalls } func (*TopChatCategoryCalls) TopChatCategoryType() string { - return TypeTopChatCategoryCalls + return TypeTopChatCategoryCalls } // A URL linking to a user type TMeUrlTypeUser struct { - meta - // Identifier of the user - UserId int32 `json:"user_id"` + meta + // Identifier of the user + UserId int32 `json:"user_id"` } func (entity *TMeUrlTypeUser) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TMeUrlTypeUser + type stub TMeUrlTypeUser - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TMeUrlTypeUser) GetClass() string { - return ClassTMeUrlType + return ClassTMeUrlType } func (*TMeUrlTypeUser) GetType() string { - return TypeTMeUrlTypeUser + return TypeTMeUrlTypeUser } func (*TMeUrlTypeUser) TMeUrlTypeType() string { - return TypeTMeUrlTypeUser + 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"` + meta + // Identifier of the supergroup or channel + SupergroupId int64 `json:"supergroup_id"` } func (entity *TMeUrlTypeSupergroup) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TMeUrlTypeSupergroup + type stub TMeUrlTypeSupergroup - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TMeUrlTypeSupergroup) GetClass() string { - return ClassTMeUrlType + return ClassTMeUrlType } func (*TMeUrlTypeSupergroup) GetType() string { - return TypeTMeUrlTypeSupergroup + return TypeTMeUrlTypeSupergroup } func (*TMeUrlTypeSupergroup) TMeUrlTypeType() string { - return TypeTMeUrlTypeSupergroup + return TypeTMeUrlTypeSupergroup } // A chat invite link type TMeUrlTypeChatInvite struct { - meta - // Chat invite link info - Info *ChatInviteLinkInfo `json:"info"` + meta + // Chat invite link info + Info *ChatInviteLinkInfo `json:"info"` } func (entity *TMeUrlTypeChatInvite) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TMeUrlTypeChatInvite + type stub TMeUrlTypeChatInvite - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TMeUrlTypeChatInvite) GetClass() string { - return ClassTMeUrlType + return ClassTMeUrlType } func (*TMeUrlTypeChatInvite) GetType() string { - return TypeTMeUrlTypeChatInvite + return TypeTMeUrlTypeChatInvite } func (*TMeUrlTypeChatInvite) TMeUrlTypeType() string { - return TypeTMeUrlTypeChatInvite + return TypeTMeUrlTypeChatInvite } // A URL linking to a sticker set type TMeUrlTypeStickerSet struct { - meta - // Identifier of the sticker set - StickerSetId JsonInt64 `json:"sticker_set_id"` + meta + // Identifier of the sticker set + StickerSetId JsonInt64 `json:"sticker_set_id"` } func (entity *TMeUrlTypeStickerSet) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TMeUrlTypeStickerSet + type stub TMeUrlTypeStickerSet - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TMeUrlTypeStickerSet) GetClass() string { - return ClassTMeUrlType + return ClassTMeUrlType } func (*TMeUrlTypeStickerSet) GetType() string { - return TypeTMeUrlTypeStickerSet + return TypeTMeUrlTypeStickerSet } func (*TMeUrlTypeStickerSet) TMeUrlTypeType() string { - return TypeTMeUrlTypeStickerSet + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub TMeUrl + type stub TMeUrl - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TMeUrl) GetClass() string { - return ClassTMeUrl + return ClassTMeUrl } func (*TMeUrl) GetType() string { - return TypeTMeUrl + return TypeTMeUrl } func (tMeUrl *TMeUrl) UnmarshalJSON(data []byte) error { - var tmp struct { - Url string `json:"url"` - Type json.RawMessage `json:"type"` - } + var tmp struct { + Url string `json:"url"` + Type json.RawMessage `json:"type"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - tMeUrl.Url = tmp.Url + tMeUrl.Url = tmp.Url - fieldType, _ := UnmarshalTMeUrlType(tmp.Type) - tMeUrl.Type = fieldType + fieldType, _ := UnmarshalTMeUrlType(tmp.Type) + tMeUrl.Type = fieldType - return nil + return nil } // Contains a list of t.me URLs type TMeUrls struct { - meta - // List of URLs - Urls []*TMeUrl `json:"urls"` + meta + // List of URLs + Urls []*TMeUrl `json:"urls"` } func (entity *TMeUrls) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TMeUrls + type stub TMeUrls - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TMeUrls) GetClass() string { - return ClassTMeUrls + return ClassTMeUrls } func (*TMeUrls) GetType() string { - return TypeTMeUrls + return TypeTMeUrls } // Contains a counter type Count struct { - meta - // Count - Count int32 `json:"count"` + meta + // Count + Count int32 `json:"count"` } func (entity *Count) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Count + type stub Count - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Count) GetClass() string { - return ClassCount + return ClassCount } func (*Count) GetType() string { - return TypeCount + return TypeCount } // Contains some text type Text struct { - meta - // Text - Text string `json:"text"` + meta + // Text + Text string `json:"text"` } func (entity *Text) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Text + type stub Text - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Text) GetClass() string { - return ClassText + return ClassText } func (*Text) GetType() string { - return TypeText + return TypeText } // Contains a value representing a number of seconds type Seconds struct { - meta - // Number of seconds - Seconds float64 `json:"seconds"` + meta + // Number of seconds + Seconds float64 `json:"seconds"` } func (entity *Seconds) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Seconds + type stub Seconds - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Seconds) GetClass() string { - return ClassSeconds + return ClassSeconds } func (*Seconds) GetType() string { - return TypeSeconds + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub DeepLinkInfo + type stub DeepLinkInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*DeepLinkInfo) GetClass() string { - return ClassDeepLinkInfo + return ClassDeepLinkInfo } func (*DeepLinkInfo) GetType() string { - return TypeDeepLinkInfo + return TypeDeepLinkInfo } // The text should be parsed in markdown-style -type TextParseModeMarkdown struct{ - meta +type TextParseModeMarkdown struct { + meta } func (entity *TextParseModeMarkdown) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextParseModeMarkdown + type stub TextParseModeMarkdown - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextParseModeMarkdown) GetClass() string { - return ClassTextParseMode + return ClassTextParseMode } func (*TextParseModeMarkdown) GetType() string { - return TypeTextParseModeMarkdown + return TypeTextParseModeMarkdown } func (*TextParseModeMarkdown) TextParseModeType() string { - return TypeTextParseModeMarkdown + return TypeTextParseModeMarkdown } // The text should be parsed in HTML-style -type TextParseModeHTML struct{ - meta +type TextParseModeHTML struct { + meta } func (entity *TextParseModeHTML) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextParseModeHTML + type stub TextParseModeHTML - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextParseModeHTML) GetClass() string { - return ClassTextParseMode + return ClassTextParseMode } func (*TextParseModeHTML) GetType() string { - return TypeTextParseModeHTML + return TypeTextParseModeHTML } func (*TextParseModeHTML) TextParseModeType() string { - return TypeTextParseModeHTML + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ProxyTypeSocks5 + type stub ProxyTypeSocks5 - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ProxyTypeSocks5) GetClass() string { - return ClassProxyType + return ClassProxyType } func (*ProxyTypeSocks5) GetType() string { - return TypeProxyTypeSocks5 + return TypeProxyTypeSocks5 } func (*ProxyTypeSocks5) ProxyTypeType() string { - return TypeProxyTypeSocks5 + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub ProxyTypeHttp + type stub ProxyTypeHttp - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ProxyTypeHttp) GetClass() string { - return ClassProxyType + return ClassProxyType } func (*ProxyTypeHttp) GetType() string { - return TypeProxyTypeHttp + return TypeProxyTypeHttp } func (*ProxyTypeHttp) ProxyTypeType() string { - return TypeProxyTypeHttp + return TypeProxyTypeHttp } // An MTProto proxy server type ProxyTypeMtproto struct { - meta - // The proxy's secret in hexadecimal encoding - Secret string `json:"secret"` + meta + // The proxy's secret in hexadecimal encoding + Secret string `json:"secret"` } func (entity *ProxyTypeMtproto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ProxyTypeMtproto + type stub ProxyTypeMtproto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ProxyTypeMtproto) GetClass() string { - return ClassProxyType + return ClassProxyType } func (*ProxyTypeMtproto) GetType() string { - return TypeProxyTypeMtproto + return TypeProxyTypeMtproto } func (*ProxyTypeMtproto) ProxyTypeType() string { - return TypeProxyTypeMtproto + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub Proxy + type stub Proxy - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Proxy) GetClass() string { - return ClassProxy + return ClassProxy } func (*Proxy) GetType() string { - return TypeProxy + 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"` - } + 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 - } + 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 + 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 + fieldType, _ := UnmarshalProxyType(tmp.Type) + proxy.Type = fieldType - return nil + return nil } // Represents a list of proxy servers type Proxies struct { - meta - // List of proxy servers - Proxies []*Proxy `json:"proxies"` + meta + // List of proxy servers + Proxies []*Proxy `json:"proxies"` } func (entity *Proxies) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Proxies + type stub Proxies - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Proxies) GetClass() string { - return ClassProxies + return ClassProxies } func (*Proxies) GetType() string { - return TypeProxies + return TypeProxies } // Describes a sticker that should be added to a sticker set type InputSticker struct { - meta - // PNG image with the sticker; must be up to 512 kB in size and fit in a 512x512 square - PngSticker InputFile `json:"png_sticker"` - // Emoji corresponding to the sticker - Emojis string `json:"emojis"` - // For masks, position where the mask should be placed; may be null - MaskPosition *MaskPosition `json:"mask_position"` + meta + // PNG image with the sticker; must be up to 512 kB in size and fit in a 512x512 square + PngSticker InputFile `json:"png_sticker"` + // Emoji corresponding to the sticker + Emojis string `json:"emojis"` + // For masks, position where the mask should be placed; may be null + MaskPosition *MaskPosition `json:"mask_position"` } func (entity *InputSticker) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputSticker + type stub InputSticker - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputSticker) GetClass() string { - return ClassInputSticker + return ClassInputSticker } func (*InputSticker) GetType() string { - return TypeInputSticker + return TypeInputSticker } func (inputSticker *InputSticker) UnmarshalJSON(data []byte) error { - var tmp struct { - PngSticker json.RawMessage `json:"png_sticker"` - Emojis string `json:"emojis"` - MaskPosition *MaskPosition `json:"mask_position"` - } + var tmp struct { + PngSticker json.RawMessage `json:"png_sticker"` + Emojis string `json:"emojis"` + MaskPosition *MaskPosition `json:"mask_position"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - inputSticker.Emojis = tmp.Emojis - inputSticker.MaskPosition = tmp.MaskPosition + inputSticker.Emojis = tmp.Emojis + inputSticker.MaskPosition = tmp.MaskPosition - fieldPngSticker, _ := UnmarshalInputFile(tmp.PngSticker) - inputSticker.PngSticker = fieldPngSticker + fieldPngSticker, _ := UnmarshalInputFile(tmp.PngSticker) + inputSticker.PngSticker = fieldPngSticker - return nil + return nil } // The user authorization state has changed type UpdateAuthorizationState struct { - meta - // New authorization state - AuthorizationState AuthorizationState `json:"authorization_state"` + meta + // New authorization state + AuthorizationState AuthorizationState `json:"authorization_state"` } func (entity *UpdateAuthorizationState) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateAuthorizationState + type stub UpdateAuthorizationState - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateAuthorizationState) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateAuthorizationState) GetType() string { - return TypeUpdateAuthorizationState + return TypeUpdateAuthorizationState } func (*UpdateAuthorizationState) UpdateType() string { - return TypeUpdateAuthorizationState + return TypeUpdateAuthorizationState } func (updateAuthorizationState *UpdateAuthorizationState) UnmarshalJSON(data []byte) error { - var tmp struct { - AuthorizationState json.RawMessage `json:"authorization_state"` - } + var tmp struct { + AuthorizationState json.RawMessage `json:"authorization_state"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldAuthorizationState, _ := UnmarshalAuthorizationState(tmp.AuthorizationState) - updateAuthorizationState.AuthorizationState = fieldAuthorizationState + fieldAuthorizationState, _ := UnmarshalAuthorizationState(tmp.AuthorizationState) + updateAuthorizationState.AuthorizationState = fieldAuthorizationState - return nil + return nil } // A new message was received; can also be an outgoing message type UpdateNewMessage struct { - meta - // The new message - Message *Message `json:"message"` - // True, if this message must not generate a notification - DisableNotification bool `json:"disable_notification"` - // True, if the message contains a mention of the current user - ContainsMention bool `json:"contains_mention"` + meta + // The new message + Message *Message `json:"message"` + // True, if this message must not generate a notification + DisableNotification bool `json:"disable_notification"` + // True, if the message contains a mention of the current user + ContainsMention bool `json:"contains_mention"` } func (entity *UpdateNewMessage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateNewMessage + type stub UpdateNewMessage - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateNewMessage) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateNewMessage) GetType() string { - return TypeUpdateNewMessage + return TypeUpdateNewMessage } func (*UpdateNewMessage) UpdateType() string { - return TypeUpdateNewMessage + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateMessageSendAcknowledged + type stub UpdateMessageSendAcknowledged - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateMessageSendAcknowledged) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateMessageSendAcknowledged) GetType() string { - return TypeUpdateMessageSendAcknowledged + return TypeUpdateMessageSendAcknowledged } func (*UpdateMessageSendAcknowledged) UpdateType() string { - return TypeUpdateMessageSendAcknowledged + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateMessageSendSucceeded + type stub UpdateMessageSendSucceeded - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateMessageSendSucceeded) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateMessageSendSucceeded) GetType() string { - return TypeUpdateMessageSendSucceeded + return TypeUpdateMessageSendSucceeded } func (*UpdateMessageSendSucceeded) UpdateType() string { - return TypeUpdateMessageSendSucceeded + 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 that 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"` + meta + // Contains information about the message that 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() + entity.meta.Type = entity.GetType() - type stub UpdateMessageSendFailed + type stub UpdateMessageSendFailed - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateMessageSendFailed) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateMessageSendFailed) GetType() string { - return TypeUpdateMessageSendFailed + return TypeUpdateMessageSendFailed } func (*UpdateMessageSendFailed) UpdateType() string { - return TypeUpdateMessageSendFailed + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateMessageContent + type stub UpdateMessageContent - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateMessageContent) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateMessageContent) GetType() string { - return TypeUpdateMessageContent + return TypeUpdateMessageContent } func (*UpdateMessageContent) UpdateType() string { - return TypeUpdateMessageContent + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - updateMessageContent.ChatId = tmp.ChatId - updateMessageContent.MessageId = tmp.MessageId + updateMessageContent.ChatId = tmp.ChatId + updateMessageContent.MessageId = tmp.MessageId - fieldNewContent, _ := UnmarshalMessageContent(tmp.NewContent) - updateMessageContent.NewContent = fieldNewContent + fieldNewContent, _ := UnmarshalMessageContent(tmp.NewContent) + updateMessageContent.NewContent = fieldNewContent - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateMessageEdited + type stub UpdateMessageEdited - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateMessageEdited) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateMessageEdited) GetType() string { - return TypeUpdateMessageEdited + return TypeUpdateMessageEdited } func (*UpdateMessageEdited) UpdateType() string { - return TypeUpdateMessageEdited + 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"` - } + 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 - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - updateMessageEdited.ChatId = tmp.ChatId - updateMessageEdited.MessageId = tmp.MessageId - updateMessageEdited.EditDate = tmp.EditDate + updateMessageEdited.ChatId = tmp.ChatId + updateMessageEdited.MessageId = tmp.MessageId + updateMessageEdited.EditDate = tmp.EditDate - fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) - updateMessageEdited.ReplyMarkup = fieldReplyMarkup + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + updateMessageEdited.ReplyMarkup = fieldReplyMarkup - return nil + return nil } // The view count of the message has changed type UpdateMessageViews struct { - meta - // Chat identifier - ChatId int64 `json:"chat_id"` - // Message identifier - MessageId int64 `json:"message_id"` - // New value of the view count - Views int32 `json:"views"` + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // New value of the view count + Views int32 `json:"views"` } func (entity *UpdateMessageViews) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateMessageViews + type stub UpdateMessageViews - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateMessageViews) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateMessageViews) GetType() string { - return TypeUpdateMessageViews + return TypeUpdateMessageViews } func (*UpdateMessageViews) UpdateType() string { - return TypeUpdateMessageViews + return TypeUpdateMessageViews } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateMessageContentOpened + type stub UpdateMessageContentOpened - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateMessageContentOpened) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateMessageContentOpened) GetType() string { - return TypeUpdateMessageContentOpened + return TypeUpdateMessageContentOpened } func (*UpdateMessageContentOpened) UpdateType() string { - return TypeUpdateMessageContentOpened + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateMessageMentionRead + type stub UpdateMessageMentionRead - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateMessageMentionRead) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateMessageMentionRead) GetType() string { - return TypeUpdateMessageMentionRead + return TypeUpdateMessageMentionRead } func (*UpdateMessageMentionRead) UpdateType() string { - return TypeUpdateMessageMentionRead + return TypeUpdateMessageMentionRead } // A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the client. The chat field changes will be reported through separate updates type UpdateNewChat struct { - meta - // The chat - Chat *Chat `json:"chat"` + meta + // The chat + Chat *Chat `json:"chat"` } func (entity *UpdateNewChat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateNewChat + type stub UpdateNewChat - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateNewChat) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateNewChat) GetType() string { - return TypeUpdateNewChat + return TypeUpdateNewChat } func (*UpdateNewChat) UpdateType() string { - return TypeUpdateNewChat + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateChatTitle + type stub UpdateChatTitle - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatTitle) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatTitle) GetType() string { - return TypeUpdateChatTitle + return TypeUpdateChatTitle } func (*UpdateChatTitle) UpdateType() string { - return TypeUpdateChatTitle + 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 *ChatPhoto `json:"photo"` + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new chat photo; may be null + Photo *ChatPhoto `json:"photo"` } func (entity *UpdateChatPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateChatPhoto + type stub UpdateChatPhoto - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatPhoto) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatPhoto) GetType() string { - return TypeUpdateChatPhoto + return TypeUpdateChatPhoto } func (*UpdateChatPhoto) UpdateType() string { - return TypeUpdateChatPhoto + return TypeUpdateChatPhoto } // 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"` - // New value of the chat order - Order JsonInt64 `json:"order"` + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new last message in the chat; may be null + LastMessage *Message `json:"last_message"` + // New value of the chat order + Order JsonInt64 `json:"order"` } func (entity *UpdateChatLastMessage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateChatLastMessage + type stub UpdateChatLastMessage - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatLastMessage) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatLastMessage) GetType() string { - return TypeUpdateChatLastMessage + return TypeUpdateChatLastMessage } func (*UpdateChatLastMessage) UpdateType() string { - return TypeUpdateChatLastMessage + return TypeUpdateChatLastMessage } // The order of the chat in the chats list has changed. Instead of this update updateChatLastMessage, updateChatIsPinned or updateChatDraftMessage might be sent type UpdateChatOrder struct { - meta - // Chat identifier - ChatId int64 `json:"chat_id"` - // New value of the order - Order JsonInt64 `json:"order"` + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of the order + Order JsonInt64 `json:"order"` } func (entity *UpdateChatOrder) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateChatOrder + type stub UpdateChatOrder - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatOrder) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatOrder) GetType() string { - return TypeUpdateChatOrder + return TypeUpdateChatOrder } func (*UpdateChatOrder) UpdateType() string { - return TypeUpdateChatOrder + return TypeUpdateChatOrder } // A chat was pinned or unpinned type UpdateChatIsPinned struct { - meta - // Chat identifier - ChatId int64 `json:"chat_id"` - // New value of is_pinned - IsPinned bool `json:"is_pinned"` - // New value of the chat order - Order JsonInt64 `json:"order"` + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of is_pinned + IsPinned bool `json:"is_pinned"` + // New value of the chat order + Order JsonInt64 `json:"order"` } func (entity *UpdateChatIsPinned) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateChatIsPinned + type stub UpdateChatIsPinned - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatIsPinned) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatIsPinned) GetType() string { - return TypeUpdateChatIsPinned + return TypeUpdateChatIsPinned } func (*UpdateChatIsPinned) UpdateType() string { - return TypeUpdateChatIsPinned + return TypeUpdateChatIsPinned } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateChatIsMarkedAsUnread + type stub UpdateChatIsMarkedAsUnread - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatIsMarkedAsUnread) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatIsMarkedAsUnread) GetType() string { - return TypeUpdateChatIsMarkedAsUnread + return TypeUpdateChatIsMarkedAsUnread } func (*UpdateChatIsMarkedAsUnread) UpdateType() string { - return TypeUpdateChatIsMarkedAsUnread + return TypeUpdateChatIsMarkedAsUnread } // A chat's is_sponsored field has changed type UpdateChatIsSponsored struct { - meta - // Chat identifier - ChatId int64 `json:"chat_id"` - // New value of is_sponsored - IsSponsored bool `json:"is_sponsored"` - // New value of chat order - Order JsonInt64 `json:"order"` + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of is_sponsored + IsSponsored bool `json:"is_sponsored"` + // New value of chat order + Order JsonInt64 `json:"order"` } func (entity *UpdateChatIsSponsored) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateChatIsSponsored + type stub UpdateChatIsSponsored - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatIsSponsored) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatIsSponsored) GetType() string { - return TypeUpdateChatIsSponsored + return TypeUpdateChatIsSponsored } func (*UpdateChatIsSponsored) UpdateType() string { - return TypeUpdateChatIsSponsored + return TypeUpdateChatIsSponsored } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateChatDefaultDisableNotification + type stub UpdateChatDefaultDisableNotification - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatDefaultDisableNotification) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatDefaultDisableNotification) GetType() string { - return TypeUpdateChatDefaultDisableNotification + return TypeUpdateChatDefaultDisableNotification } func (*UpdateChatDefaultDisableNotification) UpdateType() string { - return TypeUpdateChatDefaultDisableNotification + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateChatReadInbox + type stub UpdateChatReadInbox - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatReadInbox) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatReadInbox) GetType() string { - return TypeUpdateChatReadInbox + return TypeUpdateChatReadInbox } func (*UpdateChatReadInbox) UpdateType() string { - return TypeUpdateChatReadInbox + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateChatReadOutbox + type stub UpdateChatReadOutbox - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatReadOutbox) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatReadOutbox) GetType() string { - return TypeUpdateChatReadOutbox + return TypeUpdateChatReadOutbox } func (*UpdateChatReadOutbox) UpdateType() string { - return TypeUpdateChatReadOutbox + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateChatUnreadMentionCount + type stub UpdateChatUnreadMentionCount - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatUnreadMentionCount) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatUnreadMentionCount) GetType() string { - return TypeUpdateChatUnreadMentionCount + return TypeUpdateChatUnreadMentionCount } func (*UpdateChatUnreadMentionCount) UpdateType() string { - return TypeUpdateChatUnreadMentionCount + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateChatNotificationSettings + type stub UpdateChatNotificationSettings - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatNotificationSettings) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatNotificationSettings) GetType() string { - return TypeUpdateChatNotificationSettings + return TypeUpdateChatNotificationSettings } func (*UpdateChatNotificationSettings) UpdateType() string { - return TypeUpdateChatNotificationSettings + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateScopeNotificationSettings + type stub UpdateScopeNotificationSettings - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateScopeNotificationSettings) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateScopeNotificationSettings) GetType() string { - return TypeUpdateScopeNotificationSettings + return TypeUpdateScopeNotificationSettings } func (*UpdateScopeNotificationSettings) UpdateType() string { - return TypeUpdateScopeNotificationSettings + return TypeUpdateScopeNotificationSettings } func (updateScopeNotificationSettings *UpdateScopeNotificationSettings) UnmarshalJSON(data []byte) error { - var tmp struct { - Scope json.RawMessage `json:"scope"` - NotificationSettings *ScopeNotificationSettings `json:"notification_settings"` - } + var tmp struct { + Scope json.RawMessage `json:"scope"` + NotificationSettings *ScopeNotificationSettings `json:"notification_settings"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - updateScopeNotificationSettings.NotificationSettings = tmp.NotificationSettings + updateScopeNotificationSettings.NotificationSettings = tmp.NotificationSettings - fieldScope, _ := UnmarshalNotificationSettingsScope(tmp.Scope) - updateScopeNotificationSettings.Scope = fieldScope + fieldScope, _ := UnmarshalNotificationSettingsScope(tmp.Scope) + updateScopeNotificationSettings.Scope = fieldScope - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateChatReplyMarkup + type stub UpdateChatReplyMarkup - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatReplyMarkup) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatReplyMarkup) GetType() string { - return TypeUpdateChatReplyMarkup + return TypeUpdateChatReplyMarkup } func (*UpdateChatReplyMarkup) UpdateType() string { - return TypeUpdateChatReplyMarkup + 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"` - // New value of the chat order - Order JsonInt64 `json:"order"` + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new draft message; may be null + DraftMessage *DraftMessage `json:"draft_message"` + // New value of the chat order + Order JsonInt64 `json:"order"` } func (entity *UpdateChatDraftMessage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateChatDraftMessage + type stub UpdateChatDraftMessage - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateChatDraftMessage) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateChatDraftMessage) GetType() string { - return TypeUpdateChatDraftMessage + return TypeUpdateChatDraftMessage } func (*UpdateChatDraftMessage) UpdateType() string { - return TypeUpdateChatDraftMessage + return TypeUpdateChatDraftMessage } // 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 unaccessible) - 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"` + 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 unaccessible) + 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() + entity.meta.Type = entity.GetType() - type stub UpdateDeleteMessages + type stub UpdateDeleteMessages - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateDeleteMessages) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateDeleteMessages) GetType() string { - return TypeUpdateDeleteMessages + return TypeUpdateDeleteMessages } func (*UpdateDeleteMessages) UpdateType() string { - return TypeUpdateDeleteMessages + return TypeUpdateDeleteMessages } // User activity in the chat has changed type UpdateUserChatAction struct { - meta - // Chat identifier - ChatId int64 `json:"chat_id"` - // Identifier of a user performing an action - UserId int32 `json:"user_id"` - // The action description - Action ChatAction `json:"action"` + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of a user performing an action + UserId int32 `json:"user_id"` + // The action description + Action ChatAction `json:"action"` } func (entity *UpdateUserChatAction) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateUserChatAction + type stub UpdateUserChatAction - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateUserChatAction) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateUserChatAction) GetType() string { - return TypeUpdateUserChatAction + return TypeUpdateUserChatAction } func (*UpdateUserChatAction) UpdateType() string { - return TypeUpdateUserChatAction + return TypeUpdateUserChatAction } func (updateUserChatAction *UpdateUserChatAction) UnmarshalJSON(data []byte) error { - var tmp struct { - ChatId int64 `json:"chat_id"` - UserId int32 `json:"user_id"` - Action json.RawMessage `json:"action"` - } + var tmp struct { + ChatId int64 `json:"chat_id"` + UserId int32 `json:"user_id"` + Action json.RawMessage `json:"action"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - updateUserChatAction.ChatId = tmp.ChatId - updateUserChatAction.UserId = tmp.UserId + updateUserChatAction.ChatId = tmp.ChatId + updateUserChatAction.UserId = tmp.UserId - fieldAction, _ := UnmarshalChatAction(tmp.Action) - updateUserChatAction.Action = fieldAction + fieldAction, _ := UnmarshalChatAction(tmp.Action) + updateUserChatAction.Action = fieldAction - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateUserStatus + type stub UpdateUserStatus - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateUserStatus) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateUserStatus) GetType() string { - return TypeUpdateUserStatus + return TypeUpdateUserStatus } func (*UpdateUserStatus) UpdateType() string { - return TypeUpdateUserStatus + return TypeUpdateUserStatus } func (updateUserStatus *UpdateUserStatus) UnmarshalJSON(data []byte) error { - var tmp struct { - UserId int32 `json:"user_id"` - Status json.RawMessage `json:"status"` - } + var tmp struct { + UserId int32 `json:"user_id"` + Status json.RawMessage `json:"status"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - updateUserStatus.UserId = tmp.UserId + updateUserStatus.UserId = tmp.UserId - fieldStatus, _ := UnmarshalUserStatus(tmp.Status) - updateUserStatus.Status = fieldStatus + fieldStatus, _ := UnmarshalUserStatus(tmp.Status) + updateUserStatus.Status = fieldStatus - return nil + return nil } // Some data of a user has changed. This update is guaranteed to come before the user identifier is returned to the client type UpdateUser struct { - meta - // New data about the user - User *User `json:"user"` + meta + // New data about the user + User *User `json:"user"` } func (entity *UpdateUser) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateUser + type stub UpdateUser - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateUser) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateUser) GetType() string { - return TypeUpdateUser + return TypeUpdateUser } func (*UpdateUser) UpdateType() string { - return TypeUpdateUser + 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 client type UpdateBasicGroup struct { - meta - // New data about the group - BasicGroup *BasicGroup `json:"basic_group"` + meta + // New data about the group + BasicGroup *BasicGroup `json:"basic_group"` } func (entity *UpdateBasicGroup) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateBasicGroup + type stub UpdateBasicGroup - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateBasicGroup) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateBasicGroup) GetType() string { - return TypeUpdateBasicGroup + return TypeUpdateBasicGroup } func (*UpdateBasicGroup) UpdateType() string { - return TypeUpdateBasicGroup + 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 client type UpdateSupergroup struct { - meta - // New data about the supergroup - Supergroup *Supergroup `json:"supergroup"` + meta + // New data about the supergroup + Supergroup *Supergroup `json:"supergroup"` } func (entity *UpdateSupergroup) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateSupergroup + type stub UpdateSupergroup - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateSupergroup) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateSupergroup) GetType() string { - return TypeUpdateSupergroup + return TypeUpdateSupergroup } func (*UpdateSupergroup) UpdateType() string { - return TypeUpdateSupergroup + 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 client type UpdateSecretChat struct { - meta - // New data about the secret chat - SecretChat *SecretChat `json:"secret_chat"` + meta + // New data about the secret chat + SecretChat *SecretChat `json:"secret_chat"` } func (entity *UpdateSecretChat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateSecretChat + type stub UpdateSecretChat - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateSecretChat) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateSecretChat) GetType() string { - return TypeUpdateSecretChat + return TypeUpdateSecretChat } func (*UpdateSecretChat) UpdateType() string { - return TypeUpdateSecretChat + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateUserFullInfo + type stub UpdateUserFullInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateUserFullInfo) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateUserFullInfo) GetType() string { - return TypeUpdateUserFullInfo + return TypeUpdateUserFullInfo } func (*UpdateUserFullInfo) UpdateType() string { - return TypeUpdateUserFullInfo + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateBasicGroupFullInfo + type stub UpdateBasicGroupFullInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateBasicGroupFullInfo) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateBasicGroupFullInfo) GetType() string { - return TypeUpdateBasicGroupFullInfo + return TypeUpdateBasicGroupFullInfo } func (*UpdateBasicGroupFullInfo) UpdateType() string { - return TypeUpdateBasicGroupFullInfo + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateSupergroupFullInfo + type stub UpdateSupergroupFullInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateSupergroupFullInfo) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateSupergroupFullInfo) GetType() string { - return TypeUpdateSupergroupFullInfo + return TypeUpdateSupergroupFullInfo } func (*UpdateSupergroupFullInfo) UpdateType() string { - return TypeUpdateSupergroupFullInfo + return TypeUpdateSupergroupFullInfo } // Service notification from the server. Upon receiving this the client 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateServiceNotification + type stub UpdateServiceNotification - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateServiceNotification) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateServiceNotification) GetType() string { - return TypeUpdateServiceNotification + return TypeUpdateServiceNotification } func (*UpdateServiceNotification) UpdateType() string { - return TypeUpdateServiceNotification + return TypeUpdateServiceNotification } func (updateServiceNotification *UpdateServiceNotification) UnmarshalJSON(data []byte) error { - var tmp struct { - Type string `json:"type"` - Content json.RawMessage `json:"content"` - } + var tmp struct { + Type string `json:"type"` + Content json.RawMessage `json:"content"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - updateServiceNotification.Type = tmp.Type + updateServiceNotification.Type = tmp.Type - fieldContent, _ := UnmarshalMessageContent(tmp.Content) - updateServiceNotification.Content = fieldContent + fieldContent, _ := UnmarshalMessageContent(tmp.Content) + updateServiceNotification.Content = fieldContent - return nil + return nil } // Information about a file was updated type UpdateFile struct { - meta - // New data about the file - File *File `json:"file"` + meta + // New data about the file + File *File `json:"file"` } func (entity *UpdateFile) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateFile + type stub UpdateFile - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateFile) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateFile) GetType() string { - return TypeUpdateFile + return TypeUpdateFile } func (*UpdateFile) UpdateType() string { - return TypeUpdateFile + return TypeUpdateFile } // The file generation process needs to be started by the client 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 client - Conversion string `json:"conversion"` + meta + // Unique identifier for the generation process + GenerationId JsonInt64 `json:"generation_id"` + // The path to a file from which a new file is generated; may be empty + OriginalPath string `json:"original_path"` + // The path to a file that should be created and where the new file should be generated + DestinationPath string `json:"destination_path"` + // String specifying the conversion applied to the original file. If conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file, which should be downloaded by the client + Conversion string `json:"conversion"` } func (entity *UpdateFileGenerationStart) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateFileGenerationStart + type stub UpdateFileGenerationStart - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateFileGenerationStart) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateFileGenerationStart) GetType() string { - return TypeUpdateFileGenerationStart + return TypeUpdateFileGenerationStart } func (*UpdateFileGenerationStart) UpdateType() string { - return TypeUpdateFileGenerationStart + return TypeUpdateFileGenerationStart } // File generation is no longer needed type UpdateFileGenerationStop struct { - meta - // Unique identifier for the generation process - GenerationId JsonInt64 `json:"generation_id"` + meta + // Unique identifier for the generation process + GenerationId JsonInt64 `json:"generation_id"` } func (entity *UpdateFileGenerationStop) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateFileGenerationStop + type stub UpdateFileGenerationStop - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateFileGenerationStop) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateFileGenerationStop) GetType() string { - return TypeUpdateFileGenerationStop + return TypeUpdateFileGenerationStop } func (*UpdateFileGenerationStop) UpdateType() string { - return TypeUpdateFileGenerationStop + 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"` + meta + // New data about a call + Call *Call `json:"call"` } func (entity *UpdateCall) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateCall + type stub UpdateCall - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateCall) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateCall) GetType() string { - return TypeUpdateCall + return TypeUpdateCall } func (*UpdateCall) UpdateType() string { - return TypeUpdateCall + return TypeUpdateCall } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateUserPrivacySettingRules + type stub UpdateUserPrivacySettingRules - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateUserPrivacySettingRules) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateUserPrivacySettingRules) GetType() string { - return TypeUpdateUserPrivacySettingRules + return TypeUpdateUserPrivacySettingRules } func (*UpdateUserPrivacySettingRules) UpdateType() string { - return TypeUpdateUserPrivacySettingRules + return TypeUpdateUserPrivacySettingRules } func (updateUserPrivacySettingRules *UpdateUserPrivacySettingRules) UnmarshalJSON(data []byte) error { - var tmp struct { - Setting json.RawMessage `json:"setting"` - Rules *UserPrivacySettingRules `json:"rules"` - } + var tmp struct { + Setting json.RawMessage `json:"setting"` + Rules *UserPrivacySettingRules `json:"rules"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - updateUserPrivacySettingRules.Rules = tmp.Rules + updateUserPrivacySettingRules.Rules = tmp.Rules - fieldSetting, _ := UnmarshalUserPrivacySetting(tmp.Setting) - updateUserPrivacySettingRules.Setting = fieldSetting + fieldSetting, _ := UnmarshalUserPrivacySetting(tmp.Setting) + updateUserPrivacySettingRules.Setting = fieldSetting - return nil + return nil } // Number of unread messages has changed. This update is sent only if a message database is used type UpdateUnreadMessageCount struct { - meta - // Total number of unread messages - UnreadCount int32 `json:"unread_count"` - // Total number of unread messages in unmuted chats - UnreadUnmutedCount int32 `json:"unread_unmuted_count"` + meta + // Total number of unread messages + UnreadCount int32 `json:"unread_count"` + // Total number of unread messages in unmuted chats + UnreadUnmutedCount int32 `json:"unread_unmuted_count"` } func (entity *UpdateUnreadMessageCount) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateUnreadMessageCount + type stub UpdateUnreadMessageCount - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateUnreadMessageCount) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateUnreadMessageCount) GetType() string { - return TypeUpdateUnreadMessageCount + return TypeUpdateUnreadMessageCount } func (*UpdateUnreadMessageCount) UpdateType() string { - return TypeUpdateUnreadMessageCount + return TypeUpdateUnreadMessageCount } // Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if a message database is used type UpdateUnreadChatCount struct { - meta - // Total number of unread chats - UnreadCount int32 `json:"unread_count"` - // Total number of unread unmuted chats - UnreadUnmutedCount int32 `json:"unread_unmuted_count"` - // Total number of chats marked as unread - MarkedAsUnreadCount int32 `json:"marked_as_unread_count"` - // Total number of unmuted chats marked as unread - MarkedAsUnreadUnmutedCount int32 `json:"marked_as_unread_unmuted_count"` + meta + // Total number of unread chats + UnreadCount int32 `json:"unread_count"` + // Total number of unread unmuted chats + UnreadUnmutedCount int32 `json:"unread_unmuted_count"` + // Total number of chats marked as unread + MarkedAsUnreadCount int32 `json:"marked_as_unread_count"` + // Total number of unmuted chats marked as unread + MarkedAsUnreadUnmutedCount int32 `json:"marked_as_unread_unmuted_count"` } func (entity *UpdateUnreadChatCount) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateUnreadChatCount + type stub UpdateUnreadChatCount - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateUnreadChatCount) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateUnreadChatCount) GetType() string { - return TypeUpdateUnreadChatCount + return TypeUpdateUnreadChatCount } func (*UpdateUnreadChatCount) UpdateType() string { - return TypeUpdateUnreadChatCount + return TypeUpdateUnreadChatCount } // An option changed its value type UpdateOption struct { - meta - // The option name - Name string `json:"name"` - // The new option value - Value OptionValue `json:"value"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateOption + type stub UpdateOption - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateOption) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateOption) GetType() string { - return TypeUpdateOption + return TypeUpdateOption } func (*UpdateOption) UpdateType() string { - return TypeUpdateOption + return TypeUpdateOption } func (updateOption *UpdateOption) UnmarshalJSON(data []byte) error { - var tmp struct { - Name string `json:"name"` - Value json.RawMessage `json:"value"` - } + var tmp struct { + Name string `json:"name"` + Value json.RawMessage `json:"value"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - updateOption.Name = tmp.Name + updateOption.Name = tmp.Name - fieldValue, _ := UnmarshalOptionValue(tmp.Value) - updateOption.Value = fieldValue + fieldValue, _ := UnmarshalOptionValue(tmp.Value) + updateOption.Value = fieldValue - return nil + return nil } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateInstalledStickerSets + type stub UpdateInstalledStickerSets - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateInstalledStickerSets) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateInstalledStickerSets) GetType() string { - return TypeUpdateInstalledStickerSets + return TypeUpdateInstalledStickerSets } func (*UpdateInstalledStickerSets) UpdateType() string { - return TypeUpdateInstalledStickerSets + return TypeUpdateInstalledStickerSets } // The list of trending sticker sets was updated or some of them were viewed type UpdateTrendingStickerSets struct { - meta - // The new list of trending sticker sets - StickerSets *StickerSets `json:"sticker_sets"` + meta + // The new list of trending sticker sets + StickerSets *StickerSets `json:"sticker_sets"` } func (entity *UpdateTrendingStickerSets) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateTrendingStickerSets + type stub UpdateTrendingStickerSets - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateTrendingStickerSets) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateTrendingStickerSets) GetType() string { - return TypeUpdateTrendingStickerSets + return TypeUpdateTrendingStickerSets } func (*UpdateTrendingStickerSets) UpdateType() string { - return TypeUpdateTrendingStickerSets + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateRecentStickers + type stub UpdateRecentStickers - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateRecentStickers) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateRecentStickers) GetType() string { - return TypeUpdateRecentStickers + return TypeUpdateRecentStickers } func (*UpdateRecentStickers) UpdateType() string { - return TypeUpdateRecentStickers + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateFavoriteStickers + type stub UpdateFavoriteStickers - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateFavoriteStickers) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateFavoriteStickers) GetType() string { - return TypeUpdateFavoriteStickers + return TypeUpdateFavoriteStickers } func (*UpdateFavoriteStickers) UpdateType() string { - return TypeUpdateFavoriteStickers + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateSavedAnimations + type stub UpdateSavedAnimations - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateSavedAnimations) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateSavedAnimations) GetType() string { - return TypeUpdateSavedAnimations + return TypeUpdateSavedAnimations } func (*UpdateSavedAnimations) UpdateType() string { - return TypeUpdateSavedAnimations + return TypeUpdateSavedAnimations } // 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateLanguagePackStrings + type stub UpdateLanguagePackStrings - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateLanguagePackStrings) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateLanguagePackStrings) GetType() string { - return TypeUpdateLanguagePackStrings + return TypeUpdateLanguagePackStrings } func (*UpdateLanguagePackStrings) UpdateType() string { - return TypeUpdateLanguagePackStrings + return TypeUpdateLanguagePackStrings } // The connection state has changed type UpdateConnectionState struct { - meta - // The new connection state - State ConnectionState `json:"state"` + meta + // The new connection state + State ConnectionState `json:"state"` } func (entity *UpdateConnectionState) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateConnectionState + type stub UpdateConnectionState - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateConnectionState) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateConnectionState) GetType() string { - return TypeUpdateConnectionState + return TypeUpdateConnectionState } func (*UpdateConnectionState) UpdateType() string { - return TypeUpdateConnectionState + return TypeUpdateConnectionState } func (updateConnectionState *UpdateConnectionState) UnmarshalJSON(data []byte) error { - var tmp struct { - State json.RawMessage `json:"state"` - } + var tmp struct { + State json.RawMessage `json:"state"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldState, _ := UnmarshalConnectionState(tmp.State) - updateConnectionState.State = fieldState + fieldState, _ := UnmarshalConnectionState(tmp.State) + updateConnectionState.State = fieldState - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateTermsOfService + type stub UpdateTermsOfService - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateTermsOfService) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateTermsOfService) GetType() string { - return TypeUpdateTermsOfService + return TypeUpdateTermsOfService } func (*UpdateTermsOfService) UpdateType() string { - return TypeUpdateTermsOfService + return TypeUpdateTermsOfService } // 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, provided by the client; may be null - UserLocation *Location `json:"user_location"` - // Text of the query - Query string `json:"query"` - // Offset of the first entry to return - Offset string `json:"offset"` + meta + // Unique query identifier + Id JsonInt64 `json:"id"` + // Identifier of the user who sent the query + SenderUserId int32 `json:"sender_user_id"` + // User location, provided by the client; may be null + UserLocation *Location `json:"user_location"` + // Text of the query + Query string `json:"query"` + // Offset of the first entry to return + Offset string `json:"offset"` } func (entity *UpdateNewInlineQuery) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateNewInlineQuery + type stub UpdateNewInlineQuery - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateNewInlineQuery) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateNewInlineQuery) GetType() string { - return TypeUpdateNewInlineQuery + return TypeUpdateNewInlineQuery } func (*UpdateNewInlineQuery) UpdateType() string { - return TypeUpdateNewInlineQuery + 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, provided by the client; may be null - UserLocation *Location `json:"user_location"` - // Text of the query - Query string `json:"query"` - // Identifier of the chosen result - ResultId string `json:"result_id"` - // Identifier of the sent inline message, if known - InlineMessageId string `json:"inline_message_id"` + meta + // Identifier of the user who sent the query + SenderUserId int32 `json:"sender_user_id"` + // User location, provided by the client; may be null + UserLocation *Location `json:"user_location"` + // Text of the query + Query string `json:"query"` + // Identifier of the chosen result + ResultId string `json:"result_id"` + // Identifier of the sent inline message, if known + InlineMessageId string `json:"inline_message_id"` } func (entity *UpdateNewChosenInlineResult) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateNewChosenInlineResult + type stub UpdateNewChosenInlineResult - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateNewChosenInlineResult) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateNewChosenInlineResult) GetType() string { - return TypeUpdateNewChosenInlineResult + return TypeUpdateNewChosenInlineResult } func (*UpdateNewChosenInlineResult) UpdateType() string { - return TypeUpdateNewChosenInlineResult + 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, in which the query was sent - ChatId int64 `json:"chat_id"` - // Identifier of the message, from which the query originated - MessageId int64 `json:"message_id"` - // Identifier that uniquely corresponds to the chat to which the message was sent - ChatInstance JsonInt64 `json:"chat_instance"` - // Query payload - Payload CallbackQueryPayload `json:"payload"` + meta + // Unique query identifier + Id JsonInt64 `json:"id"` + // Identifier of the user who sent the query + SenderUserId int32 `json:"sender_user_id"` + // Identifier of the chat, in which the query was sent + ChatId int64 `json:"chat_id"` + // Identifier of the message, from which the query originated + MessageId int64 `json:"message_id"` + // Identifier that uniquely corresponds to the chat to which the message was sent + ChatInstance JsonInt64 `json:"chat_instance"` + // Query payload + Payload CallbackQueryPayload `json:"payload"` } func (entity *UpdateNewCallbackQuery) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateNewCallbackQuery + type stub UpdateNewCallbackQuery - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateNewCallbackQuery) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateNewCallbackQuery) GetType() string { - return TypeUpdateNewCallbackQuery + return TypeUpdateNewCallbackQuery } func (*UpdateNewCallbackQuery) UpdateType() string { - return TypeUpdateNewCallbackQuery + 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"` - } + 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 - } + 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 + 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 + fieldPayload, _ := UnmarshalCallbackQueryPayload(tmp.Payload) + updateNewCallbackQuery.Payload = fieldPayload - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateNewInlineCallbackQuery + type stub UpdateNewInlineCallbackQuery - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateNewInlineCallbackQuery) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateNewInlineCallbackQuery) GetType() string { - return TypeUpdateNewInlineCallbackQuery + return TypeUpdateNewInlineCallbackQuery } func (*UpdateNewInlineCallbackQuery) UpdateType() string { - return TypeUpdateNewInlineCallbackQuery + 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"` - } + 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 - } + 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 + updateNewInlineCallbackQuery.Id = tmp.Id + updateNewInlineCallbackQuery.SenderUserId = tmp.SenderUserId + updateNewInlineCallbackQuery.InlineMessageId = tmp.InlineMessageId + updateNewInlineCallbackQuery.ChatInstance = tmp.ChatInstance - fieldPayload, _ := UnmarshalCallbackQueryPayload(tmp.Payload) - updateNewInlineCallbackQuery.Payload = fieldPayload + fieldPayload, _ := UnmarshalCallbackQueryPayload(tmp.Payload) + updateNewInlineCallbackQuery.Payload = fieldPayload - return nil + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateNewShippingQuery + type stub UpdateNewShippingQuery - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateNewShippingQuery) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateNewShippingQuery) GetType() string { - return TypeUpdateNewShippingQuery + return TypeUpdateNewShippingQuery } func (*UpdateNewShippingQuery) UpdateType() string { - return TypeUpdateNewShippingQuery + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateNewPreCheckoutQuery + type stub UpdateNewPreCheckoutQuery - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateNewPreCheckoutQuery) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateNewPreCheckoutQuery) GetType() string { - return TypeUpdateNewPreCheckoutQuery + return TypeUpdateNewPreCheckoutQuery } func (*UpdateNewPreCheckoutQuery) UpdateType() string { - return TypeUpdateNewPreCheckoutQuery + return TypeUpdateNewPreCheckoutQuery } // A new incoming event; for bots only type UpdateNewCustomEvent struct { - meta - // A JSON-serialized event - Event string `json:"event"` + meta + // A JSON-serialized event + Event string `json:"event"` } func (entity *UpdateNewCustomEvent) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub UpdateNewCustomEvent + type stub UpdateNewCustomEvent - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateNewCustomEvent) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateNewCustomEvent) GetType() string { - return TypeUpdateNewCustomEvent + return TypeUpdateNewCustomEvent } func (*UpdateNewCustomEvent) UpdateType() string { - return TypeUpdateNewCustomEvent + 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"` + 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() + entity.meta.Type = entity.GetType() - type stub UpdateNewCustomQuery + type stub UpdateNewCustomQuery - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*UpdateNewCustomQuery) GetClass() string { - return ClassUpdate + return ClassUpdate } func (*UpdateNewCustomQuery) GetType() string { - return TypeUpdateNewCustomQuery + return TypeUpdateNewCustomQuery } func (*UpdateNewCustomQuery) UpdateType() string { - return TypeUpdateNewCustomQuery + return TypeUpdateNewCustomQuery } // A simple object containing a number; for testing only type TestInt struct { - meta - // Number - Value int32 `json:"value"` + meta + // Number + Value int32 `json:"value"` } func (entity *TestInt) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TestInt + type stub TestInt - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TestInt) GetClass() string { - return ClassTestInt + return ClassTestInt } func (*TestInt) GetType() string { - return TypeTestInt + return TypeTestInt } // A simple object containing a string; for testing only type TestString struct { - meta - // String - Value string `json:"value"` + meta + // String + Value string `json:"value"` } func (entity *TestString) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TestString + type stub TestString - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TestString) GetClass() string { - return ClassTestString + return ClassTestString } func (*TestString) GetType() string { - return TypeTestString + return TypeTestString } // A simple object containing a sequence of bytes; for testing only type TestBytes struct { - meta - // Bytes - Value []byte `json:"value"` + meta + // Bytes + Value []byte `json:"value"` } func (entity *TestBytes) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TestBytes + type stub TestBytes - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TestBytes) GetClass() string { - return ClassTestBytes + return ClassTestBytes } func (*TestBytes) GetType() string { - return TypeTestBytes + return TypeTestBytes } // A simple object containing a vector of numbers; for testing only type TestVectorInt struct { - meta - // Vector of numbers - Value []int32 `json:"value"` + meta + // Vector of numbers + Value []int32 `json:"value"` } func (entity *TestVectorInt) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TestVectorInt + type stub TestVectorInt - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TestVectorInt) GetClass() string { - return ClassTestVectorInt + return ClassTestVectorInt } func (*TestVectorInt) GetType() string { - return TypeTestVectorInt + 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"` + meta + // Vector of objects + Value []*TestInt `json:"value"` } func (entity *TestVectorIntObject) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TestVectorIntObject + type stub TestVectorIntObject - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TestVectorIntObject) GetClass() string { - return ClassTestVectorIntObject + return ClassTestVectorIntObject } func (*TestVectorIntObject) GetType() string { - return TypeTestVectorIntObject + return TypeTestVectorIntObject } // A simple object containing a vector of strings; for testing only type TestVectorString struct { - meta - // Vector of strings - Value []string `json:"value"` + meta + // Vector of strings + Value []string `json:"value"` } func (entity *TestVectorString) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TestVectorString + type stub TestVectorString - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TestVectorString) GetClass() string { - return ClassTestVectorString + return ClassTestVectorString } func (*TestVectorString) GetType() string { - return TypeTestVectorString + 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"` + meta + // Vector of objects + Value []*TestString `json:"value"` } func (entity *TestVectorStringObject) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TestVectorStringObject + type stub TestVectorStringObject - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TestVectorStringObject) GetClass() string { - return ClassTestVectorStringObject + return ClassTestVectorStringObject } func (*TestVectorStringObject) GetType() string { - return TypeTestVectorStringObject + return TypeTestVectorStringObject } - diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 5994c71..6ec9403 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -3,8770 +3,8770 @@ package client import ( - "encoding/json" - "fmt" + "encoding/json" + "fmt" ) func UnmarshalAuthenticationCodeType(data json.RawMessage) (AuthenticationCodeType, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeAuthenticationCodeTypeTelegramMessage: - return UnmarshalAuthenticationCodeTypeTelegramMessage(data) + switch meta.Type { + case TypeAuthenticationCodeTypeTelegramMessage: + return UnmarshalAuthenticationCodeTypeTelegramMessage(data) - case TypeAuthenticationCodeTypeSms: - return UnmarshalAuthenticationCodeTypeSms(data) + case TypeAuthenticationCodeTypeSms: + return UnmarshalAuthenticationCodeTypeSms(data) - case TypeAuthenticationCodeTypeCall: - return UnmarshalAuthenticationCodeTypeCall(data) + case TypeAuthenticationCodeTypeCall: + return UnmarshalAuthenticationCodeTypeCall(data) - case TypeAuthenticationCodeTypeFlashCall: - return UnmarshalAuthenticationCodeTypeFlashCall(data) + case TypeAuthenticationCodeTypeFlashCall: + return UnmarshalAuthenticationCodeTypeFlashCall(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalAuthorizationState(data json.RawMessage) (AuthorizationState, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeAuthorizationStateWaitTdlibParameters: - return UnmarshalAuthorizationStateWaitTdlibParameters(data) + switch meta.Type { + case TypeAuthorizationStateWaitTdlibParameters: + return UnmarshalAuthorizationStateWaitTdlibParameters(data) - case TypeAuthorizationStateWaitEncryptionKey: - return UnmarshalAuthorizationStateWaitEncryptionKey(data) + case TypeAuthorizationStateWaitEncryptionKey: + return UnmarshalAuthorizationStateWaitEncryptionKey(data) - case TypeAuthorizationStateWaitPhoneNumber: - return UnmarshalAuthorizationStateWaitPhoneNumber(data) + case TypeAuthorizationStateWaitPhoneNumber: + return UnmarshalAuthorizationStateWaitPhoneNumber(data) - case TypeAuthorizationStateWaitCode: - return UnmarshalAuthorizationStateWaitCode(data) + case TypeAuthorizationStateWaitCode: + return UnmarshalAuthorizationStateWaitCode(data) - case TypeAuthorizationStateWaitPassword: - return UnmarshalAuthorizationStateWaitPassword(data) + case TypeAuthorizationStateWaitPassword: + return UnmarshalAuthorizationStateWaitPassword(data) - case TypeAuthorizationStateReady: - return UnmarshalAuthorizationStateReady(data) + case TypeAuthorizationStateReady: + return UnmarshalAuthorizationStateReady(data) - case TypeAuthorizationStateLoggingOut: - return UnmarshalAuthorizationStateLoggingOut(data) + case TypeAuthorizationStateLoggingOut: + return UnmarshalAuthorizationStateLoggingOut(data) - case TypeAuthorizationStateClosing: - return UnmarshalAuthorizationStateClosing(data) + case TypeAuthorizationStateClosing: + return UnmarshalAuthorizationStateClosing(data) - case TypeAuthorizationStateClosed: - return UnmarshalAuthorizationStateClosed(data) + case TypeAuthorizationStateClosed: + return UnmarshalAuthorizationStateClosed(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalInputFile(data json.RawMessage) (InputFile, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeInputFileId: - return UnmarshalInputFileId(data) + switch meta.Type { + case TypeInputFileId: + return UnmarshalInputFileId(data) - case TypeInputFileRemote: - return UnmarshalInputFileRemote(data) + case TypeInputFileRemote: + return UnmarshalInputFileRemote(data) - case TypeInputFileLocal: - return UnmarshalInputFileLocal(data) + case TypeInputFileLocal: + return UnmarshalInputFileLocal(data) - case TypeInputFileGenerated: - return UnmarshalInputFileGenerated(data) + case TypeInputFileGenerated: + return UnmarshalInputFileGenerated(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalMaskPoint(data json.RawMessage) (MaskPoint, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeMaskPointForehead: - return UnmarshalMaskPointForehead(data) + switch meta.Type { + case TypeMaskPointForehead: + return UnmarshalMaskPointForehead(data) - case TypeMaskPointEyes: - return UnmarshalMaskPointEyes(data) + case TypeMaskPointEyes: + return UnmarshalMaskPointEyes(data) - case TypeMaskPointMouth: - return UnmarshalMaskPointMouth(data) + case TypeMaskPointMouth: + return UnmarshalMaskPointMouth(data) - case TypeMaskPointChin: - return UnmarshalMaskPointChin(data) + case TypeMaskPointChin: + return UnmarshalMaskPointChin(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalLinkState(data json.RawMessage) (LinkState, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeLinkStateNone: - return UnmarshalLinkStateNone(data) + switch meta.Type { + case TypeLinkStateNone: + return UnmarshalLinkStateNone(data) - case TypeLinkStateKnowsPhoneNumber: - return UnmarshalLinkStateKnowsPhoneNumber(data) + case TypeLinkStateKnowsPhoneNumber: + return UnmarshalLinkStateKnowsPhoneNumber(data) - case TypeLinkStateIsContact: - return UnmarshalLinkStateIsContact(data) + case TypeLinkStateIsContact: + return UnmarshalLinkStateIsContact(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalUserType(data json.RawMessage) (UserType, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeUserTypeRegular: - return UnmarshalUserTypeRegular(data) + switch meta.Type { + case TypeUserTypeRegular: + return UnmarshalUserTypeRegular(data) - case TypeUserTypeDeleted: - return UnmarshalUserTypeDeleted(data) + case TypeUserTypeDeleted: + return UnmarshalUserTypeDeleted(data) - case TypeUserTypeBot: - return UnmarshalUserTypeBot(data) + case TypeUserTypeBot: + return UnmarshalUserTypeBot(data) - case TypeUserTypeUnknown: - return UnmarshalUserTypeUnknown(data) + case TypeUserTypeUnknown: + return UnmarshalUserTypeUnknown(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalChatMemberStatus(data json.RawMessage) (ChatMemberStatus, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeChatMemberStatusCreator: - return UnmarshalChatMemberStatusCreator(data) + switch meta.Type { + case TypeChatMemberStatusCreator: + return UnmarshalChatMemberStatusCreator(data) - case TypeChatMemberStatusAdministrator: - return UnmarshalChatMemberStatusAdministrator(data) + case TypeChatMemberStatusAdministrator: + return UnmarshalChatMemberStatusAdministrator(data) - case TypeChatMemberStatusMember: - return UnmarshalChatMemberStatusMember(data) + case TypeChatMemberStatusMember: + return UnmarshalChatMemberStatusMember(data) - case TypeChatMemberStatusRestricted: - return UnmarshalChatMemberStatusRestricted(data) + case TypeChatMemberStatusRestricted: + return UnmarshalChatMemberStatusRestricted(data) - case TypeChatMemberStatusLeft: - return UnmarshalChatMemberStatusLeft(data) + case TypeChatMemberStatusLeft: + return UnmarshalChatMemberStatusLeft(data) - case TypeChatMemberStatusBanned: - return UnmarshalChatMemberStatusBanned(data) + case TypeChatMemberStatusBanned: + return UnmarshalChatMemberStatusBanned(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalChatMembersFilter(data json.RawMessage) (ChatMembersFilter, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeChatMembersFilterAdministrators: - return UnmarshalChatMembersFilterAdministrators(data) + switch meta.Type { + case TypeChatMembersFilterAdministrators: + return UnmarshalChatMembersFilterAdministrators(data) - case TypeChatMembersFilterMembers: - return UnmarshalChatMembersFilterMembers(data) + case TypeChatMembersFilterMembers: + return UnmarshalChatMembersFilterMembers(data) - case TypeChatMembersFilterRestricted: - return UnmarshalChatMembersFilterRestricted(data) + case TypeChatMembersFilterRestricted: + return UnmarshalChatMembersFilterRestricted(data) - case TypeChatMembersFilterBanned: - return UnmarshalChatMembersFilterBanned(data) + case TypeChatMembersFilterBanned: + return UnmarshalChatMembersFilterBanned(data) - case TypeChatMembersFilterBots: - return UnmarshalChatMembersFilterBots(data) + case TypeChatMembersFilterBots: + return UnmarshalChatMembersFilterBots(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalSupergroupMembersFilter(data json.RawMessage) (SupergroupMembersFilter, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeSupergroupMembersFilterRecent: - return UnmarshalSupergroupMembersFilterRecent(data) + switch meta.Type { + case TypeSupergroupMembersFilterRecent: + return UnmarshalSupergroupMembersFilterRecent(data) - case TypeSupergroupMembersFilterAdministrators: - return UnmarshalSupergroupMembersFilterAdministrators(data) + case TypeSupergroupMembersFilterAdministrators: + return UnmarshalSupergroupMembersFilterAdministrators(data) - case TypeSupergroupMembersFilterSearch: - return UnmarshalSupergroupMembersFilterSearch(data) + case TypeSupergroupMembersFilterSearch: + return UnmarshalSupergroupMembersFilterSearch(data) - case TypeSupergroupMembersFilterRestricted: - return UnmarshalSupergroupMembersFilterRestricted(data) + case TypeSupergroupMembersFilterRestricted: + return UnmarshalSupergroupMembersFilterRestricted(data) - case TypeSupergroupMembersFilterBanned: - return UnmarshalSupergroupMembersFilterBanned(data) + case TypeSupergroupMembersFilterBanned: + return UnmarshalSupergroupMembersFilterBanned(data) - case TypeSupergroupMembersFilterBots: - return UnmarshalSupergroupMembersFilterBots(data) + case TypeSupergroupMembersFilterBots: + return UnmarshalSupergroupMembersFilterBots(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalSecretChatState(data json.RawMessage) (SecretChatState, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeSecretChatStatePending: - return UnmarshalSecretChatStatePending(data) + switch meta.Type { + case TypeSecretChatStatePending: + return UnmarshalSecretChatStatePending(data) - case TypeSecretChatStateReady: - return UnmarshalSecretChatStateReady(data) + case TypeSecretChatStateReady: + return UnmarshalSecretChatStateReady(data) - case TypeSecretChatStateClosed: - return UnmarshalSecretChatStateClosed(data) + case TypeSecretChatStateClosed: + return UnmarshalSecretChatStateClosed(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalMessageForwardInfo(data json.RawMessage) (MessageForwardInfo, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeMessageForwardedFromUser: - return UnmarshalMessageForwardedFromUser(data) + switch meta.Type { + case TypeMessageForwardedFromUser: + return UnmarshalMessageForwardedFromUser(data) - case TypeMessageForwardedPost: - return UnmarshalMessageForwardedPost(data) + case TypeMessageForwardedPost: + return UnmarshalMessageForwardedPost(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalMessageSendingState(data json.RawMessage) (MessageSendingState, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeMessageSendingStatePending: - return UnmarshalMessageSendingStatePending(data) + switch meta.Type { + case TypeMessageSendingStatePending: + return UnmarshalMessageSendingStatePending(data) - case TypeMessageSendingStateFailed: - return UnmarshalMessageSendingStateFailed(data) + case TypeMessageSendingStateFailed: + return UnmarshalMessageSendingStateFailed(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalNotificationSettingsScope(data json.RawMessage) (NotificationSettingsScope, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeNotificationSettingsScopePrivateChats: - return UnmarshalNotificationSettingsScopePrivateChats(data) + switch meta.Type { + case TypeNotificationSettingsScopePrivateChats: + return UnmarshalNotificationSettingsScopePrivateChats(data) - case TypeNotificationSettingsScopeGroupChats: - return UnmarshalNotificationSettingsScopeGroupChats(data) + case TypeNotificationSettingsScopeGroupChats: + return UnmarshalNotificationSettingsScopeGroupChats(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalChatType(data json.RawMessage) (ChatType, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeChatTypePrivate: - return UnmarshalChatTypePrivate(data) + switch meta.Type { + case TypeChatTypePrivate: + return UnmarshalChatTypePrivate(data) - case TypeChatTypeBasicGroup: - return UnmarshalChatTypeBasicGroup(data) + case TypeChatTypeBasicGroup: + return UnmarshalChatTypeBasicGroup(data) - case TypeChatTypeSupergroup: - return UnmarshalChatTypeSupergroup(data) + case TypeChatTypeSupergroup: + return UnmarshalChatTypeSupergroup(data) - case TypeChatTypeSecret: - return UnmarshalChatTypeSecret(data) + case TypeChatTypeSecret: + return UnmarshalChatTypeSecret(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalKeyboardButtonType(data json.RawMessage) (KeyboardButtonType, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeKeyboardButtonTypeText: - return UnmarshalKeyboardButtonTypeText(data) + switch meta.Type { + case TypeKeyboardButtonTypeText: + return UnmarshalKeyboardButtonTypeText(data) - case TypeKeyboardButtonTypeRequestPhoneNumber: - return UnmarshalKeyboardButtonTypeRequestPhoneNumber(data) + case TypeKeyboardButtonTypeRequestPhoneNumber: + return UnmarshalKeyboardButtonTypeRequestPhoneNumber(data) - case TypeKeyboardButtonTypeRequestLocation: - return UnmarshalKeyboardButtonTypeRequestLocation(data) + case TypeKeyboardButtonTypeRequestLocation: + return UnmarshalKeyboardButtonTypeRequestLocation(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalInlineKeyboardButtonType(data json.RawMessage) (InlineKeyboardButtonType, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeInlineKeyboardButtonTypeUrl: - return UnmarshalInlineKeyboardButtonTypeUrl(data) + switch meta.Type { + case TypeInlineKeyboardButtonTypeUrl: + return UnmarshalInlineKeyboardButtonTypeUrl(data) - case TypeInlineKeyboardButtonTypeCallback: - return UnmarshalInlineKeyboardButtonTypeCallback(data) + case TypeInlineKeyboardButtonTypeCallback: + return UnmarshalInlineKeyboardButtonTypeCallback(data) - case TypeInlineKeyboardButtonTypeCallbackGame: - return UnmarshalInlineKeyboardButtonTypeCallbackGame(data) + case TypeInlineKeyboardButtonTypeCallbackGame: + return UnmarshalInlineKeyboardButtonTypeCallbackGame(data) - case TypeInlineKeyboardButtonTypeSwitchInline: - return UnmarshalInlineKeyboardButtonTypeSwitchInline(data) + case TypeInlineKeyboardButtonTypeSwitchInline: + return UnmarshalInlineKeyboardButtonTypeSwitchInline(data) - case TypeInlineKeyboardButtonTypeBuy: - return UnmarshalInlineKeyboardButtonTypeBuy(data) + case TypeInlineKeyboardButtonTypeBuy: + return UnmarshalInlineKeyboardButtonTypeBuy(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalReplyMarkup(data json.RawMessage) (ReplyMarkup, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeReplyMarkupRemoveKeyboard: - return UnmarshalReplyMarkupRemoveKeyboard(data) + switch meta.Type { + case TypeReplyMarkupRemoveKeyboard: + return UnmarshalReplyMarkupRemoveKeyboard(data) - case TypeReplyMarkupForceReply: - return UnmarshalReplyMarkupForceReply(data) + case TypeReplyMarkupForceReply: + return UnmarshalReplyMarkupForceReply(data) - case TypeReplyMarkupShowKeyboard: - return UnmarshalReplyMarkupShowKeyboard(data) + case TypeReplyMarkupShowKeyboard: + return UnmarshalReplyMarkupShowKeyboard(data) - case TypeReplyMarkupInlineKeyboard: - return UnmarshalReplyMarkupInlineKeyboard(data) + case TypeReplyMarkupInlineKeyboard: + return UnmarshalReplyMarkupInlineKeyboard(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalRichText(data json.RawMessage) (RichText, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeRichTextPlain: - return UnmarshalRichTextPlain(data) + switch meta.Type { + case TypeRichTextPlain: + return UnmarshalRichTextPlain(data) - case TypeRichTextBold: - return UnmarshalRichTextBold(data) + case TypeRichTextBold: + return UnmarshalRichTextBold(data) - case TypeRichTextItalic: - return UnmarshalRichTextItalic(data) + case TypeRichTextItalic: + return UnmarshalRichTextItalic(data) - case TypeRichTextUnderline: - return UnmarshalRichTextUnderline(data) + case TypeRichTextUnderline: + return UnmarshalRichTextUnderline(data) - case TypeRichTextStrikethrough: - return UnmarshalRichTextStrikethrough(data) + case TypeRichTextStrikethrough: + return UnmarshalRichTextStrikethrough(data) - case TypeRichTextFixed: - return UnmarshalRichTextFixed(data) + case TypeRichTextFixed: + return UnmarshalRichTextFixed(data) - case TypeRichTextUrl: - return UnmarshalRichTextUrl(data) + case TypeRichTextUrl: + return UnmarshalRichTextUrl(data) - case TypeRichTextEmailAddress: - return UnmarshalRichTextEmailAddress(data) + case TypeRichTextEmailAddress: + return UnmarshalRichTextEmailAddress(data) - case TypeRichTexts: - return UnmarshalRichTexts(data) + case TypeRichTexts: + return UnmarshalRichTexts(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalPageBlock(data json.RawMessage) (PageBlock, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypePageBlockTitle: - return UnmarshalPageBlockTitle(data) + switch meta.Type { + case TypePageBlockTitle: + return UnmarshalPageBlockTitle(data) - case TypePageBlockSubtitle: - return UnmarshalPageBlockSubtitle(data) + case TypePageBlockSubtitle: + return UnmarshalPageBlockSubtitle(data) - case TypePageBlockAuthorDate: - return UnmarshalPageBlockAuthorDate(data) + case TypePageBlockAuthorDate: + return UnmarshalPageBlockAuthorDate(data) - case TypePageBlockHeader: - return UnmarshalPageBlockHeader(data) + case TypePageBlockHeader: + return UnmarshalPageBlockHeader(data) - case TypePageBlockSubheader: - return UnmarshalPageBlockSubheader(data) + case TypePageBlockSubheader: + return UnmarshalPageBlockSubheader(data) - case TypePageBlockParagraph: - return UnmarshalPageBlockParagraph(data) + case TypePageBlockParagraph: + return UnmarshalPageBlockParagraph(data) - case TypePageBlockPreformatted: - return UnmarshalPageBlockPreformatted(data) + case TypePageBlockPreformatted: + return UnmarshalPageBlockPreformatted(data) - case TypePageBlockFooter: - return UnmarshalPageBlockFooter(data) + case TypePageBlockFooter: + return UnmarshalPageBlockFooter(data) - case TypePageBlockDivider: - return UnmarshalPageBlockDivider(data) + case TypePageBlockDivider: + return UnmarshalPageBlockDivider(data) - case TypePageBlockAnchor: - return UnmarshalPageBlockAnchor(data) + case TypePageBlockAnchor: + return UnmarshalPageBlockAnchor(data) - case TypePageBlockList: - return UnmarshalPageBlockList(data) + case TypePageBlockList: + return UnmarshalPageBlockList(data) - case TypePageBlockBlockQuote: - return UnmarshalPageBlockBlockQuote(data) + case TypePageBlockBlockQuote: + return UnmarshalPageBlockBlockQuote(data) - case TypePageBlockPullQuote: - return UnmarshalPageBlockPullQuote(data) + case TypePageBlockPullQuote: + return UnmarshalPageBlockPullQuote(data) - case TypePageBlockAnimation: - return UnmarshalPageBlockAnimation(data) + case TypePageBlockAnimation: + return UnmarshalPageBlockAnimation(data) - case TypePageBlockAudio: - return UnmarshalPageBlockAudio(data) + case TypePageBlockAudio: + return UnmarshalPageBlockAudio(data) - case TypePageBlockPhoto: - return UnmarshalPageBlockPhoto(data) + case TypePageBlockPhoto: + return UnmarshalPageBlockPhoto(data) - case TypePageBlockVideo: - return UnmarshalPageBlockVideo(data) + case TypePageBlockVideo: + return UnmarshalPageBlockVideo(data) - case TypePageBlockCover: - return UnmarshalPageBlockCover(data) + case TypePageBlockCover: + return UnmarshalPageBlockCover(data) - case TypePageBlockEmbedded: - return UnmarshalPageBlockEmbedded(data) + case TypePageBlockEmbedded: + return UnmarshalPageBlockEmbedded(data) - case TypePageBlockEmbeddedPost: - return UnmarshalPageBlockEmbeddedPost(data) + case TypePageBlockEmbeddedPost: + return UnmarshalPageBlockEmbeddedPost(data) - case TypePageBlockCollage: - return UnmarshalPageBlockCollage(data) + case TypePageBlockCollage: + return UnmarshalPageBlockCollage(data) - case TypePageBlockSlideshow: - return UnmarshalPageBlockSlideshow(data) + case TypePageBlockSlideshow: + return UnmarshalPageBlockSlideshow(data) - case TypePageBlockChatLink: - return UnmarshalPageBlockChatLink(data) + case TypePageBlockChatLink: + return UnmarshalPageBlockChatLink(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalInputCredentials(data json.RawMessage) (InputCredentials, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeInputCredentialsSaved: - return UnmarshalInputCredentialsSaved(data) + switch meta.Type { + case TypeInputCredentialsSaved: + return UnmarshalInputCredentialsSaved(data) - case TypeInputCredentialsNew: - return UnmarshalInputCredentialsNew(data) + case TypeInputCredentialsNew: + return UnmarshalInputCredentialsNew(data) - case TypeInputCredentialsAndroidPay: - return UnmarshalInputCredentialsAndroidPay(data) + case TypeInputCredentialsAndroidPay: + return UnmarshalInputCredentialsAndroidPay(data) - case TypeInputCredentialsApplePay: - return UnmarshalInputCredentialsApplePay(data) + case TypeInputCredentialsApplePay: + return UnmarshalInputCredentialsApplePay(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalPassportElementType(data json.RawMessage) (PassportElementType, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypePassportElementTypePersonalDetails: - return UnmarshalPassportElementTypePersonalDetails(data) + switch meta.Type { + case TypePassportElementTypePersonalDetails: + return UnmarshalPassportElementTypePersonalDetails(data) - case TypePassportElementTypePassport: - return UnmarshalPassportElementTypePassport(data) + case TypePassportElementTypePassport: + return UnmarshalPassportElementTypePassport(data) - case TypePassportElementTypeDriverLicense: - return UnmarshalPassportElementTypeDriverLicense(data) + case TypePassportElementTypeDriverLicense: + return UnmarshalPassportElementTypeDriverLicense(data) - case TypePassportElementTypeIdentityCard: - return UnmarshalPassportElementTypeIdentityCard(data) + case TypePassportElementTypeIdentityCard: + return UnmarshalPassportElementTypeIdentityCard(data) - case TypePassportElementTypeInternalPassport: - return UnmarshalPassportElementTypeInternalPassport(data) + case TypePassportElementTypeInternalPassport: + return UnmarshalPassportElementTypeInternalPassport(data) - case TypePassportElementTypeAddress: - return UnmarshalPassportElementTypeAddress(data) + case TypePassportElementTypeAddress: + return UnmarshalPassportElementTypeAddress(data) - case TypePassportElementTypeUtilityBill: - return UnmarshalPassportElementTypeUtilityBill(data) + case TypePassportElementTypeUtilityBill: + return UnmarshalPassportElementTypeUtilityBill(data) - case TypePassportElementTypeBankStatement: - return UnmarshalPassportElementTypeBankStatement(data) + case TypePassportElementTypeBankStatement: + return UnmarshalPassportElementTypeBankStatement(data) - case TypePassportElementTypeRentalAgreement: - return UnmarshalPassportElementTypeRentalAgreement(data) + case TypePassportElementTypeRentalAgreement: + return UnmarshalPassportElementTypeRentalAgreement(data) - case TypePassportElementTypePassportRegistration: - return UnmarshalPassportElementTypePassportRegistration(data) + case TypePassportElementTypePassportRegistration: + return UnmarshalPassportElementTypePassportRegistration(data) - case TypePassportElementTypeTemporaryRegistration: - return UnmarshalPassportElementTypeTemporaryRegistration(data) + case TypePassportElementTypeTemporaryRegistration: + return UnmarshalPassportElementTypeTemporaryRegistration(data) - case TypePassportElementTypePhoneNumber: - return UnmarshalPassportElementTypePhoneNumber(data) + case TypePassportElementTypePhoneNumber: + return UnmarshalPassportElementTypePhoneNumber(data) - case TypePassportElementTypeEmailAddress: - return UnmarshalPassportElementTypeEmailAddress(data) + case TypePassportElementTypeEmailAddress: + return UnmarshalPassportElementTypeEmailAddress(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalPassportElement(data json.RawMessage) (PassportElement, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypePassportElementPersonalDetails: - return UnmarshalPassportElementPersonalDetails(data) + switch meta.Type { + case TypePassportElementPersonalDetails: + return UnmarshalPassportElementPersonalDetails(data) - case TypePassportElementPassport: - return UnmarshalPassportElementPassport(data) + case TypePassportElementPassport: + return UnmarshalPassportElementPassport(data) - case TypePassportElementDriverLicense: - return UnmarshalPassportElementDriverLicense(data) + case TypePassportElementDriverLicense: + return UnmarshalPassportElementDriverLicense(data) - case TypePassportElementIdentityCard: - return UnmarshalPassportElementIdentityCard(data) + case TypePassportElementIdentityCard: + return UnmarshalPassportElementIdentityCard(data) - case TypePassportElementInternalPassport: - return UnmarshalPassportElementInternalPassport(data) + case TypePassportElementInternalPassport: + return UnmarshalPassportElementInternalPassport(data) - case TypePassportElementAddress: - return UnmarshalPassportElementAddress(data) + case TypePassportElementAddress: + return UnmarshalPassportElementAddress(data) - case TypePassportElementUtilityBill: - return UnmarshalPassportElementUtilityBill(data) + case TypePassportElementUtilityBill: + return UnmarshalPassportElementUtilityBill(data) - case TypePassportElementBankStatement: - return UnmarshalPassportElementBankStatement(data) + case TypePassportElementBankStatement: + return UnmarshalPassportElementBankStatement(data) - case TypePassportElementRentalAgreement: - return UnmarshalPassportElementRentalAgreement(data) + case TypePassportElementRentalAgreement: + return UnmarshalPassportElementRentalAgreement(data) - case TypePassportElementPassportRegistration: - return UnmarshalPassportElementPassportRegistration(data) + case TypePassportElementPassportRegistration: + return UnmarshalPassportElementPassportRegistration(data) - case TypePassportElementTemporaryRegistration: - return UnmarshalPassportElementTemporaryRegistration(data) + case TypePassportElementTemporaryRegistration: + return UnmarshalPassportElementTemporaryRegistration(data) - case TypePassportElementPhoneNumber: - return UnmarshalPassportElementPhoneNumber(data) + case TypePassportElementPhoneNumber: + return UnmarshalPassportElementPhoneNumber(data) - case TypePassportElementEmailAddress: - return UnmarshalPassportElementEmailAddress(data) + case TypePassportElementEmailAddress: + return UnmarshalPassportElementEmailAddress(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalInputPassportElement(data json.RawMessage) (InputPassportElement, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeInputPassportElementPersonalDetails: - return UnmarshalInputPassportElementPersonalDetails(data) + switch meta.Type { + case TypeInputPassportElementPersonalDetails: + return UnmarshalInputPassportElementPersonalDetails(data) - case TypeInputPassportElementPassport: - return UnmarshalInputPassportElementPassport(data) + case TypeInputPassportElementPassport: + return UnmarshalInputPassportElementPassport(data) - case TypeInputPassportElementDriverLicense: - return UnmarshalInputPassportElementDriverLicense(data) + case TypeInputPassportElementDriverLicense: + return UnmarshalInputPassportElementDriverLicense(data) - case TypeInputPassportElementIdentityCard: - return UnmarshalInputPassportElementIdentityCard(data) + case TypeInputPassportElementIdentityCard: + return UnmarshalInputPassportElementIdentityCard(data) - case TypeInputPassportElementInternalPassport: - return UnmarshalInputPassportElementInternalPassport(data) + case TypeInputPassportElementInternalPassport: + return UnmarshalInputPassportElementInternalPassport(data) - case TypeInputPassportElementAddress: - return UnmarshalInputPassportElementAddress(data) + case TypeInputPassportElementAddress: + return UnmarshalInputPassportElementAddress(data) - case TypeInputPassportElementUtilityBill: - return UnmarshalInputPassportElementUtilityBill(data) + case TypeInputPassportElementUtilityBill: + return UnmarshalInputPassportElementUtilityBill(data) - case TypeInputPassportElementBankStatement: - return UnmarshalInputPassportElementBankStatement(data) + case TypeInputPassportElementBankStatement: + return UnmarshalInputPassportElementBankStatement(data) - case TypeInputPassportElementRentalAgreement: - return UnmarshalInputPassportElementRentalAgreement(data) + case TypeInputPassportElementRentalAgreement: + return UnmarshalInputPassportElementRentalAgreement(data) - case TypeInputPassportElementPassportRegistration: - return UnmarshalInputPassportElementPassportRegistration(data) + case TypeInputPassportElementPassportRegistration: + return UnmarshalInputPassportElementPassportRegistration(data) - case TypeInputPassportElementTemporaryRegistration: - return UnmarshalInputPassportElementTemporaryRegistration(data) + case TypeInputPassportElementTemporaryRegistration: + return UnmarshalInputPassportElementTemporaryRegistration(data) - case TypeInputPassportElementPhoneNumber: - return UnmarshalInputPassportElementPhoneNumber(data) + case TypeInputPassportElementPhoneNumber: + return UnmarshalInputPassportElementPhoneNumber(data) - case TypeInputPassportElementEmailAddress: - return UnmarshalInputPassportElementEmailAddress(data) + case TypeInputPassportElementEmailAddress: + return UnmarshalInputPassportElementEmailAddress(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalPassportElementErrorSource(data json.RawMessage) (PassportElementErrorSource, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypePassportElementErrorSourceUnspecified: - return UnmarshalPassportElementErrorSourceUnspecified(data) + switch meta.Type { + case TypePassportElementErrorSourceUnspecified: + return UnmarshalPassportElementErrorSourceUnspecified(data) - case TypePassportElementErrorSourceDataField: - return UnmarshalPassportElementErrorSourceDataField(data) + case TypePassportElementErrorSourceDataField: + return UnmarshalPassportElementErrorSourceDataField(data) - case TypePassportElementErrorSourceFrontSide: - return UnmarshalPassportElementErrorSourceFrontSide(data) + case TypePassportElementErrorSourceFrontSide: + return UnmarshalPassportElementErrorSourceFrontSide(data) - case TypePassportElementErrorSourceReverseSide: - return UnmarshalPassportElementErrorSourceReverseSide(data) + case TypePassportElementErrorSourceReverseSide: + return UnmarshalPassportElementErrorSourceReverseSide(data) - case TypePassportElementErrorSourceSelfie: - return UnmarshalPassportElementErrorSourceSelfie(data) + case TypePassportElementErrorSourceSelfie: + return UnmarshalPassportElementErrorSourceSelfie(data) - case TypePassportElementErrorSourceTranslationFile: - return UnmarshalPassportElementErrorSourceTranslationFile(data) + case TypePassportElementErrorSourceTranslationFile: + return UnmarshalPassportElementErrorSourceTranslationFile(data) - case TypePassportElementErrorSourceTranslationFiles: - return UnmarshalPassportElementErrorSourceTranslationFiles(data) + case TypePassportElementErrorSourceTranslationFiles: + return UnmarshalPassportElementErrorSourceTranslationFiles(data) - case TypePassportElementErrorSourceFile: - return UnmarshalPassportElementErrorSourceFile(data) + case TypePassportElementErrorSourceFile: + return UnmarshalPassportElementErrorSourceFile(data) - case TypePassportElementErrorSourceFiles: - return UnmarshalPassportElementErrorSourceFiles(data) + case TypePassportElementErrorSourceFiles: + return UnmarshalPassportElementErrorSourceFiles(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalInputPassportElementErrorSource(data json.RawMessage) (InputPassportElementErrorSource, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeInputPassportElementErrorSourceUnspecified: - return UnmarshalInputPassportElementErrorSourceUnspecified(data) + switch meta.Type { + case TypeInputPassportElementErrorSourceUnspecified: + return UnmarshalInputPassportElementErrorSourceUnspecified(data) - case TypeInputPassportElementErrorSourceDataField: - return UnmarshalInputPassportElementErrorSourceDataField(data) + case TypeInputPassportElementErrorSourceDataField: + return UnmarshalInputPassportElementErrorSourceDataField(data) - case TypeInputPassportElementErrorSourceFrontSide: - return UnmarshalInputPassportElementErrorSourceFrontSide(data) + case TypeInputPassportElementErrorSourceFrontSide: + return UnmarshalInputPassportElementErrorSourceFrontSide(data) - case TypeInputPassportElementErrorSourceReverseSide: - return UnmarshalInputPassportElementErrorSourceReverseSide(data) + case TypeInputPassportElementErrorSourceReverseSide: + return UnmarshalInputPassportElementErrorSourceReverseSide(data) - case TypeInputPassportElementErrorSourceSelfie: - return UnmarshalInputPassportElementErrorSourceSelfie(data) + case TypeInputPassportElementErrorSourceSelfie: + return UnmarshalInputPassportElementErrorSourceSelfie(data) - case TypeInputPassportElementErrorSourceTranslationFile: - return UnmarshalInputPassportElementErrorSourceTranslationFile(data) + case TypeInputPassportElementErrorSourceTranslationFile: + return UnmarshalInputPassportElementErrorSourceTranslationFile(data) - case TypeInputPassportElementErrorSourceTranslationFiles: - return UnmarshalInputPassportElementErrorSourceTranslationFiles(data) + case TypeInputPassportElementErrorSourceTranslationFiles: + return UnmarshalInputPassportElementErrorSourceTranslationFiles(data) - case TypeInputPassportElementErrorSourceFile: - return UnmarshalInputPassportElementErrorSourceFile(data) + case TypeInputPassportElementErrorSourceFile: + return UnmarshalInputPassportElementErrorSourceFile(data) - case TypeInputPassportElementErrorSourceFiles: - return UnmarshalInputPassportElementErrorSourceFiles(data) + case TypeInputPassportElementErrorSourceFiles: + return UnmarshalInputPassportElementErrorSourceFiles(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeMessageText: - return UnmarshalMessageText(data) + switch meta.Type { + case TypeMessageText: + return UnmarshalMessageText(data) - case TypeMessageAnimation: - return UnmarshalMessageAnimation(data) + case TypeMessageAnimation: + return UnmarshalMessageAnimation(data) - case TypeMessageAudio: - return UnmarshalMessageAudio(data) + case TypeMessageAudio: + return UnmarshalMessageAudio(data) - case TypeMessageDocument: - return UnmarshalMessageDocument(data) + case TypeMessageDocument: + return UnmarshalMessageDocument(data) - case TypeMessagePhoto: - return UnmarshalMessagePhoto(data) + case TypeMessagePhoto: + return UnmarshalMessagePhoto(data) - case TypeMessageExpiredPhoto: - return UnmarshalMessageExpiredPhoto(data) + case TypeMessageExpiredPhoto: + return UnmarshalMessageExpiredPhoto(data) - case TypeMessageSticker: - return UnmarshalMessageSticker(data) + case TypeMessageSticker: + return UnmarshalMessageSticker(data) - case TypeMessageVideo: - return UnmarshalMessageVideo(data) + case TypeMessageVideo: + return UnmarshalMessageVideo(data) - case TypeMessageExpiredVideo: - return UnmarshalMessageExpiredVideo(data) + case TypeMessageExpiredVideo: + return UnmarshalMessageExpiredVideo(data) - case TypeMessageVideoNote: - return UnmarshalMessageVideoNote(data) + case TypeMessageVideoNote: + return UnmarshalMessageVideoNote(data) - case TypeMessageVoiceNote: - return UnmarshalMessageVoiceNote(data) + case TypeMessageVoiceNote: + return UnmarshalMessageVoiceNote(data) - case TypeMessageLocation: - return UnmarshalMessageLocation(data) + case TypeMessageLocation: + return UnmarshalMessageLocation(data) - case TypeMessageVenue: - return UnmarshalMessageVenue(data) + case TypeMessageVenue: + return UnmarshalMessageVenue(data) - case TypeMessageContact: - return UnmarshalMessageContact(data) + case TypeMessageContact: + return UnmarshalMessageContact(data) - case TypeMessageGame: - return UnmarshalMessageGame(data) + case TypeMessageGame: + return UnmarshalMessageGame(data) - case TypeMessageInvoice: - return UnmarshalMessageInvoice(data) + case TypeMessageInvoice: + return UnmarshalMessageInvoice(data) - case TypeMessageCall: - return UnmarshalMessageCall(data) + case TypeMessageCall: + return UnmarshalMessageCall(data) - case TypeMessageBasicGroupChatCreate: - return UnmarshalMessageBasicGroupChatCreate(data) + case TypeMessageBasicGroupChatCreate: + return UnmarshalMessageBasicGroupChatCreate(data) - case TypeMessageSupergroupChatCreate: - return UnmarshalMessageSupergroupChatCreate(data) + case TypeMessageSupergroupChatCreate: + return UnmarshalMessageSupergroupChatCreate(data) - case TypeMessageChatChangeTitle: - return UnmarshalMessageChatChangeTitle(data) + case TypeMessageChatChangeTitle: + return UnmarshalMessageChatChangeTitle(data) - case TypeMessageChatChangePhoto: - return UnmarshalMessageChatChangePhoto(data) + case TypeMessageChatChangePhoto: + return UnmarshalMessageChatChangePhoto(data) - case TypeMessageChatDeletePhoto: - return UnmarshalMessageChatDeletePhoto(data) + case TypeMessageChatDeletePhoto: + return UnmarshalMessageChatDeletePhoto(data) - case TypeMessageChatAddMembers: - return UnmarshalMessageChatAddMembers(data) + case TypeMessageChatAddMembers: + return UnmarshalMessageChatAddMembers(data) - case TypeMessageChatJoinByLink: - return UnmarshalMessageChatJoinByLink(data) + case TypeMessageChatJoinByLink: + return UnmarshalMessageChatJoinByLink(data) - case TypeMessageChatDeleteMember: - return UnmarshalMessageChatDeleteMember(data) + case TypeMessageChatDeleteMember: + return UnmarshalMessageChatDeleteMember(data) - case TypeMessageChatUpgradeTo: - return UnmarshalMessageChatUpgradeTo(data) + case TypeMessageChatUpgradeTo: + return UnmarshalMessageChatUpgradeTo(data) - case TypeMessageChatUpgradeFrom: - return UnmarshalMessageChatUpgradeFrom(data) + case TypeMessageChatUpgradeFrom: + return UnmarshalMessageChatUpgradeFrom(data) - case TypeMessagePinMessage: - return UnmarshalMessagePinMessage(data) + case TypeMessagePinMessage: + return UnmarshalMessagePinMessage(data) - case TypeMessageScreenshotTaken: - return UnmarshalMessageScreenshotTaken(data) + case TypeMessageScreenshotTaken: + return UnmarshalMessageScreenshotTaken(data) - case TypeMessageChatSetTtl: - return UnmarshalMessageChatSetTtl(data) + case TypeMessageChatSetTtl: + return UnmarshalMessageChatSetTtl(data) - case TypeMessageCustomServiceAction: - return UnmarshalMessageCustomServiceAction(data) + case TypeMessageCustomServiceAction: + return UnmarshalMessageCustomServiceAction(data) - case TypeMessageGameScore: - return UnmarshalMessageGameScore(data) + case TypeMessageGameScore: + return UnmarshalMessageGameScore(data) - case TypeMessagePaymentSuccessful: - return UnmarshalMessagePaymentSuccessful(data) + case TypeMessagePaymentSuccessful: + return UnmarshalMessagePaymentSuccessful(data) - case TypeMessagePaymentSuccessfulBot: - return UnmarshalMessagePaymentSuccessfulBot(data) + case TypeMessagePaymentSuccessfulBot: + return UnmarshalMessagePaymentSuccessfulBot(data) - case TypeMessageContactRegistered: - return UnmarshalMessageContactRegistered(data) + case TypeMessageContactRegistered: + return UnmarshalMessageContactRegistered(data) - case TypeMessageWebsiteConnected: - return UnmarshalMessageWebsiteConnected(data) + case TypeMessageWebsiteConnected: + return UnmarshalMessageWebsiteConnected(data) - case TypeMessagePassportDataSent: - return UnmarshalMessagePassportDataSent(data) + case TypeMessagePassportDataSent: + return UnmarshalMessagePassportDataSent(data) - case TypeMessagePassportDataReceived: - return UnmarshalMessagePassportDataReceived(data) + case TypeMessagePassportDataReceived: + return UnmarshalMessagePassportDataReceived(data) - case TypeMessageUnsupported: - return UnmarshalMessageUnsupported(data) + case TypeMessageUnsupported: + return UnmarshalMessageUnsupported(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalTextEntityType(data json.RawMessage) (TextEntityType, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeTextEntityTypeMention: - return UnmarshalTextEntityTypeMention(data) + switch meta.Type { + case TypeTextEntityTypeMention: + return UnmarshalTextEntityTypeMention(data) - case TypeTextEntityTypeHashtag: - return UnmarshalTextEntityTypeHashtag(data) + case TypeTextEntityTypeHashtag: + return UnmarshalTextEntityTypeHashtag(data) - case TypeTextEntityTypeCashtag: - return UnmarshalTextEntityTypeCashtag(data) + case TypeTextEntityTypeCashtag: + return UnmarshalTextEntityTypeCashtag(data) - case TypeTextEntityTypeBotCommand: - return UnmarshalTextEntityTypeBotCommand(data) + case TypeTextEntityTypeBotCommand: + return UnmarshalTextEntityTypeBotCommand(data) - case TypeTextEntityTypeUrl: - return UnmarshalTextEntityTypeUrl(data) + case TypeTextEntityTypeUrl: + return UnmarshalTextEntityTypeUrl(data) - case TypeTextEntityTypeEmailAddress: - return UnmarshalTextEntityTypeEmailAddress(data) + case TypeTextEntityTypeEmailAddress: + return UnmarshalTextEntityTypeEmailAddress(data) - case TypeTextEntityTypeBold: - return UnmarshalTextEntityTypeBold(data) + case TypeTextEntityTypeBold: + return UnmarshalTextEntityTypeBold(data) - case TypeTextEntityTypeItalic: - return UnmarshalTextEntityTypeItalic(data) + case TypeTextEntityTypeItalic: + return UnmarshalTextEntityTypeItalic(data) - case TypeTextEntityTypeCode: - return UnmarshalTextEntityTypeCode(data) + case TypeTextEntityTypeCode: + return UnmarshalTextEntityTypeCode(data) - case TypeTextEntityTypePre: - return UnmarshalTextEntityTypePre(data) + case TypeTextEntityTypePre: + return UnmarshalTextEntityTypePre(data) - case TypeTextEntityTypePreCode: - return UnmarshalTextEntityTypePreCode(data) + case TypeTextEntityTypePreCode: + return UnmarshalTextEntityTypePreCode(data) - case TypeTextEntityTypeTextUrl: - return UnmarshalTextEntityTypeTextUrl(data) + case TypeTextEntityTypeTextUrl: + return UnmarshalTextEntityTypeTextUrl(data) - case TypeTextEntityTypeMentionName: - return UnmarshalTextEntityTypeMentionName(data) + case TypeTextEntityTypeMentionName: + return UnmarshalTextEntityTypeMentionName(data) - case TypeTextEntityTypePhoneNumber: - return UnmarshalTextEntityTypePhoneNumber(data) + case TypeTextEntityTypePhoneNumber: + return UnmarshalTextEntityTypePhoneNumber(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalInputMessageContent(data json.RawMessage) (InputMessageContent, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeInputMessageText: - return UnmarshalInputMessageText(data) + switch meta.Type { + case TypeInputMessageText: + return UnmarshalInputMessageText(data) - case TypeInputMessageAnimation: - return UnmarshalInputMessageAnimation(data) + case TypeInputMessageAnimation: + return UnmarshalInputMessageAnimation(data) - case TypeInputMessageAudio: - return UnmarshalInputMessageAudio(data) + case TypeInputMessageAudio: + return UnmarshalInputMessageAudio(data) - case TypeInputMessageDocument: - return UnmarshalInputMessageDocument(data) + case TypeInputMessageDocument: + return UnmarshalInputMessageDocument(data) - case TypeInputMessagePhoto: - return UnmarshalInputMessagePhoto(data) + case TypeInputMessagePhoto: + return UnmarshalInputMessagePhoto(data) - case TypeInputMessageSticker: - return UnmarshalInputMessageSticker(data) + case TypeInputMessageSticker: + return UnmarshalInputMessageSticker(data) - case TypeInputMessageVideo: - return UnmarshalInputMessageVideo(data) + case TypeInputMessageVideo: + return UnmarshalInputMessageVideo(data) - case TypeInputMessageVideoNote: - return UnmarshalInputMessageVideoNote(data) + case TypeInputMessageVideoNote: + return UnmarshalInputMessageVideoNote(data) - case TypeInputMessageVoiceNote: - return UnmarshalInputMessageVoiceNote(data) + case TypeInputMessageVoiceNote: + return UnmarshalInputMessageVoiceNote(data) - case TypeInputMessageLocation: - return UnmarshalInputMessageLocation(data) + case TypeInputMessageLocation: + return UnmarshalInputMessageLocation(data) - case TypeInputMessageVenue: - return UnmarshalInputMessageVenue(data) + case TypeInputMessageVenue: + return UnmarshalInputMessageVenue(data) - case TypeInputMessageContact: - return UnmarshalInputMessageContact(data) + case TypeInputMessageContact: + return UnmarshalInputMessageContact(data) - case TypeInputMessageGame: - return UnmarshalInputMessageGame(data) + case TypeInputMessageGame: + return UnmarshalInputMessageGame(data) - case TypeInputMessageInvoice: - return UnmarshalInputMessageInvoice(data) + case TypeInputMessageInvoice: + return UnmarshalInputMessageInvoice(data) - case TypeInputMessageForwarded: - return UnmarshalInputMessageForwarded(data) + case TypeInputMessageForwarded: + return UnmarshalInputMessageForwarded(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalSearchMessagesFilter(data json.RawMessage) (SearchMessagesFilter, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeSearchMessagesFilterEmpty: - return UnmarshalSearchMessagesFilterEmpty(data) + switch meta.Type { + case TypeSearchMessagesFilterEmpty: + return UnmarshalSearchMessagesFilterEmpty(data) - case TypeSearchMessagesFilterAnimation: - return UnmarshalSearchMessagesFilterAnimation(data) + case TypeSearchMessagesFilterAnimation: + return UnmarshalSearchMessagesFilterAnimation(data) - case TypeSearchMessagesFilterAudio: - return UnmarshalSearchMessagesFilterAudio(data) + case TypeSearchMessagesFilterAudio: + return UnmarshalSearchMessagesFilterAudio(data) - case TypeSearchMessagesFilterDocument: - return UnmarshalSearchMessagesFilterDocument(data) + case TypeSearchMessagesFilterDocument: + return UnmarshalSearchMessagesFilterDocument(data) - case TypeSearchMessagesFilterPhoto: - return UnmarshalSearchMessagesFilterPhoto(data) + case TypeSearchMessagesFilterPhoto: + return UnmarshalSearchMessagesFilterPhoto(data) - case TypeSearchMessagesFilterVideo: - return UnmarshalSearchMessagesFilterVideo(data) + case TypeSearchMessagesFilterVideo: + return UnmarshalSearchMessagesFilterVideo(data) - case TypeSearchMessagesFilterVoiceNote: - return UnmarshalSearchMessagesFilterVoiceNote(data) + case TypeSearchMessagesFilterVoiceNote: + return UnmarshalSearchMessagesFilterVoiceNote(data) - case TypeSearchMessagesFilterPhotoAndVideo: - return UnmarshalSearchMessagesFilterPhotoAndVideo(data) + case TypeSearchMessagesFilterPhotoAndVideo: + return UnmarshalSearchMessagesFilterPhotoAndVideo(data) - case TypeSearchMessagesFilterUrl: - return UnmarshalSearchMessagesFilterUrl(data) + case TypeSearchMessagesFilterUrl: + return UnmarshalSearchMessagesFilterUrl(data) - case TypeSearchMessagesFilterChatPhoto: - return UnmarshalSearchMessagesFilterChatPhoto(data) + case TypeSearchMessagesFilterChatPhoto: + return UnmarshalSearchMessagesFilterChatPhoto(data) - case TypeSearchMessagesFilterCall: - return UnmarshalSearchMessagesFilterCall(data) + case TypeSearchMessagesFilterCall: + return UnmarshalSearchMessagesFilterCall(data) - case TypeSearchMessagesFilterMissedCall: - return UnmarshalSearchMessagesFilterMissedCall(data) + case TypeSearchMessagesFilterMissedCall: + return UnmarshalSearchMessagesFilterMissedCall(data) - case TypeSearchMessagesFilterVideoNote: - return UnmarshalSearchMessagesFilterVideoNote(data) + case TypeSearchMessagesFilterVideoNote: + return UnmarshalSearchMessagesFilterVideoNote(data) - case TypeSearchMessagesFilterVoiceAndVideoNote: - return UnmarshalSearchMessagesFilterVoiceAndVideoNote(data) + case TypeSearchMessagesFilterVoiceAndVideoNote: + return UnmarshalSearchMessagesFilterVoiceAndVideoNote(data) - case TypeSearchMessagesFilterMention: - return UnmarshalSearchMessagesFilterMention(data) + case TypeSearchMessagesFilterMention: + return UnmarshalSearchMessagesFilterMention(data) - case TypeSearchMessagesFilterUnreadMention: - return UnmarshalSearchMessagesFilterUnreadMention(data) + case TypeSearchMessagesFilterUnreadMention: + return UnmarshalSearchMessagesFilterUnreadMention(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalChatAction(data json.RawMessage) (ChatAction, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeChatActionTyping: - return UnmarshalChatActionTyping(data) + switch meta.Type { + case TypeChatActionTyping: + return UnmarshalChatActionTyping(data) - case TypeChatActionRecordingVideo: - return UnmarshalChatActionRecordingVideo(data) + case TypeChatActionRecordingVideo: + return UnmarshalChatActionRecordingVideo(data) - case TypeChatActionUploadingVideo: - return UnmarshalChatActionUploadingVideo(data) + case TypeChatActionUploadingVideo: + return UnmarshalChatActionUploadingVideo(data) - case TypeChatActionRecordingVoiceNote: - return UnmarshalChatActionRecordingVoiceNote(data) + case TypeChatActionRecordingVoiceNote: + return UnmarshalChatActionRecordingVoiceNote(data) - case TypeChatActionUploadingVoiceNote: - return UnmarshalChatActionUploadingVoiceNote(data) + case TypeChatActionUploadingVoiceNote: + return UnmarshalChatActionUploadingVoiceNote(data) - case TypeChatActionUploadingPhoto: - return UnmarshalChatActionUploadingPhoto(data) + case TypeChatActionUploadingPhoto: + return UnmarshalChatActionUploadingPhoto(data) - case TypeChatActionUploadingDocument: - return UnmarshalChatActionUploadingDocument(data) + case TypeChatActionUploadingDocument: + return UnmarshalChatActionUploadingDocument(data) - case TypeChatActionChoosingLocation: - return UnmarshalChatActionChoosingLocation(data) + case TypeChatActionChoosingLocation: + return UnmarshalChatActionChoosingLocation(data) - case TypeChatActionChoosingContact: - return UnmarshalChatActionChoosingContact(data) + case TypeChatActionChoosingContact: + return UnmarshalChatActionChoosingContact(data) - case TypeChatActionStartPlayingGame: - return UnmarshalChatActionStartPlayingGame(data) + case TypeChatActionStartPlayingGame: + return UnmarshalChatActionStartPlayingGame(data) - case TypeChatActionRecordingVideoNote: - return UnmarshalChatActionRecordingVideoNote(data) + case TypeChatActionRecordingVideoNote: + return UnmarshalChatActionRecordingVideoNote(data) - case TypeChatActionUploadingVideoNote: - return UnmarshalChatActionUploadingVideoNote(data) + case TypeChatActionUploadingVideoNote: + return UnmarshalChatActionUploadingVideoNote(data) - case TypeChatActionCancel: - return UnmarshalChatActionCancel(data) + case TypeChatActionCancel: + return UnmarshalChatActionCancel(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalUserStatus(data json.RawMessage) (UserStatus, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeUserStatusEmpty: - return UnmarshalUserStatusEmpty(data) + switch meta.Type { + case TypeUserStatusEmpty: + return UnmarshalUserStatusEmpty(data) - case TypeUserStatusOnline: - return UnmarshalUserStatusOnline(data) + case TypeUserStatusOnline: + return UnmarshalUserStatusOnline(data) - case TypeUserStatusOffline: - return UnmarshalUserStatusOffline(data) + case TypeUserStatusOffline: + return UnmarshalUserStatusOffline(data) - case TypeUserStatusRecently: - return UnmarshalUserStatusRecently(data) + case TypeUserStatusRecently: + return UnmarshalUserStatusRecently(data) - case TypeUserStatusLastWeek: - return UnmarshalUserStatusLastWeek(data) + case TypeUserStatusLastWeek: + return UnmarshalUserStatusLastWeek(data) - case TypeUserStatusLastMonth: - return UnmarshalUserStatusLastMonth(data) + case TypeUserStatusLastMonth: + return UnmarshalUserStatusLastMonth(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeCallDiscardReasonEmpty: - return UnmarshalCallDiscardReasonEmpty(data) + switch meta.Type { + case TypeCallDiscardReasonEmpty: + return UnmarshalCallDiscardReasonEmpty(data) - case TypeCallDiscardReasonMissed: - return UnmarshalCallDiscardReasonMissed(data) + case TypeCallDiscardReasonMissed: + return UnmarshalCallDiscardReasonMissed(data) - case TypeCallDiscardReasonDeclined: - return UnmarshalCallDiscardReasonDeclined(data) + case TypeCallDiscardReasonDeclined: + return UnmarshalCallDiscardReasonDeclined(data) - case TypeCallDiscardReasonDisconnected: - return UnmarshalCallDiscardReasonDisconnected(data) + case TypeCallDiscardReasonDisconnected: + return UnmarshalCallDiscardReasonDisconnected(data) - case TypeCallDiscardReasonHungUp: - return UnmarshalCallDiscardReasonHungUp(data) + case TypeCallDiscardReasonHungUp: + return UnmarshalCallDiscardReasonHungUp(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalCallState(data json.RawMessage) (CallState, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeCallStatePending: - return UnmarshalCallStatePending(data) + switch meta.Type { + case TypeCallStatePending: + return UnmarshalCallStatePending(data) - case TypeCallStateExchangingKeys: - return UnmarshalCallStateExchangingKeys(data) + case TypeCallStateExchangingKeys: + return UnmarshalCallStateExchangingKeys(data) - case TypeCallStateReady: - return UnmarshalCallStateReady(data) + case TypeCallStateReady: + return UnmarshalCallStateReady(data) - case TypeCallStateHangingUp: - return UnmarshalCallStateHangingUp(data) + case TypeCallStateHangingUp: + return UnmarshalCallStateHangingUp(data) - case TypeCallStateDiscarded: - return UnmarshalCallStateDiscarded(data) + case TypeCallStateDiscarded: + return UnmarshalCallStateDiscarded(data) - case TypeCallStateError: - return UnmarshalCallStateError(data) + case TypeCallStateError: + return UnmarshalCallStateError(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalInputInlineQueryResult(data json.RawMessage) (InputInlineQueryResult, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeInputInlineQueryResultAnimatedGif: - return UnmarshalInputInlineQueryResultAnimatedGif(data) + switch meta.Type { + case TypeInputInlineQueryResultAnimatedGif: + return UnmarshalInputInlineQueryResultAnimatedGif(data) - case TypeInputInlineQueryResultAnimatedMpeg4: - return UnmarshalInputInlineQueryResultAnimatedMpeg4(data) + case TypeInputInlineQueryResultAnimatedMpeg4: + return UnmarshalInputInlineQueryResultAnimatedMpeg4(data) - case TypeInputInlineQueryResultArticle: - return UnmarshalInputInlineQueryResultArticle(data) + case TypeInputInlineQueryResultArticle: + return UnmarshalInputInlineQueryResultArticle(data) - case TypeInputInlineQueryResultAudio: - return UnmarshalInputInlineQueryResultAudio(data) + case TypeInputInlineQueryResultAudio: + return UnmarshalInputInlineQueryResultAudio(data) - case TypeInputInlineQueryResultContact: - return UnmarshalInputInlineQueryResultContact(data) + case TypeInputInlineQueryResultContact: + return UnmarshalInputInlineQueryResultContact(data) - case TypeInputInlineQueryResultDocument: - return UnmarshalInputInlineQueryResultDocument(data) + case TypeInputInlineQueryResultDocument: + return UnmarshalInputInlineQueryResultDocument(data) - case TypeInputInlineQueryResultGame: - return UnmarshalInputInlineQueryResultGame(data) + case TypeInputInlineQueryResultGame: + return UnmarshalInputInlineQueryResultGame(data) - case TypeInputInlineQueryResultLocation: - return UnmarshalInputInlineQueryResultLocation(data) + case TypeInputInlineQueryResultLocation: + return UnmarshalInputInlineQueryResultLocation(data) - case TypeInputInlineQueryResultPhoto: - return UnmarshalInputInlineQueryResultPhoto(data) + case TypeInputInlineQueryResultPhoto: + return UnmarshalInputInlineQueryResultPhoto(data) - case TypeInputInlineQueryResultSticker: - return UnmarshalInputInlineQueryResultSticker(data) + case TypeInputInlineQueryResultSticker: + return UnmarshalInputInlineQueryResultSticker(data) - case TypeInputInlineQueryResultVenue: - return UnmarshalInputInlineQueryResultVenue(data) + case TypeInputInlineQueryResultVenue: + return UnmarshalInputInlineQueryResultVenue(data) - case TypeInputInlineQueryResultVideo: - return UnmarshalInputInlineQueryResultVideo(data) + case TypeInputInlineQueryResultVideo: + return UnmarshalInputInlineQueryResultVideo(data) - case TypeInputInlineQueryResultVoiceNote: - return UnmarshalInputInlineQueryResultVoiceNote(data) + case TypeInputInlineQueryResultVoiceNote: + return UnmarshalInputInlineQueryResultVoiceNote(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalInlineQueryResult(data json.RawMessage) (InlineQueryResult, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeInlineQueryResultArticle: - return UnmarshalInlineQueryResultArticle(data) + switch meta.Type { + case TypeInlineQueryResultArticle: + return UnmarshalInlineQueryResultArticle(data) - case TypeInlineQueryResultContact: - return UnmarshalInlineQueryResultContact(data) + case TypeInlineQueryResultContact: + return UnmarshalInlineQueryResultContact(data) - case TypeInlineQueryResultLocation: - return UnmarshalInlineQueryResultLocation(data) + case TypeInlineQueryResultLocation: + return UnmarshalInlineQueryResultLocation(data) - case TypeInlineQueryResultVenue: - return UnmarshalInlineQueryResultVenue(data) + case TypeInlineQueryResultVenue: + return UnmarshalInlineQueryResultVenue(data) - case TypeInlineQueryResultGame: - return UnmarshalInlineQueryResultGame(data) + case TypeInlineQueryResultGame: + return UnmarshalInlineQueryResultGame(data) - case TypeInlineQueryResultAnimation: - return UnmarshalInlineQueryResultAnimation(data) + case TypeInlineQueryResultAnimation: + return UnmarshalInlineQueryResultAnimation(data) - case TypeInlineQueryResultAudio: - return UnmarshalInlineQueryResultAudio(data) + case TypeInlineQueryResultAudio: + return UnmarshalInlineQueryResultAudio(data) - case TypeInlineQueryResultDocument: - return UnmarshalInlineQueryResultDocument(data) + case TypeInlineQueryResultDocument: + return UnmarshalInlineQueryResultDocument(data) - case TypeInlineQueryResultPhoto: - return UnmarshalInlineQueryResultPhoto(data) + case TypeInlineQueryResultPhoto: + return UnmarshalInlineQueryResultPhoto(data) - case TypeInlineQueryResultSticker: - return UnmarshalInlineQueryResultSticker(data) + case TypeInlineQueryResultSticker: + return UnmarshalInlineQueryResultSticker(data) - case TypeInlineQueryResultVideo: - return UnmarshalInlineQueryResultVideo(data) + case TypeInlineQueryResultVideo: + return UnmarshalInlineQueryResultVideo(data) - case TypeInlineQueryResultVoiceNote: - return UnmarshalInlineQueryResultVoiceNote(data) + case TypeInlineQueryResultVoiceNote: + return UnmarshalInlineQueryResultVoiceNote(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalCallbackQueryPayload(data json.RawMessage) (CallbackQueryPayload, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeCallbackQueryPayloadData: - return UnmarshalCallbackQueryPayloadData(data) + switch meta.Type { + case TypeCallbackQueryPayloadData: + return UnmarshalCallbackQueryPayloadData(data) - case TypeCallbackQueryPayloadGame: - return UnmarshalCallbackQueryPayloadGame(data) + case TypeCallbackQueryPayloadGame: + return UnmarshalCallbackQueryPayloadGame(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeChatEventMessageEdited: - return UnmarshalChatEventMessageEdited(data) + switch meta.Type { + case TypeChatEventMessageEdited: + return UnmarshalChatEventMessageEdited(data) - case TypeChatEventMessageDeleted: - return UnmarshalChatEventMessageDeleted(data) + case TypeChatEventMessageDeleted: + return UnmarshalChatEventMessageDeleted(data) - case TypeChatEventMessagePinned: - return UnmarshalChatEventMessagePinned(data) + case TypeChatEventMessagePinned: + return UnmarshalChatEventMessagePinned(data) - case TypeChatEventMessageUnpinned: - return UnmarshalChatEventMessageUnpinned(data) + case TypeChatEventMessageUnpinned: + return UnmarshalChatEventMessageUnpinned(data) - case TypeChatEventMemberJoined: - return UnmarshalChatEventMemberJoined(data) + case TypeChatEventMemberJoined: + return UnmarshalChatEventMemberJoined(data) - case TypeChatEventMemberLeft: - return UnmarshalChatEventMemberLeft(data) + case TypeChatEventMemberLeft: + return UnmarshalChatEventMemberLeft(data) - case TypeChatEventMemberInvited: - return UnmarshalChatEventMemberInvited(data) + case TypeChatEventMemberInvited: + return UnmarshalChatEventMemberInvited(data) - case TypeChatEventMemberPromoted: - return UnmarshalChatEventMemberPromoted(data) + case TypeChatEventMemberPromoted: + return UnmarshalChatEventMemberPromoted(data) - case TypeChatEventMemberRestricted: - return UnmarshalChatEventMemberRestricted(data) + case TypeChatEventMemberRestricted: + return UnmarshalChatEventMemberRestricted(data) - case TypeChatEventTitleChanged: - return UnmarshalChatEventTitleChanged(data) + case TypeChatEventTitleChanged: + return UnmarshalChatEventTitleChanged(data) - case TypeChatEventDescriptionChanged: - return UnmarshalChatEventDescriptionChanged(data) + case TypeChatEventDescriptionChanged: + return UnmarshalChatEventDescriptionChanged(data) - case TypeChatEventUsernameChanged: - return UnmarshalChatEventUsernameChanged(data) + case TypeChatEventUsernameChanged: + return UnmarshalChatEventUsernameChanged(data) - case TypeChatEventPhotoChanged: - return UnmarshalChatEventPhotoChanged(data) + case TypeChatEventPhotoChanged: + return UnmarshalChatEventPhotoChanged(data) - case TypeChatEventInvitesToggled: - return UnmarshalChatEventInvitesToggled(data) + case TypeChatEventInvitesToggled: + return UnmarshalChatEventInvitesToggled(data) - case TypeChatEventSignMessagesToggled: - return UnmarshalChatEventSignMessagesToggled(data) + case TypeChatEventSignMessagesToggled: + return UnmarshalChatEventSignMessagesToggled(data) - case TypeChatEventStickerSetChanged: - return UnmarshalChatEventStickerSetChanged(data) + case TypeChatEventStickerSetChanged: + return UnmarshalChatEventStickerSetChanged(data) - case TypeChatEventIsAllHistoryAvailableToggled: - return UnmarshalChatEventIsAllHistoryAvailableToggled(data) + case TypeChatEventIsAllHistoryAvailableToggled: + return UnmarshalChatEventIsAllHistoryAvailableToggled(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalLanguagePackStringValue(data json.RawMessage) (LanguagePackStringValue, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeLanguagePackStringValueOrdinary: - return UnmarshalLanguagePackStringValueOrdinary(data) + switch meta.Type { + case TypeLanguagePackStringValueOrdinary: + return UnmarshalLanguagePackStringValueOrdinary(data) - case TypeLanguagePackStringValuePluralized: - return UnmarshalLanguagePackStringValuePluralized(data) + case TypeLanguagePackStringValuePluralized: + return UnmarshalLanguagePackStringValuePluralized(data) - case TypeLanguagePackStringValueDeleted: - return UnmarshalLanguagePackStringValueDeleted(data) + case TypeLanguagePackStringValueDeleted: + return UnmarshalLanguagePackStringValueDeleted(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalDeviceToken(data json.RawMessage) (DeviceToken, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeDeviceTokenGoogleCloudMessaging: - return UnmarshalDeviceTokenGoogleCloudMessaging(data) + switch meta.Type { + case TypeDeviceTokenGoogleCloudMessaging: + return UnmarshalDeviceTokenGoogleCloudMessaging(data) - case TypeDeviceTokenApplePush: - return UnmarshalDeviceTokenApplePush(data) + case TypeDeviceTokenApplePush: + return UnmarshalDeviceTokenApplePush(data) - case TypeDeviceTokenApplePushVoIP: - return UnmarshalDeviceTokenApplePushVoIP(data) + case TypeDeviceTokenApplePushVoIP: + return UnmarshalDeviceTokenApplePushVoIP(data) - case TypeDeviceTokenWindowsPush: - return UnmarshalDeviceTokenWindowsPush(data) + case TypeDeviceTokenWindowsPush: + return UnmarshalDeviceTokenWindowsPush(data) - case TypeDeviceTokenMicrosoftPush: - return UnmarshalDeviceTokenMicrosoftPush(data) + case TypeDeviceTokenMicrosoftPush: + return UnmarshalDeviceTokenMicrosoftPush(data) - case TypeDeviceTokenMicrosoftPushVoIP: - return UnmarshalDeviceTokenMicrosoftPushVoIP(data) + case TypeDeviceTokenMicrosoftPushVoIP: + return UnmarshalDeviceTokenMicrosoftPushVoIP(data) - case TypeDeviceTokenWebPush: - return UnmarshalDeviceTokenWebPush(data) + case TypeDeviceTokenWebPush: + return UnmarshalDeviceTokenWebPush(data) - case TypeDeviceTokenSimplePush: - return UnmarshalDeviceTokenSimplePush(data) + case TypeDeviceTokenSimplePush: + return UnmarshalDeviceTokenSimplePush(data) - case TypeDeviceTokenUbuntuPush: - return UnmarshalDeviceTokenUbuntuPush(data) + case TypeDeviceTokenUbuntuPush: + return UnmarshalDeviceTokenUbuntuPush(data) - case TypeDeviceTokenBlackBerryPush: - return UnmarshalDeviceTokenBlackBerryPush(data) + case TypeDeviceTokenBlackBerryPush: + return UnmarshalDeviceTokenBlackBerryPush(data) - case TypeDeviceTokenTizenPush: - return UnmarshalDeviceTokenTizenPush(data) + case TypeDeviceTokenTizenPush: + return UnmarshalDeviceTokenTizenPush(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalCheckChatUsernameResult(data json.RawMessage) (CheckChatUsernameResult, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeCheckChatUsernameResultOk: - return UnmarshalCheckChatUsernameResultOk(data) + switch meta.Type { + case TypeCheckChatUsernameResultOk: + return UnmarshalCheckChatUsernameResultOk(data) - case TypeCheckChatUsernameResultUsernameInvalid: - return UnmarshalCheckChatUsernameResultUsernameInvalid(data) + case TypeCheckChatUsernameResultUsernameInvalid: + return UnmarshalCheckChatUsernameResultUsernameInvalid(data) - case TypeCheckChatUsernameResultUsernameOccupied: - return UnmarshalCheckChatUsernameResultUsernameOccupied(data) + case TypeCheckChatUsernameResultUsernameOccupied: + return UnmarshalCheckChatUsernameResultUsernameOccupied(data) - case TypeCheckChatUsernameResultPublicChatsTooMuch: - return UnmarshalCheckChatUsernameResultPublicChatsTooMuch(data) + case TypeCheckChatUsernameResultPublicChatsTooMuch: + return UnmarshalCheckChatUsernameResultPublicChatsTooMuch(data) - case TypeCheckChatUsernameResultPublicGroupsUnavailable: - return UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(data) + case TypeCheckChatUsernameResultPublicGroupsUnavailable: + return UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalOptionValue(data json.RawMessage) (OptionValue, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeOptionValueBoolean: - return UnmarshalOptionValueBoolean(data) + switch meta.Type { + case TypeOptionValueBoolean: + return UnmarshalOptionValueBoolean(data) - case TypeOptionValueEmpty: - return UnmarshalOptionValueEmpty(data) + case TypeOptionValueEmpty: + return UnmarshalOptionValueEmpty(data) - case TypeOptionValueInteger: - return UnmarshalOptionValueInteger(data) + case TypeOptionValueInteger: + return UnmarshalOptionValueInteger(data) - case TypeOptionValueString: - return UnmarshalOptionValueString(data) + case TypeOptionValueString: + return UnmarshalOptionValueString(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalUserPrivacySettingRule(data json.RawMessage) (UserPrivacySettingRule, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeUserPrivacySettingRuleAllowAll: - return UnmarshalUserPrivacySettingRuleAllowAll(data) + switch meta.Type { + case TypeUserPrivacySettingRuleAllowAll: + return UnmarshalUserPrivacySettingRuleAllowAll(data) - case TypeUserPrivacySettingRuleAllowContacts: - return UnmarshalUserPrivacySettingRuleAllowContacts(data) + case TypeUserPrivacySettingRuleAllowContacts: + return UnmarshalUserPrivacySettingRuleAllowContacts(data) - case TypeUserPrivacySettingRuleAllowUsers: - return UnmarshalUserPrivacySettingRuleAllowUsers(data) + case TypeUserPrivacySettingRuleAllowUsers: + return UnmarshalUserPrivacySettingRuleAllowUsers(data) - case TypeUserPrivacySettingRuleRestrictAll: - return UnmarshalUserPrivacySettingRuleRestrictAll(data) + case TypeUserPrivacySettingRuleRestrictAll: + return UnmarshalUserPrivacySettingRuleRestrictAll(data) - case TypeUserPrivacySettingRuleRestrictContacts: - return UnmarshalUserPrivacySettingRuleRestrictContacts(data) + case TypeUserPrivacySettingRuleRestrictContacts: + return UnmarshalUserPrivacySettingRuleRestrictContacts(data) - case TypeUserPrivacySettingRuleRestrictUsers: - return UnmarshalUserPrivacySettingRuleRestrictUsers(data) + case TypeUserPrivacySettingRuleRestrictUsers: + return UnmarshalUserPrivacySettingRuleRestrictUsers(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeUserPrivacySettingShowStatus: - return UnmarshalUserPrivacySettingShowStatus(data) + switch meta.Type { + case TypeUserPrivacySettingShowStatus: + return UnmarshalUserPrivacySettingShowStatus(data) - case TypeUserPrivacySettingAllowChatInvites: - return UnmarshalUserPrivacySettingAllowChatInvites(data) + case TypeUserPrivacySettingAllowChatInvites: + return UnmarshalUserPrivacySettingAllowChatInvites(data) - case TypeUserPrivacySettingAllowCalls: - return UnmarshalUserPrivacySettingAllowCalls(data) + case TypeUserPrivacySettingAllowCalls: + return UnmarshalUserPrivacySettingAllowCalls(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalChatReportReason(data json.RawMessage) (ChatReportReason, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeChatReportReasonSpam: - return UnmarshalChatReportReasonSpam(data) + switch meta.Type { + case TypeChatReportReasonSpam: + return UnmarshalChatReportReasonSpam(data) - case TypeChatReportReasonViolence: - return UnmarshalChatReportReasonViolence(data) + case TypeChatReportReasonViolence: + return UnmarshalChatReportReasonViolence(data) - case TypeChatReportReasonPornography: - return UnmarshalChatReportReasonPornography(data) + case TypeChatReportReasonPornography: + return UnmarshalChatReportReasonPornography(data) - case TypeChatReportReasonCopyright: - return UnmarshalChatReportReasonCopyright(data) + case TypeChatReportReasonCopyright: + return UnmarshalChatReportReasonCopyright(data) - case TypeChatReportReasonCustom: - return UnmarshalChatReportReasonCustom(data) + case TypeChatReportReasonCustom: + return UnmarshalChatReportReasonCustom(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalFileType(data json.RawMessage) (FileType, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeFileTypeNone: - return UnmarshalFileTypeNone(data) + switch meta.Type { + case TypeFileTypeNone: + return UnmarshalFileTypeNone(data) - case TypeFileTypeAnimation: - return UnmarshalFileTypeAnimation(data) + case TypeFileTypeAnimation: + return UnmarshalFileTypeAnimation(data) - case TypeFileTypeAudio: - return UnmarshalFileTypeAudio(data) + case TypeFileTypeAudio: + return UnmarshalFileTypeAudio(data) - case TypeFileTypeDocument: - return UnmarshalFileTypeDocument(data) + case TypeFileTypeDocument: + return UnmarshalFileTypeDocument(data) - case TypeFileTypePhoto: - return UnmarshalFileTypePhoto(data) + case TypeFileTypePhoto: + return UnmarshalFileTypePhoto(data) - case TypeFileTypeProfilePhoto: - return UnmarshalFileTypeProfilePhoto(data) + case TypeFileTypeProfilePhoto: + return UnmarshalFileTypeProfilePhoto(data) - case TypeFileTypeSecret: - return UnmarshalFileTypeSecret(data) + case TypeFileTypeSecret: + return UnmarshalFileTypeSecret(data) - case TypeFileTypeSecretThumbnail: - return UnmarshalFileTypeSecretThumbnail(data) + case TypeFileTypeSecretThumbnail: + return UnmarshalFileTypeSecretThumbnail(data) - case TypeFileTypeSecure: - return UnmarshalFileTypeSecure(data) + case TypeFileTypeSecure: + return UnmarshalFileTypeSecure(data) - case TypeFileTypeSticker: - return UnmarshalFileTypeSticker(data) + case TypeFileTypeSticker: + return UnmarshalFileTypeSticker(data) - case TypeFileTypeThumbnail: - return UnmarshalFileTypeThumbnail(data) + case TypeFileTypeThumbnail: + return UnmarshalFileTypeThumbnail(data) - case TypeFileTypeUnknown: - return UnmarshalFileTypeUnknown(data) + case TypeFileTypeUnknown: + return UnmarshalFileTypeUnknown(data) - case TypeFileTypeVideo: - return UnmarshalFileTypeVideo(data) + case TypeFileTypeVideo: + return UnmarshalFileTypeVideo(data) - case TypeFileTypeVideoNote: - return UnmarshalFileTypeVideoNote(data) + case TypeFileTypeVideoNote: + return UnmarshalFileTypeVideoNote(data) - case TypeFileTypeVoiceNote: - return UnmarshalFileTypeVoiceNote(data) + case TypeFileTypeVoiceNote: + return UnmarshalFileTypeVoiceNote(data) - case TypeFileTypeWallpaper: - return UnmarshalFileTypeWallpaper(data) + case TypeFileTypeWallpaper: + return UnmarshalFileTypeWallpaper(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalNetworkType(data json.RawMessage) (NetworkType, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeNetworkTypeNone: - return UnmarshalNetworkTypeNone(data) + switch meta.Type { + case TypeNetworkTypeNone: + return UnmarshalNetworkTypeNone(data) - case TypeNetworkTypeMobile: - return UnmarshalNetworkTypeMobile(data) + case TypeNetworkTypeMobile: + return UnmarshalNetworkTypeMobile(data) - case TypeNetworkTypeMobileRoaming: - return UnmarshalNetworkTypeMobileRoaming(data) + case TypeNetworkTypeMobileRoaming: + return UnmarshalNetworkTypeMobileRoaming(data) - case TypeNetworkTypeWiFi: - return UnmarshalNetworkTypeWiFi(data) + case TypeNetworkTypeWiFi: + return UnmarshalNetworkTypeWiFi(data) - case TypeNetworkTypeOther: - return UnmarshalNetworkTypeOther(data) + case TypeNetworkTypeOther: + return UnmarshalNetworkTypeOther(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalNetworkStatisticsEntry(data json.RawMessage) (NetworkStatisticsEntry, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeNetworkStatisticsEntryFile: - return UnmarshalNetworkStatisticsEntryFile(data) + switch meta.Type { + case TypeNetworkStatisticsEntryFile: + return UnmarshalNetworkStatisticsEntryFile(data) - case TypeNetworkStatisticsEntryCall: - return UnmarshalNetworkStatisticsEntryCall(data) + case TypeNetworkStatisticsEntryCall: + return UnmarshalNetworkStatisticsEntryCall(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalConnectionState(data json.RawMessage) (ConnectionState, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeConnectionStateWaitingForNetwork: - return UnmarshalConnectionStateWaitingForNetwork(data) + switch meta.Type { + case TypeConnectionStateWaitingForNetwork: + return UnmarshalConnectionStateWaitingForNetwork(data) - case TypeConnectionStateConnectingToProxy: - return UnmarshalConnectionStateConnectingToProxy(data) + case TypeConnectionStateConnectingToProxy: + return UnmarshalConnectionStateConnectingToProxy(data) - case TypeConnectionStateConnecting: - return UnmarshalConnectionStateConnecting(data) + case TypeConnectionStateConnecting: + return UnmarshalConnectionStateConnecting(data) - case TypeConnectionStateUpdating: - return UnmarshalConnectionStateUpdating(data) + case TypeConnectionStateUpdating: + return UnmarshalConnectionStateUpdating(data) - case TypeConnectionStateReady: - return UnmarshalConnectionStateReady(data) + case TypeConnectionStateReady: + return UnmarshalConnectionStateReady(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalTopChatCategory(data json.RawMessage) (TopChatCategory, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeTopChatCategoryUsers: - return UnmarshalTopChatCategoryUsers(data) + switch meta.Type { + case TypeTopChatCategoryUsers: + return UnmarshalTopChatCategoryUsers(data) - case TypeTopChatCategoryBots: - return UnmarshalTopChatCategoryBots(data) + case TypeTopChatCategoryBots: + return UnmarshalTopChatCategoryBots(data) - case TypeTopChatCategoryGroups: - return UnmarshalTopChatCategoryGroups(data) + case TypeTopChatCategoryGroups: + return UnmarshalTopChatCategoryGroups(data) - case TypeTopChatCategoryChannels: - return UnmarshalTopChatCategoryChannels(data) + case TypeTopChatCategoryChannels: + return UnmarshalTopChatCategoryChannels(data) - case TypeTopChatCategoryInlineBots: - return UnmarshalTopChatCategoryInlineBots(data) + case TypeTopChatCategoryInlineBots: + return UnmarshalTopChatCategoryInlineBots(data) - case TypeTopChatCategoryCalls: - return UnmarshalTopChatCategoryCalls(data) + case TypeTopChatCategoryCalls: + return UnmarshalTopChatCategoryCalls(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalTMeUrlType(data json.RawMessage) (TMeUrlType, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeTMeUrlTypeUser: - return UnmarshalTMeUrlTypeUser(data) + switch meta.Type { + case TypeTMeUrlTypeUser: + return UnmarshalTMeUrlTypeUser(data) - case TypeTMeUrlTypeSupergroup: - return UnmarshalTMeUrlTypeSupergroup(data) + case TypeTMeUrlTypeSupergroup: + return UnmarshalTMeUrlTypeSupergroup(data) - case TypeTMeUrlTypeChatInvite: - return UnmarshalTMeUrlTypeChatInvite(data) + case TypeTMeUrlTypeChatInvite: + return UnmarshalTMeUrlTypeChatInvite(data) - case TypeTMeUrlTypeStickerSet: - return UnmarshalTMeUrlTypeStickerSet(data) + case TypeTMeUrlTypeStickerSet: + return UnmarshalTMeUrlTypeStickerSet(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalTextParseMode(data json.RawMessage) (TextParseMode, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeTextParseModeMarkdown: - return UnmarshalTextParseModeMarkdown(data) + switch meta.Type { + case TypeTextParseModeMarkdown: + return UnmarshalTextParseModeMarkdown(data) - case TypeTextParseModeHTML: - return UnmarshalTextParseModeHTML(data) + case TypeTextParseModeHTML: + return UnmarshalTextParseModeHTML(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalProxyType(data json.RawMessage) (ProxyType, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeProxyTypeSocks5: - return UnmarshalProxyTypeSocks5(data) + switch meta.Type { + case TypeProxyTypeSocks5: + return UnmarshalProxyTypeSocks5(data) - case TypeProxyTypeHttp: - return UnmarshalProxyTypeHttp(data) + case TypeProxyTypeHttp: + return UnmarshalProxyTypeHttp(data) - case TypeProxyTypeMtproto: - return UnmarshalProxyTypeMtproto(data) + case TypeProxyTypeMtproto: + return UnmarshalProxyTypeMtproto(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalUpdate(data json.RawMessage) (Update, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeUpdateAuthorizationState: - return UnmarshalUpdateAuthorizationState(data) + switch meta.Type { + case TypeUpdateAuthorizationState: + return UnmarshalUpdateAuthorizationState(data) - case TypeUpdateNewMessage: - return UnmarshalUpdateNewMessage(data) + case TypeUpdateNewMessage: + return UnmarshalUpdateNewMessage(data) - case TypeUpdateMessageSendAcknowledged: - return UnmarshalUpdateMessageSendAcknowledged(data) + case TypeUpdateMessageSendAcknowledged: + return UnmarshalUpdateMessageSendAcknowledged(data) - case TypeUpdateMessageSendSucceeded: - return UnmarshalUpdateMessageSendSucceeded(data) + case TypeUpdateMessageSendSucceeded: + return UnmarshalUpdateMessageSendSucceeded(data) - case TypeUpdateMessageSendFailed: - return UnmarshalUpdateMessageSendFailed(data) + case TypeUpdateMessageSendFailed: + return UnmarshalUpdateMessageSendFailed(data) - case TypeUpdateMessageContent: - return UnmarshalUpdateMessageContent(data) + case TypeUpdateMessageContent: + return UnmarshalUpdateMessageContent(data) - case TypeUpdateMessageEdited: - return UnmarshalUpdateMessageEdited(data) + case TypeUpdateMessageEdited: + return UnmarshalUpdateMessageEdited(data) - case TypeUpdateMessageViews: - return UnmarshalUpdateMessageViews(data) + case TypeUpdateMessageViews: + return UnmarshalUpdateMessageViews(data) - case TypeUpdateMessageContentOpened: - return UnmarshalUpdateMessageContentOpened(data) + case TypeUpdateMessageContentOpened: + return UnmarshalUpdateMessageContentOpened(data) - case TypeUpdateMessageMentionRead: - return UnmarshalUpdateMessageMentionRead(data) + case TypeUpdateMessageMentionRead: + return UnmarshalUpdateMessageMentionRead(data) - case TypeUpdateNewChat: - return UnmarshalUpdateNewChat(data) + case TypeUpdateNewChat: + return UnmarshalUpdateNewChat(data) - case TypeUpdateChatTitle: - return UnmarshalUpdateChatTitle(data) + case TypeUpdateChatTitle: + return UnmarshalUpdateChatTitle(data) - case TypeUpdateChatPhoto: - return UnmarshalUpdateChatPhoto(data) + case TypeUpdateChatPhoto: + return UnmarshalUpdateChatPhoto(data) - case TypeUpdateChatLastMessage: - return UnmarshalUpdateChatLastMessage(data) + case TypeUpdateChatLastMessage: + return UnmarshalUpdateChatLastMessage(data) - case TypeUpdateChatOrder: - return UnmarshalUpdateChatOrder(data) + case TypeUpdateChatOrder: + return UnmarshalUpdateChatOrder(data) - case TypeUpdateChatIsPinned: - return UnmarshalUpdateChatIsPinned(data) + case TypeUpdateChatIsPinned: + return UnmarshalUpdateChatIsPinned(data) - case TypeUpdateChatIsMarkedAsUnread: - return UnmarshalUpdateChatIsMarkedAsUnread(data) + case TypeUpdateChatIsMarkedAsUnread: + return UnmarshalUpdateChatIsMarkedAsUnread(data) - case TypeUpdateChatIsSponsored: - return UnmarshalUpdateChatIsSponsored(data) + case TypeUpdateChatIsSponsored: + return UnmarshalUpdateChatIsSponsored(data) - case TypeUpdateChatDefaultDisableNotification: - return UnmarshalUpdateChatDefaultDisableNotification(data) + case TypeUpdateChatDefaultDisableNotification: + return UnmarshalUpdateChatDefaultDisableNotification(data) - case TypeUpdateChatReadInbox: - return UnmarshalUpdateChatReadInbox(data) + case TypeUpdateChatReadInbox: + return UnmarshalUpdateChatReadInbox(data) - case TypeUpdateChatReadOutbox: - return UnmarshalUpdateChatReadOutbox(data) + case TypeUpdateChatReadOutbox: + return UnmarshalUpdateChatReadOutbox(data) - case TypeUpdateChatUnreadMentionCount: - return UnmarshalUpdateChatUnreadMentionCount(data) + case TypeUpdateChatUnreadMentionCount: + return UnmarshalUpdateChatUnreadMentionCount(data) - case TypeUpdateChatNotificationSettings: - return UnmarshalUpdateChatNotificationSettings(data) + case TypeUpdateChatNotificationSettings: + return UnmarshalUpdateChatNotificationSettings(data) - case TypeUpdateScopeNotificationSettings: - return UnmarshalUpdateScopeNotificationSettings(data) + case TypeUpdateScopeNotificationSettings: + return UnmarshalUpdateScopeNotificationSettings(data) - case TypeUpdateChatReplyMarkup: - return UnmarshalUpdateChatReplyMarkup(data) + case TypeUpdateChatReplyMarkup: + return UnmarshalUpdateChatReplyMarkup(data) - case TypeUpdateChatDraftMessage: - return UnmarshalUpdateChatDraftMessage(data) + case TypeUpdateChatDraftMessage: + return UnmarshalUpdateChatDraftMessage(data) - case TypeUpdateDeleteMessages: - return UnmarshalUpdateDeleteMessages(data) + case TypeUpdateDeleteMessages: + return UnmarshalUpdateDeleteMessages(data) - case TypeUpdateUserChatAction: - return UnmarshalUpdateUserChatAction(data) + case TypeUpdateUserChatAction: + return UnmarshalUpdateUserChatAction(data) - case TypeUpdateUserStatus: - return UnmarshalUpdateUserStatus(data) + case TypeUpdateUserStatus: + return UnmarshalUpdateUserStatus(data) - case TypeUpdateUser: - return UnmarshalUpdateUser(data) + case TypeUpdateUser: + return UnmarshalUpdateUser(data) - case TypeUpdateBasicGroup: - return UnmarshalUpdateBasicGroup(data) + case TypeUpdateBasicGroup: + return UnmarshalUpdateBasicGroup(data) - case TypeUpdateSupergroup: - return UnmarshalUpdateSupergroup(data) + case TypeUpdateSupergroup: + return UnmarshalUpdateSupergroup(data) - case TypeUpdateSecretChat: - return UnmarshalUpdateSecretChat(data) + case TypeUpdateSecretChat: + return UnmarshalUpdateSecretChat(data) - case TypeUpdateUserFullInfo: - return UnmarshalUpdateUserFullInfo(data) + case TypeUpdateUserFullInfo: + return UnmarshalUpdateUserFullInfo(data) - case TypeUpdateBasicGroupFullInfo: - return UnmarshalUpdateBasicGroupFullInfo(data) + case TypeUpdateBasicGroupFullInfo: + return UnmarshalUpdateBasicGroupFullInfo(data) - case TypeUpdateSupergroupFullInfo: - return UnmarshalUpdateSupergroupFullInfo(data) + case TypeUpdateSupergroupFullInfo: + return UnmarshalUpdateSupergroupFullInfo(data) - case TypeUpdateServiceNotification: - return UnmarshalUpdateServiceNotification(data) + case TypeUpdateServiceNotification: + return UnmarshalUpdateServiceNotification(data) - case TypeUpdateFile: - return UnmarshalUpdateFile(data) + case TypeUpdateFile: + return UnmarshalUpdateFile(data) - case TypeUpdateFileGenerationStart: - return UnmarshalUpdateFileGenerationStart(data) + case TypeUpdateFileGenerationStart: + return UnmarshalUpdateFileGenerationStart(data) - case TypeUpdateFileGenerationStop: - return UnmarshalUpdateFileGenerationStop(data) + case TypeUpdateFileGenerationStop: + return UnmarshalUpdateFileGenerationStop(data) - case TypeUpdateCall: - return UnmarshalUpdateCall(data) + case TypeUpdateCall: + return UnmarshalUpdateCall(data) - case TypeUpdateUserPrivacySettingRules: - return UnmarshalUpdateUserPrivacySettingRules(data) + case TypeUpdateUserPrivacySettingRules: + return UnmarshalUpdateUserPrivacySettingRules(data) - case TypeUpdateUnreadMessageCount: - return UnmarshalUpdateUnreadMessageCount(data) + case TypeUpdateUnreadMessageCount: + return UnmarshalUpdateUnreadMessageCount(data) - case TypeUpdateUnreadChatCount: - return UnmarshalUpdateUnreadChatCount(data) + case TypeUpdateUnreadChatCount: + return UnmarshalUpdateUnreadChatCount(data) - case TypeUpdateOption: - return UnmarshalUpdateOption(data) + case TypeUpdateOption: + return UnmarshalUpdateOption(data) - case TypeUpdateInstalledStickerSets: - return UnmarshalUpdateInstalledStickerSets(data) + case TypeUpdateInstalledStickerSets: + return UnmarshalUpdateInstalledStickerSets(data) - case TypeUpdateTrendingStickerSets: - return UnmarshalUpdateTrendingStickerSets(data) + case TypeUpdateTrendingStickerSets: + return UnmarshalUpdateTrendingStickerSets(data) - case TypeUpdateRecentStickers: - return UnmarshalUpdateRecentStickers(data) + case TypeUpdateRecentStickers: + return UnmarshalUpdateRecentStickers(data) - case TypeUpdateFavoriteStickers: - return UnmarshalUpdateFavoriteStickers(data) + case TypeUpdateFavoriteStickers: + return UnmarshalUpdateFavoriteStickers(data) - case TypeUpdateSavedAnimations: - return UnmarshalUpdateSavedAnimations(data) + case TypeUpdateSavedAnimations: + return UnmarshalUpdateSavedAnimations(data) - case TypeUpdateLanguagePackStrings: - return UnmarshalUpdateLanguagePackStrings(data) + case TypeUpdateLanguagePackStrings: + return UnmarshalUpdateLanguagePackStrings(data) - case TypeUpdateConnectionState: - return UnmarshalUpdateConnectionState(data) + case TypeUpdateConnectionState: + return UnmarshalUpdateConnectionState(data) - case TypeUpdateTermsOfService: - return UnmarshalUpdateTermsOfService(data) + case TypeUpdateTermsOfService: + return UnmarshalUpdateTermsOfService(data) - case TypeUpdateNewInlineQuery: - return UnmarshalUpdateNewInlineQuery(data) + case TypeUpdateNewInlineQuery: + return UnmarshalUpdateNewInlineQuery(data) - case TypeUpdateNewChosenInlineResult: - return UnmarshalUpdateNewChosenInlineResult(data) + case TypeUpdateNewChosenInlineResult: + return UnmarshalUpdateNewChosenInlineResult(data) - case TypeUpdateNewCallbackQuery: - return UnmarshalUpdateNewCallbackQuery(data) + case TypeUpdateNewCallbackQuery: + return UnmarshalUpdateNewCallbackQuery(data) - case TypeUpdateNewInlineCallbackQuery: - return UnmarshalUpdateNewInlineCallbackQuery(data) + case TypeUpdateNewInlineCallbackQuery: + return UnmarshalUpdateNewInlineCallbackQuery(data) - case TypeUpdateNewShippingQuery: - return UnmarshalUpdateNewShippingQuery(data) + case TypeUpdateNewShippingQuery: + return UnmarshalUpdateNewShippingQuery(data) - case TypeUpdateNewPreCheckoutQuery: - return UnmarshalUpdateNewPreCheckoutQuery(data) + case TypeUpdateNewPreCheckoutQuery: + return UnmarshalUpdateNewPreCheckoutQuery(data) - case TypeUpdateNewCustomEvent: - return UnmarshalUpdateNewCustomEvent(data) + case TypeUpdateNewCustomEvent: + return UnmarshalUpdateNewCustomEvent(data) - case TypeUpdateNewCustomQuery: - return UnmarshalUpdateNewCustomQuery(data) + case TypeUpdateNewCustomQuery: + return UnmarshalUpdateNewCustomQuery(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } } func UnmarshalError(data json.RawMessage) (*Error, error) { - var resp Error + var resp Error - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalOk(data json.RawMessage) (*Ok, error) { - var resp Ok + var resp Ok - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTdlibParameters(data json.RawMessage) (*TdlibParameters, error) { - var resp TdlibParameters + var resp TdlibParameters - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthenticationCodeTypeTelegramMessage(data json.RawMessage) (*AuthenticationCodeTypeTelegramMessage, error) { - var resp AuthenticationCodeTypeTelegramMessage + var resp AuthenticationCodeTypeTelegramMessage - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthenticationCodeTypeSms(data json.RawMessage) (*AuthenticationCodeTypeSms, error) { - var resp AuthenticationCodeTypeSms + var resp AuthenticationCodeTypeSms - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthenticationCodeTypeCall(data json.RawMessage) (*AuthenticationCodeTypeCall, error) { - var resp AuthenticationCodeTypeCall + var resp AuthenticationCodeTypeCall - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthenticationCodeTypeFlashCall(data json.RawMessage) (*AuthenticationCodeTypeFlashCall, error) { - var resp AuthenticationCodeTypeFlashCall + var resp AuthenticationCodeTypeFlashCall - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthenticationCodeInfo(data json.RawMessage) (*AuthenticationCodeInfo, error) { - var resp AuthenticationCodeInfo + var resp AuthenticationCodeInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalEmailAddressAuthenticationCodeInfo(data json.RawMessage) (*EmailAddressAuthenticationCodeInfo, error) { - var resp EmailAddressAuthenticationCodeInfo + var resp EmailAddressAuthenticationCodeInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntity(data json.RawMessage) (*TextEntity, error) { - var resp TextEntity + var resp TextEntity - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntities(data json.RawMessage) (*TextEntities, error) { - var resp TextEntities + var resp TextEntities - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFormattedText(data json.RawMessage) (*FormattedText, error) { - var resp FormattedText + var resp FormattedText - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTermsOfService(data json.RawMessage) (*TermsOfService, error) { - var resp TermsOfService + var resp TermsOfService - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthorizationStateWaitTdlibParameters(data json.RawMessage) (*AuthorizationStateWaitTdlibParameters, error) { - var resp AuthorizationStateWaitTdlibParameters + var resp AuthorizationStateWaitTdlibParameters - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthorizationStateWaitEncryptionKey(data json.RawMessage) (*AuthorizationStateWaitEncryptionKey, error) { - var resp AuthorizationStateWaitEncryptionKey + var resp AuthorizationStateWaitEncryptionKey - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthorizationStateWaitPhoneNumber(data json.RawMessage) (*AuthorizationStateWaitPhoneNumber, error) { - var resp AuthorizationStateWaitPhoneNumber + var resp AuthorizationStateWaitPhoneNumber - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthorizationStateWaitCode(data json.RawMessage) (*AuthorizationStateWaitCode, error) { - var resp AuthorizationStateWaitCode + var resp AuthorizationStateWaitCode - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthorizationStateWaitPassword(data json.RawMessage) (*AuthorizationStateWaitPassword, error) { - var resp AuthorizationStateWaitPassword + var resp AuthorizationStateWaitPassword - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthorizationStateReady(data json.RawMessage) (*AuthorizationStateReady, error) { - var resp AuthorizationStateReady + var resp AuthorizationStateReady - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthorizationStateLoggingOut(data json.RawMessage) (*AuthorizationStateLoggingOut, error) { - var resp AuthorizationStateLoggingOut + var resp AuthorizationStateLoggingOut - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthorizationStateClosing(data json.RawMessage) (*AuthorizationStateClosing, error) { - var resp AuthorizationStateClosing + var resp AuthorizationStateClosing - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAuthorizationStateClosed(data json.RawMessage) (*AuthorizationStateClosed, error) { - var resp AuthorizationStateClosed + var resp AuthorizationStateClosed - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPasswordState(data json.RawMessage) (*PasswordState, error) { - var resp PasswordState + var resp PasswordState - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalRecoveryEmailAddress(data json.RawMessage) (*RecoveryEmailAddress, error) { - var resp RecoveryEmailAddress + var resp RecoveryEmailAddress - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTemporaryPasswordState(data json.RawMessage) (*TemporaryPasswordState, error) { - var resp TemporaryPasswordState + var resp TemporaryPasswordState - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLocalFile(data json.RawMessage) (*LocalFile, error) { - var resp LocalFile + var resp LocalFile - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalRemoteFile(data json.RawMessage) (*RemoteFile, error) { - var resp RemoteFile + var resp RemoteFile - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFile(data json.RawMessage) (*File, error) { - var resp File + var resp File - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputFileId(data json.RawMessage) (*InputFileId, error) { - var resp InputFileId + var resp InputFileId - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputFileRemote(data json.RawMessage) (*InputFileRemote, error) { - var resp InputFileRemote + var resp InputFileRemote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputFileLocal(data json.RawMessage) (*InputFileLocal, error) { - var resp InputFileLocal + var resp InputFileLocal - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputFileGenerated(data json.RawMessage) (*InputFileGenerated, error) { - var resp InputFileGenerated + var resp InputFileGenerated - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPhotoSize(data json.RawMessage) (*PhotoSize, error) { - var resp PhotoSize + var resp PhotoSize - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMaskPointForehead(data json.RawMessage) (*MaskPointForehead, error) { - var resp MaskPointForehead + var resp MaskPointForehead - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMaskPointEyes(data json.RawMessage) (*MaskPointEyes, error) { - var resp MaskPointEyes + var resp MaskPointEyes - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMaskPointMouth(data json.RawMessage) (*MaskPointMouth, error) { - var resp MaskPointMouth + var resp MaskPointMouth - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMaskPointChin(data json.RawMessage) (*MaskPointChin, error) { - var resp MaskPointChin + var resp MaskPointChin - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMaskPosition(data json.RawMessage) (*MaskPosition, error) { - var resp MaskPosition + var resp MaskPosition - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAnimation(data json.RawMessage) (*Animation, error) { - var resp Animation + var resp Animation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAudio(data json.RawMessage) (*Audio, error) { - var resp Audio + var resp Audio - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDocument(data json.RawMessage) (*Document, error) { - var resp Document + var resp Document - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPhoto(data json.RawMessage) (*Photo, error) { - var resp Photo + var resp Photo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSticker(data json.RawMessage) (*Sticker, error) { - var resp Sticker + var resp Sticker - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalVideo(data json.RawMessage) (*Video, error) { - var resp Video + var resp Video - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalVideoNote(data json.RawMessage) (*VideoNote, error) { - var resp VideoNote + var resp VideoNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalVoiceNote(data json.RawMessage) (*VoiceNote, error) { - var resp VoiceNote + var resp VoiceNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalContact(data json.RawMessage) (*Contact, error) { - var resp Contact + var resp Contact - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLocation(data json.RawMessage) (*Location, error) { - var resp Location + var resp Location - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalVenue(data json.RawMessage) (*Venue, error) { - var resp Venue + var resp Venue - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalGame(data json.RawMessage) (*Game, error) { - var resp Game + var resp Game - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalProfilePhoto(data json.RawMessage) (*ProfilePhoto, error) { - var resp ProfilePhoto + var resp ProfilePhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatPhoto(data json.RawMessage) (*ChatPhoto, error) { - var resp ChatPhoto + var resp ChatPhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLinkStateNone(data json.RawMessage) (*LinkStateNone, error) { - var resp LinkStateNone + var resp LinkStateNone - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLinkStateKnowsPhoneNumber(data json.RawMessage) (*LinkStateKnowsPhoneNumber, error) { - var resp LinkStateKnowsPhoneNumber + var resp LinkStateKnowsPhoneNumber - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLinkStateIsContact(data json.RawMessage) (*LinkStateIsContact, error) { - var resp LinkStateIsContact + var resp LinkStateIsContact - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserTypeRegular(data json.RawMessage) (*UserTypeRegular, error) { - var resp UserTypeRegular + var resp UserTypeRegular - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserTypeDeleted(data json.RawMessage) (*UserTypeDeleted, error) { - var resp UserTypeDeleted + var resp UserTypeDeleted - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserTypeBot(data json.RawMessage) (*UserTypeBot, error) { - var resp UserTypeBot + var resp UserTypeBot - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserTypeUnknown(data json.RawMessage) (*UserTypeUnknown, error) { - var resp UserTypeUnknown + var resp UserTypeUnknown - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalBotCommand(data json.RawMessage) (*BotCommand, error) { - var resp BotCommand + var resp BotCommand - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalBotInfo(data json.RawMessage) (*BotInfo, error) { - var resp BotInfo + var resp BotInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUser(data json.RawMessage) (*User, error) { - var resp User + var resp User - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserFullInfo(data json.RawMessage) (*UserFullInfo, error) { - var resp UserFullInfo + var resp UserFullInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserProfilePhotos(data json.RawMessage) (*UserProfilePhotos, error) { - var resp UserProfilePhotos + var resp UserProfilePhotos - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUsers(data json.RawMessage) (*Users, error) { - var resp Users + var resp Users - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMemberStatusCreator(data json.RawMessage) (*ChatMemberStatusCreator, error) { - var resp ChatMemberStatusCreator + var resp ChatMemberStatusCreator - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMemberStatusAdministrator(data json.RawMessage) (*ChatMemberStatusAdministrator, error) { - var resp ChatMemberStatusAdministrator + var resp ChatMemberStatusAdministrator - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMemberStatusMember(data json.RawMessage) (*ChatMemberStatusMember, error) { - var resp ChatMemberStatusMember + var resp ChatMemberStatusMember - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMemberStatusRestricted(data json.RawMessage) (*ChatMemberStatusRestricted, error) { - var resp ChatMemberStatusRestricted + var resp ChatMemberStatusRestricted - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMemberStatusLeft(data json.RawMessage) (*ChatMemberStatusLeft, error) { - var resp ChatMemberStatusLeft + var resp ChatMemberStatusLeft - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMemberStatusBanned(data json.RawMessage) (*ChatMemberStatusBanned, error) { - var resp ChatMemberStatusBanned + var resp ChatMemberStatusBanned - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMember(data json.RawMessage) (*ChatMember, error) { - var resp ChatMember + var resp ChatMember - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMembers(data json.RawMessage) (*ChatMembers, error) { - var resp ChatMembers + var resp ChatMembers - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMembersFilterAdministrators(data json.RawMessage) (*ChatMembersFilterAdministrators, error) { - var resp ChatMembersFilterAdministrators + var resp ChatMembersFilterAdministrators - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMembersFilterMembers(data json.RawMessage) (*ChatMembersFilterMembers, error) { - var resp ChatMembersFilterMembers + var resp ChatMembersFilterMembers - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMembersFilterRestricted(data json.RawMessage) (*ChatMembersFilterRestricted, error) { - var resp ChatMembersFilterRestricted + var resp ChatMembersFilterRestricted - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMembersFilterBanned(data json.RawMessage) (*ChatMembersFilterBanned, error) { - var resp ChatMembersFilterBanned + var resp ChatMembersFilterBanned - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatMembersFilterBots(data json.RawMessage) (*ChatMembersFilterBots, error) { - var resp ChatMembersFilterBots + var resp ChatMembersFilterBots - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSupergroupMembersFilterRecent(data json.RawMessage) (*SupergroupMembersFilterRecent, error) { - var resp SupergroupMembersFilterRecent + var resp SupergroupMembersFilterRecent - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSupergroupMembersFilterAdministrators(data json.RawMessage) (*SupergroupMembersFilterAdministrators, error) { - var resp SupergroupMembersFilterAdministrators + var resp SupergroupMembersFilterAdministrators - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSupergroupMembersFilterSearch(data json.RawMessage) (*SupergroupMembersFilterSearch, error) { - var resp SupergroupMembersFilterSearch + var resp SupergroupMembersFilterSearch - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSupergroupMembersFilterRestricted(data json.RawMessage) (*SupergroupMembersFilterRestricted, error) { - var resp SupergroupMembersFilterRestricted + var resp SupergroupMembersFilterRestricted - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSupergroupMembersFilterBanned(data json.RawMessage) (*SupergroupMembersFilterBanned, error) { - var resp SupergroupMembersFilterBanned + var resp SupergroupMembersFilterBanned - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSupergroupMembersFilterBots(data json.RawMessage) (*SupergroupMembersFilterBots, error) { - var resp SupergroupMembersFilterBots + var resp SupergroupMembersFilterBots - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalBasicGroup(data json.RawMessage) (*BasicGroup, error) { - var resp BasicGroup + var resp BasicGroup - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalBasicGroupFullInfo(data json.RawMessage) (*BasicGroupFullInfo, error) { - var resp BasicGroupFullInfo + var resp BasicGroupFullInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSupergroup(data json.RawMessage) (*Supergroup, error) { - var resp Supergroup + var resp Supergroup - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSupergroupFullInfo(data json.RawMessage) (*SupergroupFullInfo, error) { - var resp SupergroupFullInfo + var resp SupergroupFullInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSecretChatStatePending(data json.RawMessage) (*SecretChatStatePending, error) { - var resp SecretChatStatePending + var resp SecretChatStatePending - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSecretChatStateReady(data json.RawMessage) (*SecretChatStateReady, error) { - var resp SecretChatStateReady + var resp SecretChatStateReady - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSecretChatStateClosed(data json.RawMessage) (*SecretChatStateClosed, error) { - var resp SecretChatStateClosed + var resp SecretChatStateClosed - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSecretChat(data json.RawMessage) (*SecretChat, error) { - var resp SecretChat + var resp SecretChat - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageForwardedFromUser(data json.RawMessage) (*MessageForwardedFromUser, error) { - var resp MessageForwardedFromUser + var resp MessageForwardedFromUser - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageForwardedPost(data json.RawMessage) (*MessageForwardedPost, error) { - var resp MessageForwardedPost + var resp MessageForwardedPost - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageSendingStatePending(data json.RawMessage) (*MessageSendingStatePending, error) { - var resp MessageSendingStatePending + var resp MessageSendingStatePending - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageSendingStateFailed(data json.RawMessage) (*MessageSendingStateFailed, error) { - var resp MessageSendingStateFailed + var resp MessageSendingStateFailed - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessage(data json.RawMessage) (*Message, error) { - var resp Message + var resp Message - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessages(data json.RawMessage) (*Messages, error) { - var resp Messages + var resp Messages - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFoundMessages(data json.RawMessage) (*FoundMessages, error) { - var resp FoundMessages + var resp FoundMessages - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalNotificationSettingsScopePrivateChats(data json.RawMessage) (*NotificationSettingsScopePrivateChats, error) { - var resp NotificationSettingsScopePrivateChats + var resp NotificationSettingsScopePrivateChats - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalNotificationSettingsScopeGroupChats(data json.RawMessage) (*NotificationSettingsScopeGroupChats, error) { - var resp NotificationSettingsScopeGroupChats + var resp NotificationSettingsScopeGroupChats - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatNotificationSettings(data json.RawMessage) (*ChatNotificationSettings, error) { - var resp ChatNotificationSettings + var resp ChatNotificationSettings - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalScopeNotificationSettings(data json.RawMessage) (*ScopeNotificationSettings, error) { - var resp ScopeNotificationSettings + var resp ScopeNotificationSettings - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDraftMessage(data json.RawMessage) (*DraftMessage, error) { - var resp DraftMessage + var resp DraftMessage - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatTypePrivate(data json.RawMessage) (*ChatTypePrivate, error) { - var resp ChatTypePrivate + var resp ChatTypePrivate - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatTypeBasicGroup(data json.RawMessage) (*ChatTypeBasicGroup, error) { - var resp ChatTypeBasicGroup + var resp ChatTypeBasicGroup - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatTypeSupergroup(data json.RawMessage) (*ChatTypeSupergroup, error) { - var resp ChatTypeSupergroup + var resp ChatTypeSupergroup - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatTypeSecret(data json.RawMessage) (*ChatTypeSecret, error) { - var resp ChatTypeSecret + var resp ChatTypeSecret - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChat(data json.RawMessage) (*Chat, error) { - var resp Chat + var resp Chat - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChats(data json.RawMessage) (*Chats, error) { - var resp Chats + var resp Chats - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatInviteLink(data json.RawMessage) (*ChatInviteLink, error) { - var resp ChatInviteLink + var resp ChatInviteLink - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatInviteLinkInfo(data json.RawMessage) (*ChatInviteLinkInfo, error) { - var resp ChatInviteLinkInfo + var resp ChatInviteLinkInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalKeyboardButtonTypeText(data json.RawMessage) (*KeyboardButtonTypeText, error) { - var resp KeyboardButtonTypeText + var resp KeyboardButtonTypeText - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalKeyboardButtonTypeRequestPhoneNumber(data json.RawMessage) (*KeyboardButtonTypeRequestPhoneNumber, error) { - var resp KeyboardButtonTypeRequestPhoneNumber + var resp KeyboardButtonTypeRequestPhoneNumber - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalKeyboardButtonTypeRequestLocation(data json.RawMessage) (*KeyboardButtonTypeRequestLocation, error) { - var resp KeyboardButtonTypeRequestLocation + var resp KeyboardButtonTypeRequestLocation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalKeyboardButton(data json.RawMessage) (*KeyboardButton, error) { - var resp KeyboardButton + var resp KeyboardButton - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineKeyboardButtonTypeUrl(data json.RawMessage) (*InlineKeyboardButtonTypeUrl, error) { - var resp InlineKeyboardButtonTypeUrl + var resp InlineKeyboardButtonTypeUrl - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineKeyboardButtonTypeCallback(data json.RawMessage) (*InlineKeyboardButtonTypeCallback, error) { - var resp InlineKeyboardButtonTypeCallback + var resp InlineKeyboardButtonTypeCallback - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineKeyboardButtonTypeCallbackGame(data json.RawMessage) (*InlineKeyboardButtonTypeCallbackGame, error) { - var resp InlineKeyboardButtonTypeCallbackGame + var resp InlineKeyboardButtonTypeCallbackGame - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineKeyboardButtonTypeSwitchInline(data json.RawMessage) (*InlineKeyboardButtonTypeSwitchInline, error) { - var resp InlineKeyboardButtonTypeSwitchInline + var resp InlineKeyboardButtonTypeSwitchInline - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineKeyboardButtonTypeBuy(data json.RawMessage) (*InlineKeyboardButtonTypeBuy, error) { - var resp InlineKeyboardButtonTypeBuy + var resp InlineKeyboardButtonTypeBuy - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineKeyboardButton(data json.RawMessage) (*InlineKeyboardButton, error) { - var resp InlineKeyboardButton + var resp InlineKeyboardButton - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalReplyMarkupRemoveKeyboard(data json.RawMessage) (*ReplyMarkupRemoveKeyboard, error) { - var resp ReplyMarkupRemoveKeyboard + var resp ReplyMarkupRemoveKeyboard - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalReplyMarkupForceReply(data json.RawMessage) (*ReplyMarkupForceReply, error) { - var resp ReplyMarkupForceReply + var resp ReplyMarkupForceReply - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalReplyMarkupShowKeyboard(data json.RawMessage) (*ReplyMarkupShowKeyboard, error) { - var resp ReplyMarkupShowKeyboard + var resp ReplyMarkupShowKeyboard - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalReplyMarkupInlineKeyboard(data json.RawMessage) (*ReplyMarkupInlineKeyboard, error) { - var resp ReplyMarkupInlineKeyboard + var resp ReplyMarkupInlineKeyboard - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalRichTextPlain(data json.RawMessage) (*RichTextPlain, error) { - var resp RichTextPlain + var resp RichTextPlain - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalRichTextBold(data json.RawMessage) (*RichTextBold, error) { - var resp RichTextBold + var resp RichTextBold - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalRichTextItalic(data json.RawMessage) (*RichTextItalic, error) { - var resp RichTextItalic + var resp RichTextItalic - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalRichTextUnderline(data json.RawMessage) (*RichTextUnderline, error) { - var resp RichTextUnderline + var resp RichTextUnderline - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalRichTextStrikethrough(data json.RawMessage) (*RichTextStrikethrough, error) { - var resp RichTextStrikethrough + var resp RichTextStrikethrough - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalRichTextFixed(data json.RawMessage) (*RichTextFixed, error) { - var resp RichTextFixed + var resp RichTextFixed - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalRichTextUrl(data json.RawMessage) (*RichTextUrl, error) { - var resp RichTextUrl + var resp RichTextUrl - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalRichTextEmailAddress(data json.RawMessage) (*RichTextEmailAddress, error) { - var resp RichTextEmailAddress + var resp RichTextEmailAddress - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalRichTexts(data json.RawMessage) (*RichTexts, error) { - var resp RichTexts + var resp RichTexts - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockTitle(data json.RawMessage) (*PageBlockTitle, error) { - var resp PageBlockTitle + var resp PageBlockTitle - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockSubtitle(data json.RawMessage) (*PageBlockSubtitle, error) { - var resp PageBlockSubtitle + var resp PageBlockSubtitle - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockAuthorDate(data json.RawMessage) (*PageBlockAuthorDate, error) { - var resp PageBlockAuthorDate + var resp PageBlockAuthorDate - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockHeader(data json.RawMessage) (*PageBlockHeader, error) { - var resp PageBlockHeader + var resp PageBlockHeader - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockSubheader(data json.RawMessage) (*PageBlockSubheader, error) { - var resp PageBlockSubheader + var resp PageBlockSubheader - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockParagraph(data json.RawMessage) (*PageBlockParagraph, error) { - var resp PageBlockParagraph + var resp PageBlockParagraph - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockPreformatted(data json.RawMessage) (*PageBlockPreformatted, error) { - var resp PageBlockPreformatted + var resp PageBlockPreformatted - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockFooter(data json.RawMessage) (*PageBlockFooter, error) { - var resp PageBlockFooter + var resp PageBlockFooter - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockDivider(data json.RawMessage) (*PageBlockDivider, error) { - var resp PageBlockDivider + var resp PageBlockDivider - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockAnchor(data json.RawMessage) (*PageBlockAnchor, error) { - var resp PageBlockAnchor + var resp PageBlockAnchor - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockList(data json.RawMessage) (*PageBlockList, error) { - var resp PageBlockList + var resp PageBlockList - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockBlockQuote(data json.RawMessage) (*PageBlockBlockQuote, error) { - var resp PageBlockBlockQuote + var resp PageBlockBlockQuote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockPullQuote(data json.RawMessage) (*PageBlockPullQuote, error) { - var resp PageBlockPullQuote + var resp PageBlockPullQuote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockAnimation(data json.RawMessage) (*PageBlockAnimation, error) { - var resp PageBlockAnimation + var resp PageBlockAnimation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockAudio(data json.RawMessage) (*PageBlockAudio, error) { - var resp PageBlockAudio + var resp PageBlockAudio - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockPhoto(data json.RawMessage) (*PageBlockPhoto, error) { - var resp PageBlockPhoto + var resp PageBlockPhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockVideo(data json.RawMessage) (*PageBlockVideo, error) { - var resp PageBlockVideo + var resp PageBlockVideo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockCover(data json.RawMessage) (*PageBlockCover, error) { - var resp PageBlockCover + var resp PageBlockCover - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockEmbedded(data json.RawMessage) (*PageBlockEmbedded, error) { - var resp PageBlockEmbedded + var resp PageBlockEmbedded - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockEmbeddedPost(data json.RawMessage) (*PageBlockEmbeddedPost, error) { - var resp PageBlockEmbeddedPost + var resp PageBlockEmbeddedPost - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockCollage(data json.RawMessage) (*PageBlockCollage, error) { - var resp PageBlockCollage + var resp PageBlockCollage - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockSlideshow(data json.RawMessage) (*PageBlockSlideshow, error) { - var resp PageBlockSlideshow + var resp PageBlockSlideshow - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPageBlockChatLink(data json.RawMessage) (*PageBlockChatLink, error) { - var resp PageBlockChatLink + var resp PageBlockChatLink - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalWebPageInstantView(data json.RawMessage) (*WebPageInstantView, error) { - var resp WebPageInstantView + var resp WebPageInstantView - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalWebPage(data json.RawMessage) (*WebPage, error) { - var resp WebPage + var resp WebPage - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAddress(data json.RawMessage) (*Address, error) { - var resp Address + var resp Address - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLabeledPricePart(data json.RawMessage) (*LabeledPricePart, error) { - var resp LabeledPricePart + var resp LabeledPricePart - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInvoice(data json.RawMessage) (*Invoice, error) { - var resp Invoice + var resp Invoice - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalOrderInfo(data json.RawMessage) (*OrderInfo, error) { - var resp OrderInfo + var resp OrderInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalShippingOption(data json.RawMessage) (*ShippingOption, error) { - var resp ShippingOption + var resp ShippingOption - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSavedCredentials(data json.RawMessage) (*SavedCredentials, error) { - var resp SavedCredentials + var resp SavedCredentials - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputCredentialsSaved(data json.RawMessage) (*InputCredentialsSaved, error) { - var resp InputCredentialsSaved + var resp InputCredentialsSaved - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputCredentialsNew(data json.RawMessage) (*InputCredentialsNew, error) { - var resp InputCredentialsNew + var resp InputCredentialsNew - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputCredentialsAndroidPay(data json.RawMessage) (*InputCredentialsAndroidPay, error) { - var resp InputCredentialsAndroidPay + var resp InputCredentialsAndroidPay - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputCredentialsApplePay(data json.RawMessage) (*InputCredentialsApplePay, error) { - var resp InputCredentialsApplePay + var resp InputCredentialsApplePay - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPaymentsProviderStripe(data json.RawMessage) (*PaymentsProviderStripe, error) { - var resp PaymentsProviderStripe + var resp PaymentsProviderStripe - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPaymentForm(data json.RawMessage) (*PaymentForm, error) { - var resp PaymentForm + var resp PaymentForm - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalValidatedOrderInfo(data json.RawMessage) (*ValidatedOrderInfo, error) { - var resp ValidatedOrderInfo + var resp ValidatedOrderInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPaymentResult(data json.RawMessage) (*PaymentResult, error) { - var resp PaymentResult + var resp PaymentResult - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPaymentReceipt(data json.RawMessage) (*PaymentReceipt, error) { - var resp PaymentReceipt + var resp PaymentReceipt - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDatedFile(data json.RawMessage) (*DatedFile, error) { - var resp DatedFile + var resp DatedFile - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypePersonalDetails(data json.RawMessage) (*PassportElementTypePersonalDetails, error) { - var resp PassportElementTypePersonalDetails + var resp PassportElementTypePersonalDetails - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypePassport(data json.RawMessage) (*PassportElementTypePassport, error) { - var resp PassportElementTypePassport + var resp PassportElementTypePassport - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypeDriverLicense(data json.RawMessage) (*PassportElementTypeDriverLicense, error) { - var resp PassportElementTypeDriverLicense + var resp PassportElementTypeDriverLicense - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypeIdentityCard(data json.RawMessage) (*PassportElementTypeIdentityCard, error) { - var resp PassportElementTypeIdentityCard + var resp PassportElementTypeIdentityCard - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypeInternalPassport(data json.RawMessage) (*PassportElementTypeInternalPassport, error) { - var resp PassportElementTypeInternalPassport + var resp PassportElementTypeInternalPassport - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypeAddress(data json.RawMessage) (*PassportElementTypeAddress, error) { - var resp PassportElementTypeAddress + var resp PassportElementTypeAddress - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypeUtilityBill(data json.RawMessage) (*PassportElementTypeUtilityBill, error) { - var resp PassportElementTypeUtilityBill + var resp PassportElementTypeUtilityBill - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypeBankStatement(data json.RawMessage) (*PassportElementTypeBankStatement, error) { - var resp PassportElementTypeBankStatement + var resp PassportElementTypeBankStatement - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypeRentalAgreement(data json.RawMessage) (*PassportElementTypeRentalAgreement, error) { - var resp PassportElementTypeRentalAgreement + var resp PassportElementTypeRentalAgreement - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypePassportRegistration(data json.RawMessage) (*PassportElementTypePassportRegistration, error) { - var resp PassportElementTypePassportRegistration + var resp PassportElementTypePassportRegistration - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypeTemporaryRegistration(data json.RawMessage) (*PassportElementTypeTemporaryRegistration, error) { - var resp PassportElementTypeTemporaryRegistration + var resp PassportElementTypeTemporaryRegistration - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypePhoneNumber(data json.RawMessage) (*PassportElementTypePhoneNumber, error) { - var resp PassportElementTypePhoneNumber + var resp PassportElementTypePhoneNumber - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTypeEmailAddress(data json.RawMessage) (*PassportElementTypeEmailAddress, error) { - var resp PassportElementTypeEmailAddress + var resp PassportElementTypeEmailAddress - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDate(data json.RawMessage) (*Date, error) { - var resp Date + var resp Date - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPersonalDetails(data json.RawMessage) (*PersonalDetails, error) { - var resp PersonalDetails + var resp PersonalDetails - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalIdentityDocument(data json.RawMessage) (*IdentityDocument, error) { - var resp IdentityDocument + var resp IdentityDocument - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputIdentityDocument(data json.RawMessage) (*InputIdentityDocument, error) { - var resp InputIdentityDocument + var resp InputIdentityDocument - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPersonalDocument(data json.RawMessage) (*PersonalDocument, error) { - var resp PersonalDocument + var resp PersonalDocument - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPersonalDocument(data json.RawMessage) (*InputPersonalDocument, error) { - var resp InputPersonalDocument + var resp InputPersonalDocument - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementPersonalDetails(data json.RawMessage) (*PassportElementPersonalDetails, error) { - var resp PassportElementPersonalDetails + var resp PassportElementPersonalDetails - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementPassport(data json.RawMessage) (*PassportElementPassport, error) { - var resp PassportElementPassport + var resp PassportElementPassport - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementDriverLicense(data json.RawMessage) (*PassportElementDriverLicense, error) { - var resp PassportElementDriverLicense + var resp PassportElementDriverLicense - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementIdentityCard(data json.RawMessage) (*PassportElementIdentityCard, error) { - var resp PassportElementIdentityCard + var resp PassportElementIdentityCard - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementInternalPassport(data json.RawMessage) (*PassportElementInternalPassport, error) { - var resp PassportElementInternalPassport + var resp PassportElementInternalPassport - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementAddress(data json.RawMessage) (*PassportElementAddress, error) { - var resp PassportElementAddress + var resp PassportElementAddress - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementUtilityBill(data json.RawMessage) (*PassportElementUtilityBill, error) { - var resp PassportElementUtilityBill + var resp PassportElementUtilityBill - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementBankStatement(data json.RawMessage) (*PassportElementBankStatement, error) { - var resp PassportElementBankStatement + var resp PassportElementBankStatement - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementRentalAgreement(data json.RawMessage) (*PassportElementRentalAgreement, error) { - var resp PassportElementRentalAgreement + var resp PassportElementRentalAgreement - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementPassportRegistration(data json.RawMessage) (*PassportElementPassportRegistration, error) { - var resp PassportElementPassportRegistration + var resp PassportElementPassportRegistration - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementTemporaryRegistration(data json.RawMessage) (*PassportElementTemporaryRegistration, error) { - var resp PassportElementTemporaryRegistration + var resp PassportElementTemporaryRegistration - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementPhoneNumber(data json.RawMessage) (*PassportElementPhoneNumber, error) { - var resp PassportElementPhoneNumber + var resp PassportElementPhoneNumber - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementEmailAddress(data json.RawMessage) (*PassportElementEmailAddress, error) { - var resp PassportElementEmailAddress + var resp PassportElementEmailAddress - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementPersonalDetails(data json.RawMessage) (*InputPassportElementPersonalDetails, error) { - var resp InputPassportElementPersonalDetails + var resp InputPassportElementPersonalDetails - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementPassport(data json.RawMessage) (*InputPassportElementPassport, error) { - var resp InputPassportElementPassport + var resp InputPassportElementPassport - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementDriverLicense(data json.RawMessage) (*InputPassportElementDriverLicense, error) { - var resp InputPassportElementDriverLicense + var resp InputPassportElementDriverLicense - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementIdentityCard(data json.RawMessage) (*InputPassportElementIdentityCard, error) { - var resp InputPassportElementIdentityCard + var resp InputPassportElementIdentityCard - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementInternalPassport(data json.RawMessage) (*InputPassportElementInternalPassport, error) { - var resp InputPassportElementInternalPassport + var resp InputPassportElementInternalPassport - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementAddress(data json.RawMessage) (*InputPassportElementAddress, error) { - var resp InputPassportElementAddress + var resp InputPassportElementAddress - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementUtilityBill(data json.RawMessage) (*InputPassportElementUtilityBill, error) { - var resp InputPassportElementUtilityBill + var resp InputPassportElementUtilityBill - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementBankStatement(data json.RawMessage) (*InputPassportElementBankStatement, error) { - var resp InputPassportElementBankStatement + var resp InputPassportElementBankStatement - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementRentalAgreement(data json.RawMessage) (*InputPassportElementRentalAgreement, error) { - var resp InputPassportElementRentalAgreement + var resp InputPassportElementRentalAgreement - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementPassportRegistration(data json.RawMessage) (*InputPassportElementPassportRegistration, error) { - var resp InputPassportElementPassportRegistration + var resp InputPassportElementPassportRegistration - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementTemporaryRegistration(data json.RawMessage) (*InputPassportElementTemporaryRegistration, error) { - var resp InputPassportElementTemporaryRegistration + var resp InputPassportElementTemporaryRegistration - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementPhoneNumber(data json.RawMessage) (*InputPassportElementPhoneNumber, error) { - var resp InputPassportElementPhoneNumber + var resp InputPassportElementPhoneNumber - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementEmailAddress(data json.RawMessage) (*InputPassportElementEmailAddress, error) { - var resp InputPassportElementEmailAddress + var resp InputPassportElementEmailAddress - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElements(data json.RawMessage) (*PassportElements, error) { - var resp PassportElements + var resp PassportElements - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementErrorSourceUnspecified(data json.RawMessage) (*PassportElementErrorSourceUnspecified, error) { - var resp PassportElementErrorSourceUnspecified + var resp PassportElementErrorSourceUnspecified - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementErrorSourceDataField(data json.RawMessage) (*PassportElementErrorSourceDataField, error) { - var resp PassportElementErrorSourceDataField + var resp PassportElementErrorSourceDataField - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementErrorSourceFrontSide(data json.RawMessage) (*PassportElementErrorSourceFrontSide, error) { - var resp PassportElementErrorSourceFrontSide + var resp PassportElementErrorSourceFrontSide - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementErrorSourceReverseSide(data json.RawMessage) (*PassportElementErrorSourceReverseSide, error) { - var resp PassportElementErrorSourceReverseSide + var resp PassportElementErrorSourceReverseSide - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementErrorSourceSelfie(data json.RawMessage) (*PassportElementErrorSourceSelfie, error) { - var resp PassportElementErrorSourceSelfie + var resp PassportElementErrorSourceSelfie - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementErrorSourceTranslationFile(data json.RawMessage) (*PassportElementErrorSourceTranslationFile, error) { - var resp PassportElementErrorSourceTranslationFile + var resp PassportElementErrorSourceTranslationFile - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementErrorSourceTranslationFiles(data json.RawMessage) (*PassportElementErrorSourceTranslationFiles, error) { - var resp PassportElementErrorSourceTranslationFiles + var resp PassportElementErrorSourceTranslationFiles - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementErrorSourceFile(data json.RawMessage) (*PassportElementErrorSourceFile, error) { - var resp PassportElementErrorSourceFile + var resp PassportElementErrorSourceFile - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementErrorSourceFiles(data json.RawMessage) (*PassportElementErrorSourceFiles, error) { - var resp PassportElementErrorSourceFiles + var resp PassportElementErrorSourceFiles - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportElementError(data json.RawMessage) (*PassportElementError, error) { - var resp PassportElementError + var resp PassportElementError - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportSuitableElement(data json.RawMessage) (*PassportSuitableElement, error) { - var resp PassportSuitableElement + var resp PassportSuitableElement - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportRequiredElement(data json.RawMessage) (*PassportRequiredElement, error) { - var resp PassportRequiredElement + var resp PassportRequiredElement - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPassportAuthorizationForm(data json.RawMessage) (*PassportAuthorizationForm, error) { - var resp PassportAuthorizationForm + var resp PassportAuthorizationForm - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalEncryptedCredentials(data json.RawMessage) (*EncryptedCredentials, error) { - var resp EncryptedCredentials + var resp EncryptedCredentials - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalEncryptedPassportElement(data json.RawMessage) (*EncryptedPassportElement, error) { - var resp EncryptedPassportElement + var resp EncryptedPassportElement - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementErrorSourceUnspecified(data json.RawMessage) (*InputPassportElementErrorSourceUnspecified, error) { - var resp InputPassportElementErrorSourceUnspecified + var resp InputPassportElementErrorSourceUnspecified - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementErrorSourceDataField(data json.RawMessage) (*InputPassportElementErrorSourceDataField, error) { - var resp InputPassportElementErrorSourceDataField + var resp InputPassportElementErrorSourceDataField - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementErrorSourceFrontSide(data json.RawMessage) (*InputPassportElementErrorSourceFrontSide, error) { - var resp InputPassportElementErrorSourceFrontSide + var resp InputPassportElementErrorSourceFrontSide - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementErrorSourceReverseSide(data json.RawMessage) (*InputPassportElementErrorSourceReverseSide, error) { - var resp InputPassportElementErrorSourceReverseSide + var resp InputPassportElementErrorSourceReverseSide - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementErrorSourceSelfie(data json.RawMessage) (*InputPassportElementErrorSourceSelfie, error) { - var resp InputPassportElementErrorSourceSelfie + var resp InputPassportElementErrorSourceSelfie - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementErrorSourceTranslationFile(data json.RawMessage) (*InputPassportElementErrorSourceTranslationFile, error) { - var resp InputPassportElementErrorSourceTranslationFile + var resp InputPassportElementErrorSourceTranslationFile - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementErrorSourceTranslationFiles(data json.RawMessage) (*InputPassportElementErrorSourceTranslationFiles, error) { - var resp InputPassportElementErrorSourceTranslationFiles + var resp InputPassportElementErrorSourceTranslationFiles - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementErrorSourceFile(data json.RawMessage) (*InputPassportElementErrorSourceFile, error) { - var resp InputPassportElementErrorSourceFile + var resp InputPassportElementErrorSourceFile - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementErrorSourceFiles(data json.RawMessage) (*InputPassportElementErrorSourceFiles, error) { - var resp InputPassportElementErrorSourceFiles + var resp InputPassportElementErrorSourceFiles - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputPassportElementError(data json.RawMessage) (*InputPassportElementError, error) { - var resp InputPassportElementError + var resp InputPassportElementError - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageText(data json.RawMessage) (*MessageText, error) { - var resp MessageText + var resp MessageText - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageAnimation(data json.RawMessage) (*MessageAnimation, error) { - var resp MessageAnimation + var resp MessageAnimation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageAudio(data json.RawMessage) (*MessageAudio, error) { - var resp MessageAudio + var resp MessageAudio - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageDocument(data json.RawMessage) (*MessageDocument, error) { - var resp MessageDocument + var resp MessageDocument - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessagePhoto(data json.RawMessage) (*MessagePhoto, error) { - var resp MessagePhoto + var resp MessagePhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageExpiredPhoto(data json.RawMessage) (*MessageExpiredPhoto, error) { - var resp MessageExpiredPhoto + var resp MessageExpiredPhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageSticker(data json.RawMessage) (*MessageSticker, error) { - var resp MessageSticker + var resp MessageSticker - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageVideo(data json.RawMessage) (*MessageVideo, error) { - var resp MessageVideo + var resp MessageVideo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageExpiredVideo(data json.RawMessage) (*MessageExpiredVideo, error) { - var resp MessageExpiredVideo + var resp MessageExpiredVideo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageVideoNote(data json.RawMessage) (*MessageVideoNote, error) { - var resp MessageVideoNote + var resp MessageVideoNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageVoiceNote(data json.RawMessage) (*MessageVoiceNote, error) { - var resp MessageVoiceNote + var resp MessageVoiceNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageLocation(data json.RawMessage) (*MessageLocation, error) { - var resp MessageLocation + var resp MessageLocation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageVenue(data json.RawMessage) (*MessageVenue, error) { - var resp MessageVenue + var resp MessageVenue - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageContact(data json.RawMessage) (*MessageContact, error) { - var resp MessageContact + var resp MessageContact - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageGame(data json.RawMessage) (*MessageGame, error) { - var resp MessageGame + var resp MessageGame - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageInvoice(data json.RawMessage) (*MessageInvoice, error) { - var resp MessageInvoice + var resp MessageInvoice - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageCall(data json.RawMessage) (*MessageCall, error) { - var resp MessageCall + var resp MessageCall - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageBasicGroupChatCreate(data json.RawMessage) (*MessageBasicGroupChatCreate, error) { - var resp MessageBasicGroupChatCreate + var resp MessageBasicGroupChatCreate - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageSupergroupChatCreate(data json.RawMessage) (*MessageSupergroupChatCreate, error) { - var resp MessageSupergroupChatCreate + var resp MessageSupergroupChatCreate - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageChatChangeTitle(data json.RawMessage) (*MessageChatChangeTitle, error) { - var resp MessageChatChangeTitle + var resp MessageChatChangeTitle - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageChatChangePhoto(data json.RawMessage) (*MessageChatChangePhoto, error) { - var resp MessageChatChangePhoto + var resp MessageChatChangePhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageChatDeletePhoto(data json.RawMessage) (*MessageChatDeletePhoto, error) { - var resp MessageChatDeletePhoto + var resp MessageChatDeletePhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageChatAddMembers(data json.RawMessage) (*MessageChatAddMembers, error) { - var resp MessageChatAddMembers + var resp MessageChatAddMembers - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageChatJoinByLink(data json.RawMessage) (*MessageChatJoinByLink, error) { - var resp MessageChatJoinByLink + var resp MessageChatJoinByLink - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageChatDeleteMember(data json.RawMessage) (*MessageChatDeleteMember, error) { - var resp MessageChatDeleteMember + var resp MessageChatDeleteMember - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageChatUpgradeTo(data json.RawMessage) (*MessageChatUpgradeTo, error) { - var resp MessageChatUpgradeTo + var resp MessageChatUpgradeTo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageChatUpgradeFrom(data json.RawMessage) (*MessageChatUpgradeFrom, error) { - var resp MessageChatUpgradeFrom + var resp MessageChatUpgradeFrom - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessagePinMessage(data json.RawMessage) (*MessagePinMessage, error) { - var resp MessagePinMessage + var resp MessagePinMessage - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageScreenshotTaken(data json.RawMessage) (*MessageScreenshotTaken, error) { - var resp MessageScreenshotTaken + var resp MessageScreenshotTaken - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageChatSetTtl(data json.RawMessage) (*MessageChatSetTtl, error) { - var resp MessageChatSetTtl + var resp MessageChatSetTtl - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageCustomServiceAction(data json.RawMessage) (*MessageCustomServiceAction, error) { - var resp MessageCustomServiceAction + var resp MessageCustomServiceAction - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageGameScore(data json.RawMessage) (*MessageGameScore, error) { - var resp MessageGameScore + var resp MessageGameScore - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessagePaymentSuccessful(data json.RawMessage) (*MessagePaymentSuccessful, error) { - var resp MessagePaymentSuccessful + var resp MessagePaymentSuccessful - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessagePaymentSuccessfulBot(data json.RawMessage) (*MessagePaymentSuccessfulBot, error) { - var resp MessagePaymentSuccessfulBot + var resp MessagePaymentSuccessfulBot - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactRegistered, error) { - var resp MessageContactRegistered + var resp MessageContactRegistered - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageWebsiteConnected(data json.RawMessage) (*MessageWebsiteConnected, error) { - var resp MessageWebsiteConnected + var resp MessageWebsiteConnected - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessagePassportDataSent(data json.RawMessage) (*MessagePassportDataSent, error) { - var resp MessagePassportDataSent + var resp MessagePassportDataSent - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessagePassportDataReceived(data json.RawMessage) (*MessagePassportDataReceived, error) { - var resp MessagePassportDataReceived + var resp MessagePassportDataReceived - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalMessageUnsupported(data json.RawMessage) (*MessageUnsupported, error) { - var resp MessageUnsupported + var resp MessageUnsupported - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypeMention(data json.RawMessage) (*TextEntityTypeMention, error) { - var resp TextEntityTypeMention + var resp TextEntityTypeMention - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypeHashtag(data json.RawMessage) (*TextEntityTypeHashtag, error) { - var resp TextEntityTypeHashtag + var resp TextEntityTypeHashtag - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypeCashtag(data json.RawMessage) (*TextEntityTypeCashtag, error) { - var resp TextEntityTypeCashtag + var resp TextEntityTypeCashtag - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypeBotCommand(data json.RawMessage) (*TextEntityTypeBotCommand, error) { - var resp TextEntityTypeBotCommand + var resp TextEntityTypeBotCommand - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypeUrl(data json.RawMessage) (*TextEntityTypeUrl, error) { - var resp TextEntityTypeUrl + var resp TextEntityTypeUrl - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypeEmailAddress(data json.RawMessage) (*TextEntityTypeEmailAddress, error) { - var resp TextEntityTypeEmailAddress + var resp TextEntityTypeEmailAddress - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypeBold(data json.RawMessage) (*TextEntityTypeBold, error) { - var resp TextEntityTypeBold + var resp TextEntityTypeBold - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypeItalic(data json.RawMessage) (*TextEntityTypeItalic, error) { - var resp TextEntityTypeItalic + var resp TextEntityTypeItalic - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypeCode(data json.RawMessage) (*TextEntityTypeCode, error) { - var resp TextEntityTypeCode + var resp TextEntityTypeCode - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypePre(data json.RawMessage) (*TextEntityTypePre, error) { - var resp TextEntityTypePre + var resp TextEntityTypePre - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypePreCode(data json.RawMessage) (*TextEntityTypePreCode, error) { - var resp TextEntityTypePreCode + var resp TextEntityTypePreCode - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypeTextUrl(data json.RawMessage) (*TextEntityTypeTextUrl, error) { - var resp TextEntityTypeTextUrl + var resp TextEntityTypeTextUrl - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypeMentionName(data json.RawMessage) (*TextEntityTypeMentionName, error) { - var resp TextEntityTypeMentionName + var resp TextEntityTypeMentionName - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextEntityTypePhoneNumber(data json.RawMessage) (*TextEntityTypePhoneNumber, error) { - var resp TextEntityTypePhoneNumber + var resp TextEntityTypePhoneNumber - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputThumbnail(data json.RawMessage) (*InputThumbnail, error) { - var resp InputThumbnail + var resp InputThumbnail - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageText(data json.RawMessage) (*InputMessageText, error) { - var resp InputMessageText + var resp InputMessageText - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageAnimation(data json.RawMessage) (*InputMessageAnimation, error) { - var resp InputMessageAnimation + var resp InputMessageAnimation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageAudio(data json.RawMessage) (*InputMessageAudio, error) { - var resp InputMessageAudio + var resp InputMessageAudio - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageDocument(data json.RawMessage) (*InputMessageDocument, error) { - var resp InputMessageDocument + var resp InputMessageDocument - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessagePhoto(data json.RawMessage) (*InputMessagePhoto, error) { - var resp InputMessagePhoto + var resp InputMessagePhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageSticker(data json.RawMessage) (*InputMessageSticker, error) { - var resp InputMessageSticker + var resp InputMessageSticker - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageVideo(data json.RawMessage) (*InputMessageVideo, error) { - var resp InputMessageVideo + var resp InputMessageVideo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageVideoNote(data json.RawMessage) (*InputMessageVideoNote, error) { - var resp InputMessageVideoNote + var resp InputMessageVideoNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageVoiceNote(data json.RawMessage) (*InputMessageVoiceNote, error) { - var resp InputMessageVoiceNote + var resp InputMessageVoiceNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageLocation(data json.RawMessage) (*InputMessageLocation, error) { - var resp InputMessageLocation + var resp InputMessageLocation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageVenue(data json.RawMessage) (*InputMessageVenue, error) { - var resp InputMessageVenue + var resp InputMessageVenue - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageContact(data json.RawMessage) (*InputMessageContact, error) { - var resp InputMessageContact + var resp InputMessageContact - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageGame(data json.RawMessage) (*InputMessageGame, error) { - var resp InputMessageGame + var resp InputMessageGame - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageInvoice(data json.RawMessage) (*InputMessageInvoice, error) { - var resp InputMessageInvoice + var resp InputMessageInvoice - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputMessageForwarded(data json.RawMessage) (*InputMessageForwarded, error) { - var resp InputMessageForwarded + var resp InputMessageForwarded - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterEmpty(data json.RawMessage) (*SearchMessagesFilterEmpty, error) { - var resp SearchMessagesFilterEmpty + var resp SearchMessagesFilterEmpty - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterAnimation(data json.RawMessage) (*SearchMessagesFilterAnimation, error) { - var resp SearchMessagesFilterAnimation + var resp SearchMessagesFilterAnimation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterAudio(data json.RawMessage) (*SearchMessagesFilterAudio, error) { - var resp SearchMessagesFilterAudio + var resp SearchMessagesFilterAudio - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterDocument(data json.RawMessage) (*SearchMessagesFilterDocument, error) { - var resp SearchMessagesFilterDocument + var resp SearchMessagesFilterDocument - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterPhoto(data json.RawMessage) (*SearchMessagesFilterPhoto, error) { - var resp SearchMessagesFilterPhoto + var resp SearchMessagesFilterPhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterVideo(data json.RawMessage) (*SearchMessagesFilterVideo, error) { - var resp SearchMessagesFilterVideo + var resp SearchMessagesFilterVideo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterVoiceNote(data json.RawMessage) (*SearchMessagesFilterVoiceNote, error) { - var resp SearchMessagesFilterVoiceNote + var resp SearchMessagesFilterVoiceNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterPhotoAndVideo(data json.RawMessage) (*SearchMessagesFilterPhotoAndVideo, error) { - var resp SearchMessagesFilterPhotoAndVideo + var resp SearchMessagesFilterPhotoAndVideo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterUrl(data json.RawMessage) (*SearchMessagesFilterUrl, error) { - var resp SearchMessagesFilterUrl + var resp SearchMessagesFilterUrl - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterChatPhoto(data json.RawMessage) (*SearchMessagesFilterChatPhoto, error) { - var resp SearchMessagesFilterChatPhoto + var resp SearchMessagesFilterChatPhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterCall(data json.RawMessage) (*SearchMessagesFilterCall, error) { - var resp SearchMessagesFilterCall + var resp SearchMessagesFilterCall - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterMissedCall(data json.RawMessage) (*SearchMessagesFilterMissedCall, error) { - var resp SearchMessagesFilterMissedCall + var resp SearchMessagesFilterMissedCall - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterVideoNote(data json.RawMessage) (*SearchMessagesFilterVideoNote, error) { - var resp SearchMessagesFilterVideoNote + var resp SearchMessagesFilterVideoNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterVoiceAndVideoNote(data json.RawMessage) (*SearchMessagesFilterVoiceAndVideoNote, error) { - var resp SearchMessagesFilterVoiceAndVideoNote + var resp SearchMessagesFilterVoiceAndVideoNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterMention(data json.RawMessage) (*SearchMessagesFilterMention, error) { - var resp SearchMessagesFilterMention + var resp SearchMessagesFilterMention - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSearchMessagesFilterUnreadMention(data json.RawMessage) (*SearchMessagesFilterUnreadMention, error) { - var resp SearchMessagesFilterUnreadMention + var resp SearchMessagesFilterUnreadMention - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionTyping(data json.RawMessage) (*ChatActionTyping, error) { - var resp ChatActionTyping + var resp ChatActionTyping - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionRecordingVideo(data json.RawMessage) (*ChatActionRecordingVideo, error) { - var resp ChatActionRecordingVideo + var resp ChatActionRecordingVideo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionUploadingVideo(data json.RawMessage) (*ChatActionUploadingVideo, error) { - var resp ChatActionUploadingVideo + var resp ChatActionUploadingVideo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionRecordingVoiceNote(data json.RawMessage) (*ChatActionRecordingVoiceNote, error) { - var resp ChatActionRecordingVoiceNote + var resp ChatActionRecordingVoiceNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionUploadingVoiceNote(data json.RawMessage) (*ChatActionUploadingVoiceNote, error) { - var resp ChatActionUploadingVoiceNote + var resp ChatActionUploadingVoiceNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionUploadingPhoto(data json.RawMessage) (*ChatActionUploadingPhoto, error) { - var resp ChatActionUploadingPhoto + var resp ChatActionUploadingPhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionUploadingDocument(data json.RawMessage) (*ChatActionUploadingDocument, error) { - var resp ChatActionUploadingDocument + var resp ChatActionUploadingDocument - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionChoosingLocation(data json.RawMessage) (*ChatActionChoosingLocation, error) { - var resp ChatActionChoosingLocation + var resp ChatActionChoosingLocation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionChoosingContact(data json.RawMessage) (*ChatActionChoosingContact, error) { - var resp ChatActionChoosingContact + var resp ChatActionChoosingContact - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionStartPlayingGame(data json.RawMessage) (*ChatActionStartPlayingGame, error) { - var resp ChatActionStartPlayingGame + var resp ChatActionStartPlayingGame - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionRecordingVideoNote(data json.RawMessage) (*ChatActionRecordingVideoNote, error) { - var resp ChatActionRecordingVideoNote + var resp ChatActionRecordingVideoNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionUploadingVideoNote(data json.RawMessage) (*ChatActionUploadingVideoNote, error) { - var resp ChatActionUploadingVideoNote + var resp ChatActionUploadingVideoNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatActionCancel(data json.RawMessage) (*ChatActionCancel, error) { - var resp ChatActionCancel + var resp ChatActionCancel - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserStatusEmpty(data json.RawMessage) (*UserStatusEmpty, error) { - var resp UserStatusEmpty + var resp UserStatusEmpty - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserStatusOnline(data json.RawMessage) (*UserStatusOnline, error) { - var resp UserStatusOnline + var resp UserStatusOnline - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserStatusOffline(data json.RawMessage) (*UserStatusOffline, error) { - var resp UserStatusOffline + var resp UserStatusOffline - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserStatusRecently(data json.RawMessage) (*UserStatusRecently, error) { - var resp UserStatusRecently + var resp UserStatusRecently - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserStatusLastWeek(data json.RawMessage) (*UserStatusLastWeek, error) { - var resp UserStatusLastWeek + var resp UserStatusLastWeek - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserStatusLastMonth(data json.RawMessage) (*UserStatusLastMonth, error) { - var resp UserStatusLastMonth + var resp UserStatusLastMonth - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalStickers(data json.RawMessage) (*Stickers, error) { - var resp Stickers + var resp Stickers - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalStickerEmojis(data json.RawMessage) (*StickerEmojis, error) { - var resp StickerEmojis + var resp StickerEmojis - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalStickerSet(data json.RawMessage) (*StickerSet, error) { - var resp StickerSet + var resp StickerSet - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalStickerSetInfo(data json.RawMessage) (*StickerSetInfo, error) { - var resp StickerSetInfo + var resp StickerSetInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalStickerSets(data json.RawMessage) (*StickerSets, error) { - var resp StickerSets + var resp StickerSets - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallDiscardReasonEmpty(data json.RawMessage) (*CallDiscardReasonEmpty, error) { - var resp CallDiscardReasonEmpty + var resp CallDiscardReasonEmpty - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallDiscardReasonMissed(data json.RawMessage) (*CallDiscardReasonMissed, error) { - var resp CallDiscardReasonMissed + var resp CallDiscardReasonMissed - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallDiscardReasonDeclined(data json.RawMessage) (*CallDiscardReasonDeclined, error) { - var resp CallDiscardReasonDeclined + var resp CallDiscardReasonDeclined - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallDiscardReasonDisconnected(data json.RawMessage) (*CallDiscardReasonDisconnected, error) { - var resp CallDiscardReasonDisconnected + var resp CallDiscardReasonDisconnected - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallDiscardReasonHungUp(data json.RawMessage) (*CallDiscardReasonHungUp, error) { - var resp CallDiscardReasonHungUp + var resp CallDiscardReasonHungUp - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallProtocol(data json.RawMessage) (*CallProtocol, error) { - var resp CallProtocol + var resp CallProtocol - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallConnection(data json.RawMessage) (*CallConnection, error) { - var resp CallConnection + var resp CallConnection - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallId(data json.RawMessage) (*CallId, error) { - var resp CallId + var resp CallId - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallStatePending(data json.RawMessage) (*CallStatePending, error) { - var resp CallStatePending + var resp CallStatePending - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallStateExchangingKeys(data json.RawMessage) (*CallStateExchangingKeys, error) { - var resp CallStateExchangingKeys + var resp CallStateExchangingKeys - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallStateReady(data json.RawMessage) (*CallStateReady, error) { - var resp CallStateReady + var resp CallStateReady - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallStateHangingUp(data json.RawMessage) (*CallStateHangingUp, error) { - var resp CallStateHangingUp + var resp CallStateHangingUp - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallStateDiscarded(data json.RawMessage) (*CallStateDiscarded, error) { - var resp CallStateDiscarded + var resp CallStateDiscarded - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallStateError(data json.RawMessage) (*CallStateError, error) { - var resp CallStateError + var resp CallStateError - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCall(data json.RawMessage) (*Call, error) { - var resp Call + var resp Call - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAnimations(data json.RawMessage) (*Animations, error) { - var resp Animations + var resp Animations - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalImportedContacts(data json.RawMessage) (*ImportedContacts, error) { - var resp ImportedContacts + var resp ImportedContacts - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultAnimatedGif(data json.RawMessage) (*InputInlineQueryResultAnimatedGif, error) { - var resp InputInlineQueryResultAnimatedGif + var resp InputInlineQueryResultAnimatedGif - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultAnimatedMpeg4(data json.RawMessage) (*InputInlineQueryResultAnimatedMpeg4, error) { - var resp InputInlineQueryResultAnimatedMpeg4 + var resp InputInlineQueryResultAnimatedMpeg4 - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultArticle(data json.RawMessage) (*InputInlineQueryResultArticle, error) { - var resp InputInlineQueryResultArticle + var resp InputInlineQueryResultArticle - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultAudio(data json.RawMessage) (*InputInlineQueryResultAudio, error) { - var resp InputInlineQueryResultAudio + var resp InputInlineQueryResultAudio - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultContact(data json.RawMessage) (*InputInlineQueryResultContact, error) { - var resp InputInlineQueryResultContact + var resp InputInlineQueryResultContact - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultDocument(data json.RawMessage) (*InputInlineQueryResultDocument, error) { - var resp InputInlineQueryResultDocument + var resp InputInlineQueryResultDocument - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultGame(data json.RawMessage) (*InputInlineQueryResultGame, error) { - var resp InputInlineQueryResultGame + var resp InputInlineQueryResultGame - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultLocation(data json.RawMessage) (*InputInlineQueryResultLocation, error) { - var resp InputInlineQueryResultLocation + var resp InputInlineQueryResultLocation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultPhoto(data json.RawMessage) (*InputInlineQueryResultPhoto, error) { - var resp InputInlineQueryResultPhoto + var resp InputInlineQueryResultPhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultSticker(data json.RawMessage) (*InputInlineQueryResultSticker, error) { - var resp InputInlineQueryResultSticker + var resp InputInlineQueryResultSticker - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultVenue(data json.RawMessage) (*InputInlineQueryResultVenue, error) { - var resp InputInlineQueryResultVenue + var resp InputInlineQueryResultVenue - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultVideo(data json.RawMessage) (*InputInlineQueryResultVideo, error) { - var resp InputInlineQueryResultVideo + var resp InputInlineQueryResultVideo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputInlineQueryResultVoiceNote(data json.RawMessage) (*InputInlineQueryResultVoiceNote, error) { - var resp InputInlineQueryResultVoiceNote + var resp InputInlineQueryResultVoiceNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResultArticle(data json.RawMessage) (*InlineQueryResultArticle, error) { - var resp InlineQueryResultArticle + var resp InlineQueryResultArticle - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResultContact(data json.RawMessage) (*InlineQueryResultContact, error) { - var resp InlineQueryResultContact + var resp InlineQueryResultContact - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResultLocation(data json.RawMessage) (*InlineQueryResultLocation, error) { - var resp InlineQueryResultLocation + var resp InlineQueryResultLocation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResultVenue(data json.RawMessage) (*InlineQueryResultVenue, error) { - var resp InlineQueryResultVenue + var resp InlineQueryResultVenue - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResultGame(data json.RawMessage) (*InlineQueryResultGame, error) { - var resp InlineQueryResultGame + var resp InlineQueryResultGame - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResultAnimation(data json.RawMessage) (*InlineQueryResultAnimation, error) { - var resp InlineQueryResultAnimation + var resp InlineQueryResultAnimation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResultAudio(data json.RawMessage) (*InlineQueryResultAudio, error) { - var resp InlineQueryResultAudio + var resp InlineQueryResultAudio - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResultDocument(data json.RawMessage) (*InlineQueryResultDocument, error) { - var resp InlineQueryResultDocument + var resp InlineQueryResultDocument - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResultPhoto(data json.RawMessage) (*InlineQueryResultPhoto, error) { - var resp InlineQueryResultPhoto + var resp InlineQueryResultPhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResultSticker(data json.RawMessage) (*InlineQueryResultSticker, error) { - var resp InlineQueryResultSticker + var resp InlineQueryResultSticker - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResultVideo(data json.RawMessage) (*InlineQueryResultVideo, error) { - var resp InlineQueryResultVideo + var resp InlineQueryResultVideo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResultVoiceNote(data json.RawMessage) (*InlineQueryResultVoiceNote, error) { - var resp InlineQueryResultVoiceNote + var resp InlineQueryResultVoiceNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInlineQueryResults(data json.RawMessage) (*InlineQueryResults, error) { - var resp InlineQueryResults + var resp InlineQueryResults - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallbackQueryPayloadData(data json.RawMessage) (*CallbackQueryPayloadData, error) { - var resp CallbackQueryPayloadData + var resp CallbackQueryPayloadData - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallbackQueryPayloadGame(data json.RawMessage) (*CallbackQueryPayloadGame, error) { - var resp CallbackQueryPayloadGame + var resp CallbackQueryPayloadGame - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCallbackQueryAnswer(data json.RawMessage) (*CallbackQueryAnswer, error) { - var resp CallbackQueryAnswer + var resp CallbackQueryAnswer - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCustomRequestResult(data json.RawMessage) (*CustomRequestResult, error) { - var resp CustomRequestResult + var resp CustomRequestResult - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalGameHighScore(data json.RawMessage) (*GameHighScore, error) { - var resp GameHighScore + var resp GameHighScore - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalGameHighScores(data json.RawMessage) (*GameHighScores, error) { - var resp GameHighScores + var resp GameHighScores - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventMessageEdited(data json.RawMessage) (*ChatEventMessageEdited, error) { - var resp ChatEventMessageEdited + var resp ChatEventMessageEdited - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventMessageDeleted(data json.RawMessage) (*ChatEventMessageDeleted, error) { - var resp ChatEventMessageDeleted + var resp ChatEventMessageDeleted - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventMessagePinned(data json.RawMessage) (*ChatEventMessagePinned, error) { - var resp ChatEventMessagePinned + var resp ChatEventMessagePinned - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventMessageUnpinned(data json.RawMessage) (*ChatEventMessageUnpinned, error) { - var resp ChatEventMessageUnpinned + var resp ChatEventMessageUnpinned - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventMemberJoined(data json.RawMessage) (*ChatEventMemberJoined, error) { - var resp ChatEventMemberJoined + var resp ChatEventMemberJoined - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventMemberLeft(data json.RawMessage) (*ChatEventMemberLeft, error) { - var resp ChatEventMemberLeft + var resp ChatEventMemberLeft - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventMemberInvited(data json.RawMessage) (*ChatEventMemberInvited, error) { - var resp ChatEventMemberInvited + var resp ChatEventMemberInvited - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventMemberPromoted(data json.RawMessage) (*ChatEventMemberPromoted, error) { - var resp ChatEventMemberPromoted + var resp ChatEventMemberPromoted - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventMemberRestricted(data json.RawMessage) (*ChatEventMemberRestricted, error) { - var resp ChatEventMemberRestricted + var resp ChatEventMemberRestricted - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventTitleChanged(data json.RawMessage) (*ChatEventTitleChanged, error) { - var resp ChatEventTitleChanged + var resp ChatEventTitleChanged - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventDescriptionChanged(data json.RawMessage) (*ChatEventDescriptionChanged, error) { - var resp ChatEventDescriptionChanged + var resp ChatEventDescriptionChanged - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventUsernameChanged(data json.RawMessage) (*ChatEventUsernameChanged, error) { - var resp ChatEventUsernameChanged + var resp ChatEventUsernameChanged - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventPhotoChanged(data json.RawMessage) (*ChatEventPhotoChanged, error) { - var resp ChatEventPhotoChanged + var resp ChatEventPhotoChanged - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventInvitesToggled(data json.RawMessage) (*ChatEventInvitesToggled, error) { - var resp ChatEventInvitesToggled + var resp ChatEventInvitesToggled - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventSignMessagesToggled(data json.RawMessage) (*ChatEventSignMessagesToggled, error) { - var resp ChatEventSignMessagesToggled + var resp ChatEventSignMessagesToggled - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventStickerSetChanged(data json.RawMessage) (*ChatEventStickerSetChanged, error) { - var resp ChatEventStickerSetChanged + var resp ChatEventStickerSetChanged - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventIsAllHistoryAvailableToggled(data json.RawMessage) (*ChatEventIsAllHistoryAvailableToggled, error) { - var resp ChatEventIsAllHistoryAvailableToggled + var resp ChatEventIsAllHistoryAvailableToggled - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEvent(data json.RawMessage) (*ChatEvent, error) { - var resp ChatEvent + var resp ChatEvent - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEvents(data json.RawMessage) (*ChatEvents, error) { - var resp ChatEvents + var resp ChatEvents - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatEventLogFilters(data json.RawMessage) (*ChatEventLogFilters, error) { - var resp ChatEventLogFilters + var resp ChatEventLogFilters - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLanguagePackStringValueOrdinary(data json.RawMessage) (*LanguagePackStringValueOrdinary, error) { - var resp LanguagePackStringValueOrdinary + var resp LanguagePackStringValueOrdinary - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLanguagePackStringValuePluralized(data json.RawMessage) (*LanguagePackStringValuePluralized, error) { - var resp LanguagePackStringValuePluralized + var resp LanguagePackStringValuePluralized - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLanguagePackStringValueDeleted(data json.RawMessage) (*LanguagePackStringValueDeleted, error) { - var resp LanguagePackStringValueDeleted + var resp LanguagePackStringValueDeleted - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLanguagePackString(data json.RawMessage) (*LanguagePackString, error) { - var resp LanguagePackString + var resp LanguagePackString - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLanguagePackStrings(data json.RawMessage) (*LanguagePackStrings, error) { - var resp LanguagePackStrings + var resp LanguagePackStrings - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLanguagePackInfo(data json.RawMessage) (*LanguagePackInfo, error) { - var resp LanguagePackInfo + var resp LanguagePackInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalLocalizationTargetInfo(data json.RawMessage) (*LocalizationTargetInfo, error) { - var resp LocalizationTargetInfo + var resp LocalizationTargetInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDeviceTokenGoogleCloudMessaging(data json.RawMessage) (*DeviceTokenGoogleCloudMessaging, error) { - var resp DeviceTokenGoogleCloudMessaging + var resp DeviceTokenGoogleCloudMessaging - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDeviceTokenApplePush(data json.RawMessage) (*DeviceTokenApplePush, error) { - var resp DeviceTokenApplePush + var resp DeviceTokenApplePush - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDeviceTokenApplePushVoIP(data json.RawMessage) (*DeviceTokenApplePushVoIP, error) { - var resp DeviceTokenApplePushVoIP + var resp DeviceTokenApplePushVoIP - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDeviceTokenWindowsPush(data json.RawMessage) (*DeviceTokenWindowsPush, error) { - var resp DeviceTokenWindowsPush + var resp DeviceTokenWindowsPush - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDeviceTokenMicrosoftPush(data json.RawMessage) (*DeviceTokenMicrosoftPush, error) { - var resp DeviceTokenMicrosoftPush + var resp DeviceTokenMicrosoftPush - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDeviceTokenMicrosoftPushVoIP(data json.RawMessage) (*DeviceTokenMicrosoftPushVoIP, error) { - var resp DeviceTokenMicrosoftPushVoIP + var resp DeviceTokenMicrosoftPushVoIP - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDeviceTokenWebPush(data json.RawMessage) (*DeviceTokenWebPush, error) { - var resp DeviceTokenWebPush + var resp DeviceTokenWebPush - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDeviceTokenSimplePush(data json.RawMessage) (*DeviceTokenSimplePush, error) { - var resp DeviceTokenSimplePush + var resp DeviceTokenSimplePush - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDeviceTokenUbuntuPush(data json.RawMessage) (*DeviceTokenUbuntuPush, error) { - var resp DeviceTokenUbuntuPush + var resp DeviceTokenUbuntuPush - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDeviceTokenBlackBerryPush(data json.RawMessage) (*DeviceTokenBlackBerryPush, error) { - var resp DeviceTokenBlackBerryPush + var resp DeviceTokenBlackBerryPush - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDeviceTokenTizenPush(data json.RawMessage) (*DeviceTokenTizenPush, error) { - var resp DeviceTokenTizenPush + var resp DeviceTokenTizenPush - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalWallpaper(data json.RawMessage) (*Wallpaper, error) { - var resp Wallpaper + var resp Wallpaper - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalWallpapers(data json.RawMessage) (*Wallpapers, error) { - var resp Wallpapers + var resp Wallpapers - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalHashtags(data json.RawMessage) (*Hashtags, error) { - var resp Hashtags + var resp Hashtags - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCheckChatUsernameResultOk(data json.RawMessage) (*CheckChatUsernameResultOk, error) { - var resp CheckChatUsernameResultOk + var resp CheckChatUsernameResultOk - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCheckChatUsernameResultUsernameInvalid(data json.RawMessage) (*CheckChatUsernameResultUsernameInvalid, error) { - var resp CheckChatUsernameResultUsernameInvalid + var resp CheckChatUsernameResultUsernameInvalid - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCheckChatUsernameResultUsernameOccupied(data json.RawMessage) (*CheckChatUsernameResultUsernameOccupied, error) { - var resp CheckChatUsernameResultUsernameOccupied + var resp CheckChatUsernameResultUsernameOccupied - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCheckChatUsernameResultPublicChatsTooMuch(data json.RawMessage) (*CheckChatUsernameResultPublicChatsTooMuch, error) { - var resp CheckChatUsernameResultPublicChatsTooMuch + var resp CheckChatUsernameResultPublicChatsTooMuch - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(data json.RawMessage) (*CheckChatUsernameResultPublicGroupsUnavailable, error) { - var resp CheckChatUsernameResultPublicGroupsUnavailable + var resp CheckChatUsernameResultPublicGroupsUnavailable - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalOptionValueBoolean(data json.RawMessage) (*OptionValueBoolean, error) { - var resp OptionValueBoolean + var resp OptionValueBoolean - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalOptionValueEmpty(data json.RawMessage) (*OptionValueEmpty, error) { - var resp OptionValueEmpty + var resp OptionValueEmpty - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalOptionValueInteger(data json.RawMessage) (*OptionValueInteger, error) { - var resp OptionValueInteger + var resp OptionValueInteger - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalOptionValueString(data json.RawMessage) (*OptionValueString, error) { - var resp OptionValueString + var resp OptionValueString - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserPrivacySettingRuleAllowAll(data json.RawMessage) (*UserPrivacySettingRuleAllowAll, error) { - var resp UserPrivacySettingRuleAllowAll + var resp UserPrivacySettingRuleAllowAll - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserPrivacySettingRuleAllowContacts(data json.RawMessage) (*UserPrivacySettingRuleAllowContacts, error) { - var resp UserPrivacySettingRuleAllowContacts + var resp UserPrivacySettingRuleAllowContacts - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserPrivacySettingRuleAllowUsers(data json.RawMessage) (*UserPrivacySettingRuleAllowUsers, error) { - var resp UserPrivacySettingRuleAllowUsers + var resp UserPrivacySettingRuleAllowUsers - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserPrivacySettingRuleRestrictAll(data json.RawMessage) (*UserPrivacySettingRuleRestrictAll, error) { - var resp UserPrivacySettingRuleRestrictAll + var resp UserPrivacySettingRuleRestrictAll - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserPrivacySettingRuleRestrictContacts(data json.RawMessage) (*UserPrivacySettingRuleRestrictContacts, error) { - var resp UserPrivacySettingRuleRestrictContacts + var resp UserPrivacySettingRuleRestrictContacts - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserPrivacySettingRuleRestrictUsers(data json.RawMessage) (*UserPrivacySettingRuleRestrictUsers, error) { - var resp UserPrivacySettingRuleRestrictUsers + var resp UserPrivacySettingRuleRestrictUsers - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserPrivacySettingRules(data json.RawMessage) (*UserPrivacySettingRules, error) { - var resp UserPrivacySettingRules + var resp UserPrivacySettingRules - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserPrivacySettingShowStatus(data json.RawMessage) (*UserPrivacySettingShowStatus, error) { - var resp UserPrivacySettingShowStatus + var resp UserPrivacySettingShowStatus - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserPrivacySettingAllowChatInvites(data json.RawMessage) (*UserPrivacySettingAllowChatInvites, error) { - var resp UserPrivacySettingAllowChatInvites + var resp UserPrivacySettingAllowChatInvites - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUserPrivacySettingAllowCalls(data json.RawMessage) (*UserPrivacySettingAllowCalls, error) { - var resp UserPrivacySettingAllowCalls + var resp UserPrivacySettingAllowCalls - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalAccountTtl(data json.RawMessage) (*AccountTtl, error) { - var resp AccountTtl + var resp AccountTtl - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSession(data json.RawMessage) (*Session, error) { - var resp Session + var resp Session - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSessions(data json.RawMessage) (*Sessions, error) { - var resp Sessions + var resp Sessions - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalConnectedWebsite(data json.RawMessage) (*ConnectedWebsite, error) { - var resp ConnectedWebsite + var resp ConnectedWebsite - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalConnectedWebsites(data json.RawMessage) (*ConnectedWebsites, error) { - var resp ConnectedWebsites + var resp ConnectedWebsites - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatReportSpamState(data json.RawMessage) (*ChatReportSpamState, error) { - var resp ChatReportSpamState + var resp ChatReportSpamState - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatReportReasonSpam(data json.RawMessage) (*ChatReportReasonSpam, error) { - var resp ChatReportReasonSpam + var resp ChatReportReasonSpam - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatReportReasonViolence(data json.RawMessage) (*ChatReportReasonViolence, error) { - var resp ChatReportReasonViolence + var resp ChatReportReasonViolence - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatReportReasonPornography(data json.RawMessage) (*ChatReportReasonPornography, error) { - var resp ChatReportReasonPornography + var resp ChatReportReasonPornography - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatReportReasonCopyright(data json.RawMessage) (*ChatReportReasonCopyright, error) { - var resp ChatReportReasonCopyright + var resp ChatReportReasonCopyright - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalChatReportReasonCustom(data json.RawMessage) (*ChatReportReasonCustom, error) { - var resp ChatReportReasonCustom + var resp ChatReportReasonCustom - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalPublicMessageLink(data json.RawMessage) (*PublicMessageLink, error) { - var resp PublicMessageLink + var resp PublicMessageLink - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeNone(data json.RawMessage) (*FileTypeNone, error) { - var resp FileTypeNone + var resp FileTypeNone - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeAnimation(data json.RawMessage) (*FileTypeAnimation, error) { - var resp FileTypeAnimation + var resp FileTypeAnimation - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeAudio(data json.RawMessage) (*FileTypeAudio, error) { - var resp FileTypeAudio + var resp FileTypeAudio - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeDocument(data json.RawMessage) (*FileTypeDocument, error) { - var resp FileTypeDocument + var resp FileTypeDocument - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypePhoto(data json.RawMessage) (*FileTypePhoto, error) { - var resp FileTypePhoto + var resp FileTypePhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeProfilePhoto(data json.RawMessage) (*FileTypeProfilePhoto, error) { - var resp FileTypeProfilePhoto + var resp FileTypeProfilePhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeSecret(data json.RawMessage) (*FileTypeSecret, error) { - var resp FileTypeSecret + var resp FileTypeSecret - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeSecretThumbnail(data json.RawMessage) (*FileTypeSecretThumbnail, error) { - var resp FileTypeSecretThumbnail + var resp FileTypeSecretThumbnail - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeSecure(data json.RawMessage) (*FileTypeSecure, error) { - var resp FileTypeSecure + var resp FileTypeSecure - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeSticker(data json.RawMessage) (*FileTypeSticker, error) { - var resp FileTypeSticker + var resp FileTypeSticker - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeThumbnail(data json.RawMessage) (*FileTypeThumbnail, error) { - var resp FileTypeThumbnail + var resp FileTypeThumbnail - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeUnknown(data json.RawMessage) (*FileTypeUnknown, error) { - var resp FileTypeUnknown + var resp FileTypeUnknown - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeVideo(data json.RawMessage) (*FileTypeVideo, error) { - var resp FileTypeVideo + var resp FileTypeVideo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeVideoNote(data json.RawMessage) (*FileTypeVideoNote, error) { - var resp FileTypeVideoNote + var resp FileTypeVideoNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeVoiceNote(data json.RawMessage) (*FileTypeVoiceNote, error) { - var resp FileTypeVoiceNote + var resp FileTypeVoiceNote - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalFileTypeWallpaper(data json.RawMessage) (*FileTypeWallpaper, error) { - var resp FileTypeWallpaper + var resp FileTypeWallpaper - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalStorageStatisticsByFileType(data json.RawMessage) (*StorageStatisticsByFileType, error) { - var resp StorageStatisticsByFileType + var resp StorageStatisticsByFileType - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalStorageStatisticsByChat(data json.RawMessage) (*StorageStatisticsByChat, error) { - var resp StorageStatisticsByChat + var resp StorageStatisticsByChat - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalStorageStatistics(data json.RawMessage) (*StorageStatistics, error) { - var resp StorageStatistics + var resp StorageStatistics - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalStorageStatisticsFast(data json.RawMessage) (*StorageStatisticsFast, error) { - var resp StorageStatisticsFast + var resp StorageStatisticsFast - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalNetworkTypeNone(data json.RawMessage) (*NetworkTypeNone, error) { - var resp NetworkTypeNone + var resp NetworkTypeNone - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalNetworkTypeMobile(data json.RawMessage) (*NetworkTypeMobile, error) { - var resp NetworkTypeMobile + var resp NetworkTypeMobile - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalNetworkTypeMobileRoaming(data json.RawMessage) (*NetworkTypeMobileRoaming, error) { - var resp NetworkTypeMobileRoaming + var resp NetworkTypeMobileRoaming - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalNetworkTypeWiFi(data json.RawMessage) (*NetworkTypeWiFi, error) { - var resp NetworkTypeWiFi + var resp NetworkTypeWiFi - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalNetworkTypeOther(data json.RawMessage) (*NetworkTypeOther, error) { - var resp NetworkTypeOther + var resp NetworkTypeOther - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalNetworkStatisticsEntryFile(data json.RawMessage) (*NetworkStatisticsEntryFile, error) { - var resp NetworkStatisticsEntryFile + var resp NetworkStatisticsEntryFile - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalNetworkStatisticsEntryCall(data json.RawMessage) (*NetworkStatisticsEntryCall, error) { - var resp NetworkStatisticsEntryCall + var resp NetworkStatisticsEntryCall - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalNetworkStatistics(data json.RawMessage) (*NetworkStatistics, error) { - var resp NetworkStatistics + var resp NetworkStatistics - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalConnectionStateWaitingForNetwork(data json.RawMessage) (*ConnectionStateWaitingForNetwork, error) { - var resp ConnectionStateWaitingForNetwork + var resp ConnectionStateWaitingForNetwork - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalConnectionStateConnectingToProxy(data json.RawMessage) (*ConnectionStateConnectingToProxy, error) { - var resp ConnectionStateConnectingToProxy + var resp ConnectionStateConnectingToProxy - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalConnectionStateConnecting(data json.RawMessage) (*ConnectionStateConnecting, error) { - var resp ConnectionStateConnecting + var resp ConnectionStateConnecting - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalConnectionStateUpdating(data json.RawMessage) (*ConnectionStateUpdating, error) { - var resp ConnectionStateUpdating + var resp ConnectionStateUpdating - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalConnectionStateReady(data json.RawMessage) (*ConnectionStateReady, error) { - var resp ConnectionStateReady + var resp ConnectionStateReady - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTopChatCategoryUsers(data json.RawMessage) (*TopChatCategoryUsers, error) { - var resp TopChatCategoryUsers + var resp TopChatCategoryUsers - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTopChatCategoryBots(data json.RawMessage) (*TopChatCategoryBots, error) { - var resp TopChatCategoryBots + var resp TopChatCategoryBots - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTopChatCategoryGroups(data json.RawMessage) (*TopChatCategoryGroups, error) { - var resp TopChatCategoryGroups + var resp TopChatCategoryGroups - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTopChatCategoryChannels(data json.RawMessage) (*TopChatCategoryChannels, error) { - var resp TopChatCategoryChannels + var resp TopChatCategoryChannels - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTopChatCategoryInlineBots(data json.RawMessage) (*TopChatCategoryInlineBots, error) { - var resp TopChatCategoryInlineBots + var resp TopChatCategoryInlineBots - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTopChatCategoryCalls(data json.RawMessage) (*TopChatCategoryCalls, error) { - var resp TopChatCategoryCalls + var resp TopChatCategoryCalls - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTMeUrlTypeUser(data json.RawMessage) (*TMeUrlTypeUser, error) { - var resp TMeUrlTypeUser + var resp TMeUrlTypeUser - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTMeUrlTypeSupergroup(data json.RawMessage) (*TMeUrlTypeSupergroup, error) { - var resp TMeUrlTypeSupergroup + var resp TMeUrlTypeSupergroup - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTMeUrlTypeChatInvite(data json.RawMessage) (*TMeUrlTypeChatInvite, error) { - var resp TMeUrlTypeChatInvite + var resp TMeUrlTypeChatInvite - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTMeUrlTypeStickerSet(data json.RawMessage) (*TMeUrlTypeStickerSet, error) { - var resp TMeUrlTypeStickerSet + var resp TMeUrlTypeStickerSet - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTMeUrl(data json.RawMessage) (*TMeUrl, error) { - var resp TMeUrl + var resp TMeUrl - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTMeUrls(data json.RawMessage) (*TMeUrls, error) { - var resp TMeUrls + var resp TMeUrls - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalCount(data json.RawMessage) (*Count, error) { - var resp Count + var resp Count - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalText(data json.RawMessage) (*Text, error) { - var resp Text + var resp Text - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalSeconds(data json.RawMessage) (*Seconds, error) { - var resp Seconds + var resp Seconds - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalDeepLinkInfo(data json.RawMessage) (*DeepLinkInfo, error) { - var resp DeepLinkInfo + var resp DeepLinkInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextParseModeMarkdown(data json.RawMessage) (*TextParseModeMarkdown, error) { - var resp TextParseModeMarkdown + var resp TextParseModeMarkdown - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTextParseModeHTML(data json.RawMessage) (*TextParseModeHTML, error) { - var resp TextParseModeHTML + var resp TextParseModeHTML - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalProxyTypeSocks5(data json.RawMessage) (*ProxyTypeSocks5, error) { - var resp ProxyTypeSocks5 + var resp ProxyTypeSocks5 - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalProxyTypeHttp(data json.RawMessage) (*ProxyTypeHttp, error) { - var resp ProxyTypeHttp + var resp ProxyTypeHttp - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalProxyTypeMtproto(data json.RawMessage) (*ProxyTypeMtproto, error) { - var resp ProxyTypeMtproto + var resp ProxyTypeMtproto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalProxy(data json.RawMessage) (*Proxy, error) { - var resp Proxy + var resp Proxy - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalProxies(data json.RawMessage) (*Proxies, error) { - var resp Proxies + var resp Proxies - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalInputSticker(data json.RawMessage) (*InputSticker, error) { - var resp InputSticker + var resp InputSticker - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateAuthorizationState(data json.RawMessage) (*UpdateAuthorizationState, error) { - var resp UpdateAuthorizationState + var resp UpdateAuthorizationState - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateNewMessage(data json.RawMessage) (*UpdateNewMessage, error) { - var resp UpdateNewMessage + var resp UpdateNewMessage - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateMessageSendAcknowledged(data json.RawMessage) (*UpdateMessageSendAcknowledged, error) { - var resp UpdateMessageSendAcknowledged + var resp UpdateMessageSendAcknowledged - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateMessageSendSucceeded(data json.RawMessage) (*UpdateMessageSendSucceeded, error) { - var resp UpdateMessageSendSucceeded + var resp UpdateMessageSendSucceeded - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateMessageSendFailed(data json.RawMessage) (*UpdateMessageSendFailed, error) { - var resp UpdateMessageSendFailed + var resp UpdateMessageSendFailed - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateMessageContent(data json.RawMessage) (*UpdateMessageContent, error) { - var resp UpdateMessageContent + var resp UpdateMessageContent - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateMessageEdited(data json.RawMessage) (*UpdateMessageEdited, error) { - var resp UpdateMessageEdited + var resp UpdateMessageEdited - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateMessageViews(data json.RawMessage) (*UpdateMessageViews, error) { - var resp UpdateMessageViews + var resp UpdateMessageViews - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateMessageContentOpened(data json.RawMessage) (*UpdateMessageContentOpened, error) { - var resp UpdateMessageContentOpened + var resp UpdateMessageContentOpened - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateMessageMentionRead(data json.RawMessage) (*UpdateMessageMentionRead, error) { - var resp UpdateMessageMentionRead + var resp UpdateMessageMentionRead - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateNewChat(data json.RawMessage) (*UpdateNewChat, error) { - var resp UpdateNewChat + var resp UpdateNewChat - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatTitle(data json.RawMessage) (*UpdateChatTitle, error) { - var resp UpdateChatTitle + var resp UpdateChatTitle - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatPhoto(data json.RawMessage) (*UpdateChatPhoto, error) { - var resp UpdateChatPhoto + var resp UpdateChatPhoto - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatLastMessage(data json.RawMessage) (*UpdateChatLastMessage, error) { - var resp UpdateChatLastMessage + var resp UpdateChatLastMessage - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatOrder(data json.RawMessage) (*UpdateChatOrder, error) { - var resp UpdateChatOrder + var resp UpdateChatOrder - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatIsPinned(data json.RawMessage) (*UpdateChatIsPinned, error) { - var resp UpdateChatIsPinned + var resp UpdateChatIsPinned - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatIsMarkedAsUnread(data json.RawMessage) (*UpdateChatIsMarkedAsUnread, error) { - var resp UpdateChatIsMarkedAsUnread + var resp UpdateChatIsMarkedAsUnread - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatIsSponsored(data json.RawMessage) (*UpdateChatIsSponsored, error) { - var resp UpdateChatIsSponsored + var resp UpdateChatIsSponsored - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatDefaultDisableNotification(data json.RawMessage) (*UpdateChatDefaultDisableNotification, error) { - var resp UpdateChatDefaultDisableNotification + var resp UpdateChatDefaultDisableNotification - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatReadInbox(data json.RawMessage) (*UpdateChatReadInbox, error) { - var resp UpdateChatReadInbox + var resp UpdateChatReadInbox - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatReadOutbox(data json.RawMessage) (*UpdateChatReadOutbox, error) { - var resp UpdateChatReadOutbox + var resp UpdateChatReadOutbox - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatUnreadMentionCount(data json.RawMessage) (*UpdateChatUnreadMentionCount, error) { - var resp UpdateChatUnreadMentionCount + var resp UpdateChatUnreadMentionCount - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatNotificationSettings(data json.RawMessage) (*UpdateChatNotificationSettings, error) { - var resp UpdateChatNotificationSettings + var resp UpdateChatNotificationSettings - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateScopeNotificationSettings(data json.RawMessage) (*UpdateScopeNotificationSettings, error) { - var resp UpdateScopeNotificationSettings + var resp UpdateScopeNotificationSettings - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatReplyMarkup(data json.RawMessage) (*UpdateChatReplyMarkup, error) { - var resp UpdateChatReplyMarkup + var resp UpdateChatReplyMarkup - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateChatDraftMessage(data json.RawMessage) (*UpdateChatDraftMessage, error) { - var resp UpdateChatDraftMessage + var resp UpdateChatDraftMessage - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateDeleteMessages(data json.RawMessage) (*UpdateDeleteMessages, error) { - var resp UpdateDeleteMessages + var resp UpdateDeleteMessages - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateUserChatAction(data json.RawMessage) (*UpdateUserChatAction, error) { - var resp UpdateUserChatAction + var resp UpdateUserChatAction - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateUserStatus(data json.RawMessage) (*UpdateUserStatus, error) { - var resp UpdateUserStatus + var resp UpdateUserStatus - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateUser(data json.RawMessage) (*UpdateUser, error) { - var resp UpdateUser + var resp UpdateUser - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateBasicGroup(data json.RawMessage) (*UpdateBasicGroup, error) { - var resp UpdateBasicGroup + var resp UpdateBasicGroup - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateSupergroup(data json.RawMessage) (*UpdateSupergroup, error) { - var resp UpdateSupergroup + var resp UpdateSupergroup - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateSecretChat(data json.RawMessage) (*UpdateSecretChat, error) { - var resp UpdateSecretChat + var resp UpdateSecretChat - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateUserFullInfo(data json.RawMessage) (*UpdateUserFullInfo, error) { - var resp UpdateUserFullInfo + var resp UpdateUserFullInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateBasicGroupFullInfo(data json.RawMessage) (*UpdateBasicGroupFullInfo, error) { - var resp UpdateBasicGroupFullInfo + var resp UpdateBasicGroupFullInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateSupergroupFullInfo(data json.RawMessage) (*UpdateSupergroupFullInfo, error) { - var resp UpdateSupergroupFullInfo + var resp UpdateSupergroupFullInfo - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateServiceNotification(data json.RawMessage) (*UpdateServiceNotification, error) { - var resp UpdateServiceNotification + var resp UpdateServiceNotification - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateFile(data json.RawMessage) (*UpdateFile, error) { - var resp UpdateFile + var resp UpdateFile - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateFileGenerationStart(data json.RawMessage) (*UpdateFileGenerationStart, error) { - var resp UpdateFileGenerationStart + var resp UpdateFileGenerationStart - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateFileGenerationStop(data json.RawMessage) (*UpdateFileGenerationStop, error) { - var resp UpdateFileGenerationStop + var resp UpdateFileGenerationStop - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateCall(data json.RawMessage) (*UpdateCall, error) { - var resp UpdateCall + var resp UpdateCall - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateUserPrivacySettingRules(data json.RawMessage) (*UpdateUserPrivacySettingRules, error) { - var resp UpdateUserPrivacySettingRules + var resp UpdateUserPrivacySettingRules - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateUnreadMessageCount(data json.RawMessage) (*UpdateUnreadMessageCount, error) { - var resp UpdateUnreadMessageCount + var resp UpdateUnreadMessageCount - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateUnreadChatCount(data json.RawMessage) (*UpdateUnreadChatCount, error) { - var resp UpdateUnreadChatCount + var resp UpdateUnreadChatCount - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateOption(data json.RawMessage) (*UpdateOption, error) { - var resp UpdateOption + var resp UpdateOption - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateInstalledStickerSets(data json.RawMessage) (*UpdateInstalledStickerSets, error) { - var resp UpdateInstalledStickerSets + var resp UpdateInstalledStickerSets - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateTrendingStickerSets(data json.RawMessage) (*UpdateTrendingStickerSets, error) { - var resp UpdateTrendingStickerSets + var resp UpdateTrendingStickerSets - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateRecentStickers(data json.RawMessage) (*UpdateRecentStickers, error) { - var resp UpdateRecentStickers + var resp UpdateRecentStickers - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateFavoriteStickers(data json.RawMessage) (*UpdateFavoriteStickers, error) { - var resp UpdateFavoriteStickers + var resp UpdateFavoriteStickers - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateSavedAnimations(data json.RawMessage) (*UpdateSavedAnimations, error) { - var resp UpdateSavedAnimations + var resp UpdateSavedAnimations - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateLanguagePackStrings(data json.RawMessage) (*UpdateLanguagePackStrings, error) { - var resp UpdateLanguagePackStrings + var resp UpdateLanguagePackStrings - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateConnectionState(data json.RawMessage) (*UpdateConnectionState, error) { - var resp UpdateConnectionState + var resp UpdateConnectionState - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateTermsOfService(data json.RawMessage) (*UpdateTermsOfService, error) { - var resp UpdateTermsOfService + var resp UpdateTermsOfService - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateNewInlineQuery(data json.RawMessage) (*UpdateNewInlineQuery, error) { - var resp UpdateNewInlineQuery + var resp UpdateNewInlineQuery - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateNewChosenInlineResult(data json.RawMessage) (*UpdateNewChosenInlineResult, error) { - var resp UpdateNewChosenInlineResult + var resp UpdateNewChosenInlineResult - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateNewCallbackQuery(data json.RawMessage) (*UpdateNewCallbackQuery, error) { - var resp UpdateNewCallbackQuery + var resp UpdateNewCallbackQuery - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateNewInlineCallbackQuery(data json.RawMessage) (*UpdateNewInlineCallbackQuery, error) { - var resp UpdateNewInlineCallbackQuery + var resp UpdateNewInlineCallbackQuery - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateNewShippingQuery(data json.RawMessage) (*UpdateNewShippingQuery, error) { - var resp UpdateNewShippingQuery + var resp UpdateNewShippingQuery - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateNewPreCheckoutQuery(data json.RawMessage) (*UpdateNewPreCheckoutQuery, error) { - var resp UpdateNewPreCheckoutQuery + var resp UpdateNewPreCheckoutQuery - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateNewCustomEvent(data json.RawMessage) (*UpdateNewCustomEvent, error) { - var resp UpdateNewCustomEvent + var resp UpdateNewCustomEvent - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalUpdateNewCustomQuery(data json.RawMessage) (*UpdateNewCustomQuery, error) { - var resp UpdateNewCustomQuery + var resp UpdateNewCustomQuery - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTestInt(data json.RawMessage) (*TestInt, error) { - var resp TestInt + var resp TestInt - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTestString(data json.RawMessage) (*TestString, error) { - var resp TestString + var resp TestString - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTestBytes(data json.RawMessage) (*TestBytes, error) { - var resp TestBytes + var resp TestBytes - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTestVectorInt(data json.RawMessage) (*TestVectorInt, error) { - var resp TestVectorInt + var resp TestVectorInt - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTestVectorIntObject(data json.RawMessage) (*TestVectorIntObject, error) { - var resp TestVectorIntObject + var resp TestVectorIntObject - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTestVectorString(data json.RawMessage) (*TestVectorString, error) { - var resp TestVectorString + var resp TestVectorString - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalTestVectorStringObject(data json.RawMessage) (*TestVectorStringObject, error) { - var resp TestVectorStringObject + var resp TestVectorStringObject - err := json.Unmarshal(data, &resp) + err := json.Unmarshal(data, &resp) - return &resp, err + return &resp, err } func UnmarshalType(data json.RawMessage) (Type, error) { - var meta meta + var meta meta - err := json.Unmarshal(data, &meta) - if err != nil { - return nil, err - } + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } - switch meta.Type { - case TypeError: - return UnmarshalError(data) + switch meta.Type { + case TypeError: + return UnmarshalError(data) - case TypeOk: - return UnmarshalOk(data) + case TypeOk: + return UnmarshalOk(data) - case TypeTdlibParameters: - return UnmarshalTdlibParameters(data) + case TypeTdlibParameters: + return UnmarshalTdlibParameters(data) - case TypeAuthenticationCodeTypeTelegramMessage: - return UnmarshalAuthenticationCodeTypeTelegramMessage(data) + case TypeAuthenticationCodeTypeTelegramMessage: + return UnmarshalAuthenticationCodeTypeTelegramMessage(data) - case TypeAuthenticationCodeTypeSms: - return UnmarshalAuthenticationCodeTypeSms(data) + case TypeAuthenticationCodeTypeSms: + return UnmarshalAuthenticationCodeTypeSms(data) - case TypeAuthenticationCodeTypeCall: - return UnmarshalAuthenticationCodeTypeCall(data) + case TypeAuthenticationCodeTypeCall: + return UnmarshalAuthenticationCodeTypeCall(data) - case TypeAuthenticationCodeTypeFlashCall: - return UnmarshalAuthenticationCodeTypeFlashCall(data) + case TypeAuthenticationCodeTypeFlashCall: + return UnmarshalAuthenticationCodeTypeFlashCall(data) - case TypeAuthenticationCodeInfo: - return UnmarshalAuthenticationCodeInfo(data) + case TypeAuthenticationCodeInfo: + return UnmarshalAuthenticationCodeInfo(data) - case TypeEmailAddressAuthenticationCodeInfo: - return UnmarshalEmailAddressAuthenticationCodeInfo(data) + case TypeEmailAddressAuthenticationCodeInfo: + return UnmarshalEmailAddressAuthenticationCodeInfo(data) - case TypeTextEntity: - return UnmarshalTextEntity(data) + case TypeTextEntity: + return UnmarshalTextEntity(data) - case TypeTextEntities: - return UnmarshalTextEntities(data) + case TypeTextEntities: + return UnmarshalTextEntities(data) - case TypeFormattedText: - return UnmarshalFormattedText(data) + case TypeFormattedText: + return UnmarshalFormattedText(data) - case TypeTermsOfService: - return UnmarshalTermsOfService(data) + case TypeTermsOfService: + return UnmarshalTermsOfService(data) - case TypeAuthorizationStateWaitTdlibParameters: - return UnmarshalAuthorizationStateWaitTdlibParameters(data) + case TypeAuthorizationStateWaitTdlibParameters: + return UnmarshalAuthorizationStateWaitTdlibParameters(data) - case TypeAuthorizationStateWaitEncryptionKey: - return UnmarshalAuthorizationStateWaitEncryptionKey(data) + case TypeAuthorizationStateWaitEncryptionKey: + return UnmarshalAuthorizationStateWaitEncryptionKey(data) - case TypeAuthorizationStateWaitPhoneNumber: - return UnmarshalAuthorizationStateWaitPhoneNumber(data) + case TypeAuthorizationStateWaitPhoneNumber: + return UnmarshalAuthorizationStateWaitPhoneNumber(data) - case TypeAuthorizationStateWaitCode: - return UnmarshalAuthorizationStateWaitCode(data) + case TypeAuthorizationStateWaitCode: + return UnmarshalAuthorizationStateWaitCode(data) - case TypeAuthorizationStateWaitPassword: - return UnmarshalAuthorizationStateWaitPassword(data) + case TypeAuthorizationStateWaitPassword: + return UnmarshalAuthorizationStateWaitPassword(data) - case TypeAuthorizationStateReady: - return UnmarshalAuthorizationStateReady(data) + case TypeAuthorizationStateReady: + return UnmarshalAuthorizationStateReady(data) - case TypeAuthorizationStateLoggingOut: - return UnmarshalAuthorizationStateLoggingOut(data) + case TypeAuthorizationStateLoggingOut: + return UnmarshalAuthorizationStateLoggingOut(data) - case TypeAuthorizationStateClosing: - return UnmarshalAuthorizationStateClosing(data) + case TypeAuthorizationStateClosing: + return UnmarshalAuthorizationStateClosing(data) - case TypeAuthorizationStateClosed: - return UnmarshalAuthorizationStateClosed(data) + case TypeAuthorizationStateClosed: + return UnmarshalAuthorizationStateClosed(data) - case TypePasswordState: - return UnmarshalPasswordState(data) + case TypePasswordState: + return UnmarshalPasswordState(data) - case TypeRecoveryEmailAddress: - return UnmarshalRecoveryEmailAddress(data) + case TypeRecoveryEmailAddress: + return UnmarshalRecoveryEmailAddress(data) - case TypeTemporaryPasswordState: - return UnmarshalTemporaryPasswordState(data) + case TypeTemporaryPasswordState: + return UnmarshalTemporaryPasswordState(data) - case TypeLocalFile: - return UnmarshalLocalFile(data) + case TypeLocalFile: + return UnmarshalLocalFile(data) - case TypeRemoteFile: - return UnmarshalRemoteFile(data) + case TypeRemoteFile: + return UnmarshalRemoteFile(data) - case TypeFile: - return UnmarshalFile(data) + case TypeFile: + return UnmarshalFile(data) - case TypeInputFileId: - return UnmarshalInputFileId(data) + case TypeInputFileId: + return UnmarshalInputFileId(data) - case TypeInputFileRemote: - return UnmarshalInputFileRemote(data) + case TypeInputFileRemote: + return UnmarshalInputFileRemote(data) - case TypeInputFileLocal: - return UnmarshalInputFileLocal(data) + case TypeInputFileLocal: + return UnmarshalInputFileLocal(data) - case TypeInputFileGenerated: - return UnmarshalInputFileGenerated(data) + case TypeInputFileGenerated: + return UnmarshalInputFileGenerated(data) - case TypePhotoSize: - return UnmarshalPhotoSize(data) + case TypePhotoSize: + return UnmarshalPhotoSize(data) - case TypeMaskPointForehead: - return UnmarshalMaskPointForehead(data) + case TypeMaskPointForehead: + return UnmarshalMaskPointForehead(data) - case TypeMaskPointEyes: - return UnmarshalMaskPointEyes(data) + case TypeMaskPointEyes: + return UnmarshalMaskPointEyes(data) - case TypeMaskPointMouth: - return UnmarshalMaskPointMouth(data) + case TypeMaskPointMouth: + return UnmarshalMaskPointMouth(data) - case TypeMaskPointChin: - return UnmarshalMaskPointChin(data) + case TypeMaskPointChin: + return UnmarshalMaskPointChin(data) - case TypeMaskPosition: - return UnmarshalMaskPosition(data) + case TypeMaskPosition: + return UnmarshalMaskPosition(data) - case TypeAnimation: - return UnmarshalAnimation(data) + case TypeAnimation: + return UnmarshalAnimation(data) - case TypeAudio: - return UnmarshalAudio(data) + case TypeAudio: + return UnmarshalAudio(data) - case TypeDocument: - return UnmarshalDocument(data) + case TypeDocument: + return UnmarshalDocument(data) - case TypePhoto: - return UnmarshalPhoto(data) + case TypePhoto: + return UnmarshalPhoto(data) - case TypeSticker: - return UnmarshalSticker(data) + case TypeSticker: + return UnmarshalSticker(data) - case TypeVideo: - return UnmarshalVideo(data) + case TypeVideo: + return UnmarshalVideo(data) - case TypeVideoNote: - return UnmarshalVideoNote(data) + case TypeVideoNote: + return UnmarshalVideoNote(data) - case TypeVoiceNote: - return UnmarshalVoiceNote(data) + case TypeVoiceNote: + return UnmarshalVoiceNote(data) - case TypeContact: - return UnmarshalContact(data) + case TypeContact: + return UnmarshalContact(data) - case TypeLocation: - return UnmarshalLocation(data) + case TypeLocation: + return UnmarshalLocation(data) - case TypeVenue: - return UnmarshalVenue(data) + case TypeVenue: + return UnmarshalVenue(data) - case TypeGame: - return UnmarshalGame(data) + case TypeGame: + return UnmarshalGame(data) - case TypeProfilePhoto: - return UnmarshalProfilePhoto(data) + case TypeProfilePhoto: + return UnmarshalProfilePhoto(data) - case TypeChatPhoto: - return UnmarshalChatPhoto(data) + case TypeChatPhoto: + return UnmarshalChatPhoto(data) - case TypeLinkStateNone: - return UnmarshalLinkStateNone(data) + case TypeLinkStateNone: + return UnmarshalLinkStateNone(data) - case TypeLinkStateKnowsPhoneNumber: - return UnmarshalLinkStateKnowsPhoneNumber(data) + case TypeLinkStateKnowsPhoneNumber: + return UnmarshalLinkStateKnowsPhoneNumber(data) - case TypeLinkStateIsContact: - return UnmarshalLinkStateIsContact(data) + case TypeLinkStateIsContact: + return UnmarshalLinkStateIsContact(data) - case TypeUserTypeRegular: - return UnmarshalUserTypeRegular(data) + case TypeUserTypeRegular: + return UnmarshalUserTypeRegular(data) - case TypeUserTypeDeleted: - return UnmarshalUserTypeDeleted(data) + case TypeUserTypeDeleted: + return UnmarshalUserTypeDeleted(data) - case TypeUserTypeBot: - return UnmarshalUserTypeBot(data) + case TypeUserTypeBot: + return UnmarshalUserTypeBot(data) - case TypeUserTypeUnknown: - return UnmarshalUserTypeUnknown(data) + case TypeUserTypeUnknown: + return UnmarshalUserTypeUnknown(data) - case TypeBotCommand: - return UnmarshalBotCommand(data) + case TypeBotCommand: + return UnmarshalBotCommand(data) - case TypeBotInfo: - return UnmarshalBotInfo(data) + case TypeBotInfo: + return UnmarshalBotInfo(data) - case TypeUser: - return UnmarshalUser(data) + case TypeUser: + return UnmarshalUser(data) - case TypeUserFullInfo: - return UnmarshalUserFullInfo(data) + case TypeUserFullInfo: + return UnmarshalUserFullInfo(data) - case TypeUserProfilePhotos: - return UnmarshalUserProfilePhotos(data) + case TypeUserProfilePhotos: + return UnmarshalUserProfilePhotos(data) - case TypeUsers: - return UnmarshalUsers(data) + case TypeUsers: + return UnmarshalUsers(data) - case TypeChatMemberStatusCreator: - return UnmarshalChatMemberStatusCreator(data) + case TypeChatMemberStatusCreator: + return UnmarshalChatMemberStatusCreator(data) - case TypeChatMemberStatusAdministrator: - return UnmarshalChatMemberStatusAdministrator(data) + case TypeChatMemberStatusAdministrator: + return UnmarshalChatMemberStatusAdministrator(data) - case TypeChatMemberStatusMember: - return UnmarshalChatMemberStatusMember(data) + case TypeChatMemberStatusMember: + return UnmarshalChatMemberStatusMember(data) - case TypeChatMemberStatusRestricted: - return UnmarshalChatMemberStatusRestricted(data) + case TypeChatMemberStatusRestricted: + return UnmarshalChatMemberStatusRestricted(data) - case TypeChatMemberStatusLeft: - return UnmarshalChatMemberStatusLeft(data) + case TypeChatMemberStatusLeft: + return UnmarshalChatMemberStatusLeft(data) - case TypeChatMemberStatusBanned: - return UnmarshalChatMemberStatusBanned(data) + case TypeChatMemberStatusBanned: + return UnmarshalChatMemberStatusBanned(data) - case TypeChatMember: - return UnmarshalChatMember(data) + case TypeChatMember: + return UnmarshalChatMember(data) - case TypeChatMembers: - return UnmarshalChatMembers(data) + case TypeChatMembers: + return UnmarshalChatMembers(data) - case TypeChatMembersFilterAdministrators: - return UnmarshalChatMembersFilterAdministrators(data) + case TypeChatMembersFilterAdministrators: + return UnmarshalChatMembersFilterAdministrators(data) - case TypeChatMembersFilterMembers: - return UnmarshalChatMembersFilterMembers(data) + case TypeChatMembersFilterMembers: + return UnmarshalChatMembersFilterMembers(data) - case TypeChatMembersFilterRestricted: - return UnmarshalChatMembersFilterRestricted(data) + case TypeChatMembersFilterRestricted: + return UnmarshalChatMembersFilterRestricted(data) - case TypeChatMembersFilterBanned: - return UnmarshalChatMembersFilterBanned(data) + case TypeChatMembersFilterBanned: + return UnmarshalChatMembersFilterBanned(data) - case TypeChatMembersFilterBots: - return UnmarshalChatMembersFilterBots(data) + case TypeChatMembersFilterBots: + return UnmarshalChatMembersFilterBots(data) - case TypeSupergroupMembersFilterRecent: - return UnmarshalSupergroupMembersFilterRecent(data) + case TypeSupergroupMembersFilterRecent: + return UnmarshalSupergroupMembersFilterRecent(data) - case TypeSupergroupMembersFilterAdministrators: - return UnmarshalSupergroupMembersFilterAdministrators(data) + case TypeSupergroupMembersFilterAdministrators: + return UnmarshalSupergroupMembersFilterAdministrators(data) - case TypeSupergroupMembersFilterSearch: - return UnmarshalSupergroupMembersFilterSearch(data) + case TypeSupergroupMembersFilterSearch: + return UnmarshalSupergroupMembersFilterSearch(data) - case TypeSupergroupMembersFilterRestricted: - return UnmarshalSupergroupMembersFilterRestricted(data) + case TypeSupergroupMembersFilterRestricted: + return UnmarshalSupergroupMembersFilterRestricted(data) - case TypeSupergroupMembersFilterBanned: - return UnmarshalSupergroupMembersFilterBanned(data) + case TypeSupergroupMembersFilterBanned: + return UnmarshalSupergroupMembersFilterBanned(data) - case TypeSupergroupMembersFilterBots: - return UnmarshalSupergroupMembersFilterBots(data) + case TypeSupergroupMembersFilterBots: + return UnmarshalSupergroupMembersFilterBots(data) - case TypeBasicGroup: - return UnmarshalBasicGroup(data) + case TypeBasicGroup: + return UnmarshalBasicGroup(data) - case TypeBasicGroupFullInfo: - return UnmarshalBasicGroupFullInfo(data) + case TypeBasicGroupFullInfo: + return UnmarshalBasicGroupFullInfo(data) - case TypeSupergroup: - return UnmarshalSupergroup(data) + case TypeSupergroup: + return UnmarshalSupergroup(data) - case TypeSupergroupFullInfo: - return UnmarshalSupergroupFullInfo(data) + case TypeSupergroupFullInfo: + return UnmarshalSupergroupFullInfo(data) - case TypeSecretChatStatePending: - return UnmarshalSecretChatStatePending(data) + case TypeSecretChatStatePending: + return UnmarshalSecretChatStatePending(data) - case TypeSecretChatStateReady: - return UnmarshalSecretChatStateReady(data) + case TypeSecretChatStateReady: + return UnmarshalSecretChatStateReady(data) - case TypeSecretChatStateClosed: - return UnmarshalSecretChatStateClosed(data) + case TypeSecretChatStateClosed: + return UnmarshalSecretChatStateClosed(data) - case TypeSecretChat: - return UnmarshalSecretChat(data) + case TypeSecretChat: + return UnmarshalSecretChat(data) - case TypeMessageForwardedFromUser: - return UnmarshalMessageForwardedFromUser(data) + case TypeMessageForwardedFromUser: + return UnmarshalMessageForwardedFromUser(data) - case TypeMessageForwardedPost: - return UnmarshalMessageForwardedPost(data) + case TypeMessageForwardedPost: + return UnmarshalMessageForwardedPost(data) - case TypeMessageSendingStatePending: - return UnmarshalMessageSendingStatePending(data) + case TypeMessageSendingStatePending: + return UnmarshalMessageSendingStatePending(data) - case TypeMessageSendingStateFailed: - return UnmarshalMessageSendingStateFailed(data) + case TypeMessageSendingStateFailed: + return UnmarshalMessageSendingStateFailed(data) - case TypeMessage: - return UnmarshalMessage(data) + case TypeMessage: + return UnmarshalMessage(data) - case TypeMessages: - return UnmarshalMessages(data) + case TypeMessages: + return UnmarshalMessages(data) - case TypeFoundMessages: - return UnmarshalFoundMessages(data) + case TypeFoundMessages: + return UnmarshalFoundMessages(data) - case TypeNotificationSettingsScopePrivateChats: - return UnmarshalNotificationSettingsScopePrivateChats(data) + case TypeNotificationSettingsScopePrivateChats: + return UnmarshalNotificationSettingsScopePrivateChats(data) - case TypeNotificationSettingsScopeGroupChats: - return UnmarshalNotificationSettingsScopeGroupChats(data) + case TypeNotificationSettingsScopeGroupChats: + return UnmarshalNotificationSettingsScopeGroupChats(data) - case TypeChatNotificationSettings: - return UnmarshalChatNotificationSettings(data) + case TypeChatNotificationSettings: + return UnmarshalChatNotificationSettings(data) - case TypeScopeNotificationSettings: - return UnmarshalScopeNotificationSettings(data) + case TypeScopeNotificationSettings: + return UnmarshalScopeNotificationSettings(data) - case TypeDraftMessage: - return UnmarshalDraftMessage(data) + case TypeDraftMessage: + return UnmarshalDraftMessage(data) - case TypeChatTypePrivate: - return UnmarshalChatTypePrivate(data) + case TypeChatTypePrivate: + return UnmarshalChatTypePrivate(data) - case TypeChatTypeBasicGroup: - return UnmarshalChatTypeBasicGroup(data) + case TypeChatTypeBasicGroup: + return UnmarshalChatTypeBasicGroup(data) - case TypeChatTypeSupergroup: - return UnmarshalChatTypeSupergroup(data) + case TypeChatTypeSupergroup: + return UnmarshalChatTypeSupergroup(data) - case TypeChatTypeSecret: - return UnmarshalChatTypeSecret(data) + case TypeChatTypeSecret: + return UnmarshalChatTypeSecret(data) - case TypeChat: - return UnmarshalChat(data) + case TypeChat: + return UnmarshalChat(data) - case TypeChats: - return UnmarshalChats(data) + case TypeChats: + return UnmarshalChats(data) - case TypeChatInviteLink: - return UnmarshalChatInviteLink(data) + case TypeChatInviteLink: + return UnmarshalChatInviteLink(data) - case TypeChatInviteLinkInfo: - return UnmarshalChatInviteLinkInfo(data) + case TypeChatInviteLinkInfo: + return UnmarshalChatInviteLinkInfo(data) - case TypeKeyboardButtonTypeText: - return UnmarshalKeyboardButtonTypeText(data) + case TypeKeyboardButtonTypeText: + return UnmarshalKeyboardButtonTypeText(data) - case TypeKeyboardButtonTypeRequestPhoneNumber: - return UnmarshalKeyboardButtonTypeRequestPhoneNumber(data) + case TypeKeyboardButtonTypeRequestPhoneNumber: + return UnmarshalKeyboardButtonTypeRequestPhoneNumber(data) - case TypeKeyboardButtonTypeRequestLocation: - return UnmarshalKeyboardButtonTypeRequestLocation(data) + case TypeKeyboardButtonTypeRequestLocation: + return UnmarshalKeyboardButtonTypeRequestLocation(data) - case TypeKeyboardButton: - return UnmarshalKeyboardButton(data) + case TypeKeyboardButton: + return UnmarshalKeyboardButton(data) - case TypeInlineKeyboardButtonTypeUrl: - return UnmarshalInlineKeyboardButtonTypeUrl(data) + case TypeInlineKeyboardButtonTypeUrl: + return UnmarshalInlineKeyboardButtonTypeUrl(data) - case TypeInlineKeyboardButtonTypeCallback: - return UnmarshalInlineKeyboardButtonTypeCallback(data) + case TypeInlineKeyboardButtonTypeCallback: + return UnmarshalInlineKeyboardButtonTypeCallback(data) - case TypeInlineKeyboardButtonTypeCallbackGame: - return UnmarshalInlineKeyboardButtonTypeCallbackGame(data) + case TypeInlineKeyboardButtonTypeCallbackGame: + return UnmarshalInlineKeyboardButtonTypeCallbackGame(data) - case TypeInlineKeyboardButtonTypeSwitchInline: - return UnmarshalInlineKeyboardButtonTypeSwitchInline(data) + case TypeInlineKeyboardButtonTypeSwitchInline: + return UnmarshalInlineKeyboardButtonTypeSwitchInline(data) - case TypeInlineKeyboardButtonTypeBuy: - return UnmarshalInlineKeyboardButtonTypeBuy(data) + case TypeInlineKeyboardButtonTypeBuy: + return UnmarshalInlineKeyboardButtonTypeBuy(data) - case TypeInlineKeyboardButton: - return UnmarshalInlineKeyboardButton(data) + case TypeInlineKeyboardButton: + return UnmarshalInlineKeyboardButton(data) - case TypeReplyMarkupRemoveKeyboard: - return UnmarshalReplyMarkupRemoveKeyboard(data) + case TypeReplyMarkupRemoveKeyboard: + return UnmarshalReplyMarkupRemoveKeyboard(data) - case TypeReplyMarkupForceReply: - return UnmarshalReplyMarkupForceReply(data) + case TypeReplyMarkupForceReply: + return UnmarshalReplyMarkupForceReply(data) - case TypeReplyMarkupShowKeyboard: - return UnmarshalReplyMarkupShowKeyboard(data) + case TypeReplyMarkupShowKeyboard: + return UnmarshalReplyMarkupShowKeyboard(data) - case TypeReplyMarkupInlineKeyboard: - return UnmarshalReplyMarkupInlineKeyboard(data) + case TypeReplyMarkupInlineKeyboard: + return UnmarshalReplyMarkupInlineKeyboard(data) - case TypeRichTextPlain: - return UnmarshalRichTextPlain(data) + case TypeRichTextPlain: + return UnmarshalRichTextPlain(data) - case TypeRichTextBold: - return UnmarshalRichTextBold(data) + case TypeRichTextBold: + return UnmarshalRichTextBold(data) - case TypeRichTextItalic: - return UnmarshalRichTextItalic(data) + case TypeRichTextItalic: + return UnmarshalRichTextItalic(data) - case TypeRichTextUnderline: - return UnmarshalRichTextUnderline(data) + case TypeRichTextUnderline: + return UnmarshalRichTextUnderline(data) - case TypeRichTextStrikethrough: - return UnmarshalRichTextStrikethrough(data) + case TypeRichTextStrikethrough: + return UnmarshalRichTextStrikethrough(data) - case TypeRichTextFixed: - return UnmarshalRichTextFixed(data) + case TypeRichTextFixed: + return UnmarshalRichTextFixed(data) - case TypeRichTextUrl: - return UnmarshalRichTextUrl(data) + case TypeRichTextUrl: + return UnmarshalRichTextUrl(data) - case TypeRichTextEmailAddress: - return UnmarshalRichTextEmailAddress(data) + case TypeRichTextEmailAddress: + return UnmarshalRichTextEmailAddress(data) - case TypeRichTexts: - return UnmarshalRichTexts(data) + case TypeRichTexts: + return UnmarshalRichTexts(data) - case TypePageBlockTitle: - return UnmarshalPageBlockTitle(data) + case TypePageBlockTitle: + return UnmarshalPageBlockTitle(data) - case TypePageBlockSubtitle: - return UnmarshalPageBlockSubtitle(data) + case TypePageBlockSubtitle: + return UnmarshalPageBlockSubtitle(data) - case TypePageBlockAuthorDate: - return UnmarshalPageBlockAuthorDate(data) + case TypePageBlockAuthorDate: + return UnmarshalPageBlockAuthorDate(data) - case TypePageBlockHeader: - return UnmarshalPageBlockHeader(data) + case TypePageBlockHeader: + return UnmarshalPageBlockHeader(data) - case TypePageBlockSubheader: - return UnmarshalPageBlockSubheader(data) + case TypePageBlockSubheader: + return UnmarshalPageBlockSubheader(data) - case TypePageBlockParagraph: - return UnmarshalPageBlockParagraph(data) + case TypePageBlockParagraph: + return UnmarshalPageBlockParagraph(data) - case TypePageBlockPreformatted: - return UnmarshalPageBlockPreformatted(data) + case TypePageBlockPreformatted: + return UnmarshalPageBlockPreformatted(data) - case TypePageBlockFooter: - return UnmarshalPageBlockFooter(data) + case TypePageBlockFooter: + return UnmarshalPageBlockFooter(data) - case TypePageBlockDivider: - return UnmarshalPageBlockDivider(data) + case TypePageBlockDivider: + return UnmarshalPageBlockDivider(data) - case TypePageBlockAnchor: - return UnmarshalPageBlockAnchor(data) + case TypePageBlockAnchor: + return UnmarshalPageBlockAnchor(data) - case TypePageBlockList: - return UnmarshalPageBlockList(data) + case TypePageBlockList: + return UnmarshalPageBlockList(data) - case TypePageBlockBlockQuote: - return UnmarshalPageBlockBlockQuote(data) + case TypePageBlockBlockQuote: + return UnmarshalPageBlockBlockQuote(data) - case TypePageBlockPullQuote: - return UnmarshalPageBlockPullQuote(data) + case TypePageBlockPullQuote: + return UnmarshalPageBlockPullQuote(data) - case TypePageBlockAnimation: - return UnmarshalPageBlockAnimation(data) + case TypePageBlockAnimation: + return UnmarshalPageBlockAnimation(data) - case TypePageBlockAudio: - return UnmarshalPageBlockAudio(data) + case TypePageBlockAudio: + return UnmarshalPageBlockAudio(data) - case TypePageBlockPhoto: - return UnmarshalPageBlockPhoto(data) + case TypePageBlockPhoto: + return UnmarshalPageBlockPhoto(data) - case TypePageBlockVideo: - return UnmarshalPageBlockVideo(data) + case TypePageBlockVideo: + return UnmarshalPageBlockVideo(data) - case TypePageBlockCover: - return UnmarshalPageBlockCover(data) + case TypePageBlockCover: + return UnmarshalPageBlockCover(data) - case TypePageBlockEmbedded: - return UnmarshalPageBlockEmbedded(data) + case TypePageBlockEmbedded: + return UnmarshalPageBlockEmbedded(data) - case TypePageBlockEmbeddedPost: - return UnmarshalPageBlockEmbeddedPost(data) + case TypePageBlockEmbeddedPost: + return UnmarshalPageBlockEmbeddedPost(data) - case TypePageBlockCollage: - return UnmarshalPageBlockCollage(data) + case TypePageBlockCollage: + return UnmarshalPageBlockCollage(data) - case TypePageBlockSlideshow: - return UnmarshalPageBlockSlideshow(data) + case TypePageBlockSlideshow: + return UnmarshalPageBlockSlideshow(data) - case TypePageBlockChatLink: - return UnmarshalPageBlockChatLink(data) + case TypePageBlockChatLink: + return UnmarshalPageBlockChatLink(data) - case TypeWebPageInstantView: - return UnmarshalWebPageInstantView(data) + case TypeWebPageInstantView: + return UnmarshalWebPageInstantView(data) - case TypeWebPage: - return UnmarshalWebPage(data) + case TypeWebPage: + return UnmarshalWebPage(data) - case TypeAddress: - return UnmarshalAddress(data) + case TypeAddress: + return UnmarshalAddress(data) - case TypeLabeledPricePart: - return UnmarshalLabeledPricePart(data) + case TypeLabeledPricePart: + return UnmarshalLabeledPricePart(data) - case TypeInvoice: - return UnmarshalInvoice(data) + case TypeInvoice: + return UnmarshalInvoice(data) - case TypeOrderInfo: - return UnmarshalOrderInfo(data) + case TypeOrderInfo: + return UnmarshalOrderInfo(data) - case TypeShippingOption: - return UnmarshalShippingOption(data) + case TypeShippingOption: + return UnmarshalShippingOption(data) - case TypeSavedCredentials: - return UnmarshalSavedCredentials(data) + case TypeSavedCredentials: + return UnmarshalSavedCredentials(data) - case TypeInputCredentialsSaved: - return UnmarshalInputCredentialsSaved(data) + case TypeInputCredentialsSaved: + return UnmarshalInputCredentialsSaved(data) - case TypeInputCredentialsNew: - return UnmarshalInputCredentialsNew(data) + case TypeInputCredentialsNew: + return UnmarshalInputCredentialsNew(data) - case TypeInputCredentialsAndroidPay: - return UnmarshalInputCredentialsAndroidPay(data) + case TypeInputCredentialsAndroidPay: + return UnmarshalInputCredentialsAndroidPay(data) - case TypeInputCredentialsApplePay: - return UnmarshalInputCredentialsApplePay(data) + case TypeInputCredentialsApplePay: + return UnmarshalInputCredentialsApplePay(data) - case TypePaymentsProviderStripe: - return UnmarshalPaymentsProviderStripe(data) + case TypePaymentsProviderStripe: + return UnmarshalPaymentsProviderStripe(data) - case TypePaymentForm: - return UnmarshalPaymentForm(data) + case TypePaymentForm: + return UnmarshalPaymentForm(data) - case TypeValidatedOrderInfo: - return UnmarshalValidatedOrderInfo(data) + case TypeValidatedOrderInfo: + return UnmarshalValidatedOrderInfo(data) - case TypePaymentResult: - return UnmarshalPaymentResult(data) + case TypePaymentResult: + return UnmarshalPaymentResult(data) - case TypePaymentReceipt: - return UnmarshalPaymentReceipt(data) + case TypePaymentReceipt: + return UnmarshalPaymentReceipt(data) - case TypeDatedFile: - return UnmarshalDatedFile(data) + case TypeDatedFile: + return UnmarshalDatedFile(data) - case TypePassportElementTypePersonalDetails: - return UnmarshalPassportElementTypePersonalDetails(data) + case TypePassportElementTypePersonalDetails: + return UnmarshalPassportElementTypePersonalDetails(data) - case TypePassportElementTypePassport: - return UnmarshalPassportElementTypePassport(data) + case TypePassportElementTypePassport: + return UnmarshalPassportElementTypePassport(data) - case TypePassportElementTypeDriverLicense: - return UnmarshalPassportElementTypeDriverLicense(data) + case TypePassportElementTypeDriverLicense: + return UnmarshalPassportElementTypeDriverLicense(data) - case TypePassportElementTypeIdentityCard: - return UnmarshalPassportElementTypeIdentityCard(data) + case TypePassportElementTypeIdentityCard: + return UnmarshalPassportElementTypeIdentityCard(data) - case TypePassportElementTypeInternalPassport: - return UnmarshalPassportElementTypeInternalPassport(data) + case TypePassportElementTypeInternalPassport: + return UnmarshalPassportElementTypeInternalPassport(data) - case TypePassportElementTypeAddress: - return UnmarshalPassportElementTypeAddress(data) + case TypePassportElementTypeAddress: + return UnmarshalPassportElementTypeAddress(data) - case TypePassportElementTypeUtilityBill: - return UnmarshalPassportElementTypeUtilityBill(data) + case TypePassportElementTypeUtilityBill: + return UnmarshalPassportElementTypeUtilityBill(data) - case TypePassportElementTypeBankStatement: - return UnmarshalPassportElementTypeBankStatement(data) + case TypePassportElementTypeBankStatement: + return UnmarshalPassportElementTypeBankStatement(data) - case TypePassportElementTypeRentalAgreement: - return UnmarshalPassportElementTypeRentalAgreement(data) + case TypePassportElementTypeRentalAgreement: + return UnmarshalPassportElementTypeRentalAgreement(data) - case TypePassportElementTypePassportRegistration: - return UnmarshalPassportElementTypePassportRegistration(data) + case TypePassportElementTypePassportRegistration: + return UnmarshalPassportElementTypePassportRegistration(data) - case TypePassportElementTypeTemporaryRegistration: - return UnmarshalPassportElementTypeTemporaryRegistration(data) + case TypePassportElementTypeTemporaryRegistration: + return UnmarshalPassportElementTypeTemporaryRegistration(data) - case TypePassportElementTypePhoneNumber: - return UnmarshalPassportElementTypePhoneNumber(data) + case TypePassportElementTypePhoneNumber: + return UnmarshalPassportElementTypePhoneNumber(data) - case TypePassportElementTypeEmailAddress: - return UnmarshalPassportElementTypeEmailAddress(data) + case TypePassportElementTypeEmailAddress: + return UnmarshalPassportElementTypeEmailAddress(data) - case TypeDate: - return UnmarshalDate(data) + case TypeDate: + return UnmarshalDate(data) - case TypePersonalDetails: - return UnmarshalPersonalDetails(data) + case TypePersonalDetails: + return UnmarshalPersonalDetails(data) - case TypeIdentityDocument: - return UnmarshalIdentityDocument(data) + case TypeIdentityDocument: + return UnmarshalIdentityDocument(data) - case TypeInputIdentityDocument: - return UnmarshalInputIdentityDocument(data) + case TypeInputIdentityDocument: + return UnmarshalInputIdentityDocument(data) - case TypePersonalDocument: - return UnmarshalPersonalDocument(data) + case TypePersonalDocument: + return UnmarshalPersonalDocument(data) - case TypeInputPersonalDocument: - return UnmarshalInputPersonalDocument(data) + case TypeInputPersonalDocument: + return UnmarshalInputPersonalDocument(data) - case TypePassportElementPersonalDetails: - return UnmarshalPassportElementPersonalDetails(data) + case TypePassportElementPersonalDetails: + return UnmarshalPassportElementPersonalDetails(data) - case TypePassportElementPassport: - return UnmarshalPassportElementPassport(data) + case TypePassportElementPassport: + return UnmarshalPassportElementPassport(data) - case TypePassportElementDriverLicense: - return UnmarshalPassportElementDriverLicense(data) + case TypePassportElementDriverLicense: + return UnmarshalPassportElementDriverLicense(data) - case TypePassportElementIdentityCard: - return UnmarshalPassportElementIdentityCard(data) + case TypePassportElementIdentityCard: + return UnmarshalPassportElementIdentityCard(data) - case TypePassportElementInternalPassport: - return UnmarshalPassportElementInternalPassport(data) + case TypePassportElementInternalPassport: + return UnmarshalPassportElementInternalPassport(data) - case TypePassportElementAddress: - return UnmarshalPassportElementAddress(data) + case TypePassportElementAddress: + return UnmarshalPassportElementAddress(data) - case TypePassportElementUtilityBill: - return UnmarshalPassportElementUtilityBill(data) + case TypePassportElementUtilityBill: + return UnmarshalPassportElementUtilityBill(data) - case TypePassportElementBankStatement: - return UnmarshalPassportElementBankStatement(data) + case TypePassportElementBankStatement: + return UnmarshalPassportElementBankStatement(data) - case TypePassportElementRentalAgreement: - return UnmarshalPassportElementRentalAgreement(data) + case TypePassportElementRentalAgreement: + return UnmarshalPassportElementRentalAgreement(data) - case TypePassportElementPassportRegistration: - return UnmarshalPassportElementPassportRegistration(data) + case TypePassportElementPassportRegistration: + return UnmarshalPassportElementPassportRegistration(data) - case TypePassportElementTemporaryRegistration: - return UnmarshalPassportElementTemporaryRegistration(data) + case TypePassportElementTemporaryRegistration: + return UnmarshalPassportElementTemporaryRegistration(data) - case TypePassportElementPhoneNumber: - return UnmarshalPassportElementPhoneNumber(data) + case TypePassportElementPhoneNumber: + return UnmarshalPassportElementPhoneNumber(data) - case TypePassportElementEmailAddress: - return UnmarshalPassportElementEmailAddress(data) + case TypePassportElementEmailAddress: + return UnmarshalPassportElementEmailAddress(data) - case TypeInputPassportElementPersonalDetails: - return UnmarshalInputPassportElementPersonalDetails(data) + case TypeInputPassportElementPersonalDetails: + return UnmarshalInputPassportElementPersonalDetails(data) - case TypeInputPassportElementPassport: - return UnmarshalInputPassportElementPassport(data) + case TypeInputPassportElementPassport: + return UnmarshalInputPassportElementPassport(data) - case TypeInputPassportElementDriverLicense: - return UnmarshalInputPassportElementDriverLicense(data) + case TypeInputPassportElementDriverLicense: + return UnmarshalInputPassportElementDriverLicense(data) - case TypeInputPassportElementIdentityCard: - return UnmarshalInputPassportElementIdentityCard(data) + case TypeInputPassportElementIdentityCard: + return UnmarshalInputPassportElementIdentityCard(data) - case TypeInputPassportElementInternalPassport: - return UnmarshalInputPassportElementInternalPassport(data) + case TypeInputPassportElementInternalPassport: + return UnmarshalInputPassportElementInternalPassport(data) - case TypeInputPassportElementAddress: - return UnmarshalInputPassportElementAddress(data) + case TypeInputPassportElementAddress: + return UnmarshalInputPassportElementAddress(data) - case TypeInputPassportElementUtilityBill: - return UnmarshalInputPassportElementUtilityBill(data) + case TypeInputPassportElementUtilityBill: + return UnmarshalInputPassportElementUtilityBill(data) - case TypeInputPassportElementBankStatement: - return UnmarshalInputPassportElementBankStatement(data) + case TypeInputPassportElementBankStatement: + return UnmarshalInputPassportElementBankStatement(data) - case TypeInputPassportElementRentalAgreement: - return UnmarshalInputPassportElementRentalAgreement(data) + case TypeInputPassportElementRentalAgreement: + return UnmarshalInputPassportElementRentalAgreement(data) - case TypeInputPassportElementPassportRegistration: - return UnmarshalInputPassportElementPassportRegistration(data) + case TypeInputPassportElementPassportRegistration: + return UnmarshalInputPassportElementPassportRegistration(data) - case TypeInputPassportElementTemporaryRegistration: - return UnmarshalInputPassportElementTemporaryRegistration(data) + case TypeInputPassportElementTemporaryRegistration: + return UnmarshalInputPassportElementTemporaryRegistration(data) - case TypeInputPassportElementPhoneNumber: - return UnmarshalInputPassportElementPhoneNumber(data) + case TypeInputPassportElementPhoneNumber: + return UnmarshalInputPassportElementPhoneNumber(data) - case TypeInputPassportElementEmailAddress: - return UnmarshalInputPassportElementEmailAddress(data) + case TypeInputPassportElementEmailAddress: + return UnmarshalInputPassportElementEmailAddress(data) - case TypePassportElements: - return UnmarshalPassportElements(data) + case TypePassportElements: + return UnmarshalPassportElements(data) - case TypePassportElementErrorSourceUnspecified: - return UnmarshalPassportElementErrorSourceUnspecified(data) + case TypePassportElementErrorSourceUnspecified: + return UnmarshalPassportElementErrorSourceUnspecified(data) - case TypePassportElementErrorSourceDataField: - return UnmarshalPassportElementErrorSourceDataField(data) + case TypePassportElementErrorSourceDataField: + return UnmarshalPassportElementErrorSourceDataField(data) - case TypePassportElementErrorSourceFrontSide: - return UnmarshalPassportElementErrorSourceFrontSide(data) + case TypePassportElementErrorSourceFrontSide: + return UnmarshalPassportElementErrorSourceFrontSide(data) - case TypePassportElementErrorSourceReverseSide: - return UnmarshalPassportElementErrorSourceReverseSide(data) + case TypePassportElementErrorSourceReverseSide: + return UnmarshalPassportElementErrorSourceReverseSide(data) - case TypePassportElementErrorSourceSelfie: - return UnmarshalPassportElementErrorSourceSelfie(data) + case TypePassportElementErrorSourceSelfie: + return UnmarshalPassportElementErrorSourceSelfie(data) - case TypePassportElementErrorSourceTranslationFile: - return UnmarshalPassportElementErrorSourceTranslationFile(data) + case TypePassportElementErrorSourceTranslationFile: + return UnmarshalPassportElementErrorSourceTranslationFile(data) - case TypePassportElementErrorSourceTranslationFiles: - return UnmarshalPassportElementErrorSourceTranslationFiles(data) + case TypePassportElementErrorSourceTranslationFiles: + return UnmarshalPassportElementErrorSourceTranslationFiles(data) - case TypePassportElementErrorSourceFile: - return UnmarshalPassportElementErrorSourceFile(data) + case TypePassportElementErrorSourceFile: + return UnmarshalPassportElementErrorSourceFile(data) - case TypePassportElementErrorSourceFiles: - return UnmarshalPassportElementErrorSourceFiles(data) + case TypePassportElementErrorSourceFiles: + return UnmarshalPassportElementErrorSourceFiles(data) - case TypePassportElementError: - return UnmarshalPassportElementError(data) + case TypePassportElementError: + return UnmarshalPassportElementError(data) - case TypePassportSuitableElement: - return UnmarshalPassportSuitableElement(data) + case TypePassportSuitableElement: + return UnmarshalPassportSuitableElement(data) - case TypePassportRequiredElement: - return UnmarshalPassportRequiredElement(data) + case TypePassportRequiredElement: + return UnmarshalPassportRequiredElement(data) - case TypePassportAuthorizationForm: - return UnmarshalPassportAuthorizationForm(data) + case TypePassportAuthorizationForm: + return UnmarshalPassportAuthorizationForm(data) - case TypeEncryptedCredentials: - return UnmarshalEncryptedCredentials(data) + case TypeEncryptedCredentials: + return UnmarshalEncryptedCredentials(data) - case TypeEncryptedPassportElement: - return UnmarshalEncryptedPassportElement(data) + case TypeEncryptedPassportElement: + return UnmarshalEncryptedPassportElement(data) - case TypeInputPassportElementErrorSourceUnspecified: - return UnmarshalInputPassportElementErrorSourceUnspecified(data) + case TypeInputPassportElementErrorSourceUnspecified: + return UnmarshalInputPassportElementErrorSourceUnspecified(data) - case TypeInputPassportElementErrorSourceDataField: - return UnmarshalInputPassportElementErrorSourceDataField(data) + case TypeInputPassportElementErrorSourceDataField: + return UnmarshalInputPassportElementErrorSourceDataField(data) - case TypeInputPassportElementErrorSourceFrontSide: - return UnmarshalInputPassportElementErrorSourceFrontSide(data) + case TypeInputPassportElementErrorSourceFrontSide: + return UnmarshalInputPassportElementErrorSourceFrontSide(data) - case TypeInputPassportElementErrorSourceReverseSide: - return UnmarshalInputPassportElementErrorSourceReverseSide(data) + case TypeInputPassportElementErrorSourceReverseSide: + return UnmarshalInputPassportElementErrorSourceReverseSide(data) - case TypeInputPassportElementErrorSourceSelfie: - return UnmarshalInputPassportElementErrorSourceSelfie(data) + case TypeInputPassportElementErrorSourceSelfie: + return UnmarshalInputPassportElementErrorSourceSelfie(data) - case TypeInputPassportElementErrorSourceTranslationFile: - return UnmarshalInputPassportElementErrorSourceTranslationFile(data) + case TypeInputPassportElementErrorSourceTranslationFile: + return UnmarshalInputPassportElementErrorSourceTranslationFile(data) - case TypeInputPassportElementErrorSourceTranslationFiles: - return UnmarshalInputPassportElementErrorSourceTranslationFiles(data) + case TypeInputPassportElementErrorSourceTranslationFiles: + return UnmarshalInputPassportElementErrorSourceTranslationFiles(data) - case TypeInputPassportElementErrorSourceFile: - return UnmarshalInputPassportElementErrorSourceFile(data) + case TypeInputPassportElementErrorSourceFile: + return UnmarshalInputPassportElementErrorSourceFile(data) - case TypeInputPassportElementErrorSourceFiles: - return UnmarshalInputPassportElementErrorSourceFiles(data) + case TypeInputPassportElementErrorSourceFiles: + return UnmarshalInputPassportElementErrorSourceFiles(data) - case TypeInputPassportElementError: - return UnmarshalInputPassportElementError(data) + case TypeInputPassportElementError: + return UnmarshalInputPassportElementError(data) - case TypeMessageText: - return UnmarshalMessageText(data) + case TypeMessageText: + return UnmarshalMessageText(data) - case TypeMessageAnimation: - return UnmarshalMessageAnimation(data) + case TypeMessageAnimation: + return UnmarshalMessageAnimation(data) - case TypeMessageAudio: - return UnmarshalMessageAudio(data) + case TypeMessageAudio: + return UnmarshalMessageAudio(data) - case TypeMessageDocument: - return UnmarshalMessageDocument(data) + case TypeMessageDocument: + return UnmarshalMessageDocument(data) - case TypeMessagePhoto: - return UnmarshalMessagePhoto(data) + case TypeMessagePhoto: + return UnmarshalMessagePhoto(data) - case TypeMessageExpiredPhoto: - return UnmarshalMessageExpiredPhoto(data) + case TypeMessageExpiredPhoto: + return UnmarshalMessageExpiredPhoto(data) - case TypeMessageSticker: - return UnmarshalMessageSticker(data) + case TypeMessageSticker: + return UnmarshalMessageSticker(data) - case TypeMessageVideo: - return UnmarshalMessageVideo(data) + case TypeMessageVideo: + return UnmarshalMessageVideo(data) - case TypeMessageExpiredVideo: - return UnmarshalMessageExpiredVideo(data) + case TypeMessageExpiredVideo: + return UnmarshalMessageExpiredVideo(data) - case TypeMessageVideoNote: - return UnmarshalMessageVideoNote(data) + case TypeMessageVideoNote: + return UnmarshalMessageVideoNote(data) - case TypeMessageVoiceNote: - return UnmarshalMessageVoiceNote(data) + case TypeMessageVoiceNote: + return UnmarshalMessageVoiceNote(data) - case TypeMessageLocation: - return UnmarshalMessageLocation(data) + case TypeMessageLocation: + return UnmarshalMessageLocation(data) - case TypeMessageVenue: - return UnmarshalMessageVenue(data) + case TypeMessageVenue: + return UnmarshalMessageVenue(data) - case TypeMessageContact: - return UnmarshalMessageContact(data) + case TypeMessageContact: + return UnmarshalMessageContact(data) - case TypeMessageGame: - return UnmarshalMessageGame(data) + case TypeMessageGame: + return UnmarshalMessageGame(data) - case TypeMessageInvoice: - return UnmarshalMessageInvoice(data) + case TypeMessageInvoice: + return UnmarshalMessageInvoice(data) - case TypeMessageCall: - return UnmarshalMessageCall(data) + case TypeMessageCall: + return UnmarshalMessageCall(data) - case TypeMessageBasicGroupChatCreate: - return UnmarshalMessageBasicGroupChatCreate(data) + case TypeMessageBasicGroupChatCreate: + return UnmarshalMessageBasicGroupChatCreate(data) - case TypeMessageSupergroupChatCreate: - return UnmarshalMessageSupergroupChatCreate(data) + case TypeMessageSupergroupChatCreate: + return UnmarshalMessageSupergroupChatCreate(data) - case TypeMessageChatChangeTitle: - return UnmarshalMessageChatChangeTitle(data) + case TypeMessageChatChangeTitle: + return UnmarshalMessageChatChangeTitle(data) - case TypeMessageChatChangePhoto: - return UnmarshalMessageChatChangePhoto(data) + case TypeMessageChatChangePhoto: + return UnmarshalMessageChatChangePhoto(data) - case TypeMessageChatDeletePhoto: - return UnmarshalMessageChatDeletePhoto(data) + case TypeMessageChatDeletePhoto: + return UnmarshalMessageChatDeletePhoto(data) - case TypeMessageChatAddMembers: - return UnmarshalMessageChatAddMembers(data) + case TypeMessageChatAddMembers: + return UnmarshalMessageChatAddMembers(data) - case TypeMessageChatJoinByLink: - return UnmarshalMessageChatJoinByLink(data) + case TypeMessageChatJoinByLink: + return UnmarshalMessageChatJoinByLink(data) - case TypeMessageChatDeleteMember: - return UnmarshalMessageChatDeleteMember(data) + case TypeMessageChatDeleteMember: + return UnmarshalMessageChatDeleteMember(data) - case TypeMessageChatUpgradeTo: - return UnmarshalMessageChatUpgradeTo(data) + case TypeMessageChatUpgradeTo: + return UnmarshalMessageChatUpgradeTo(data) - case TypeMessageChatUpgradeFrom: - return UnmarshalMessageChatUpgradeFrom(data) + case TypeMessageChatUpgradeFrom: + return UnmarshalMessageChatUpgradeFrom(data) - case TypeMessagePinMessage: - return UnmarshalMessagePinMessage(data) + case TypeMessagePinMessage: + return UnmarshalMessagePinMessage(data) - case TypeMessageScreenshotTaken: - return UnmarshalMessageScreenshotTaken(data) + case TypeMessageScreenshotTaken: + return UnmarshalMessageScreenshotTaken(data) - case TypeMessageChatSetTtl: - return UnmarshalMessageChatSetTtl(data) + case TypeMessageChatSetTtl: + return UnmarshalMessageChatSetTtl(data) - case TypeMessageCustomServiceAction: - return UnmarshalMessageCustomServiceAction(data) + case TypeMessageCustomServiceAction: + return UnmarshalMessageCustomServiceAction(data) - case TypeMessageGameScore: - return UnmarshalMessageGameScore(data) + case TypeMessageGameScore: + return UnmarshalMessageGameScore(data) - case TypeMessagePaymentSuccessful: - return UnmarshalMessagePaymentSuccessful(data) + case TypeMessagePaymentSuccessful: + return UnmarshalMessagePaymentSuccessful(data) - case TypeMessagePaymentSuccessfulBot: - return UnmarshalMessagePaymentSuccessfulBot(data) + case TypeMessagePaymentSuccessfulBot: + return UnmarshalMessagePaymentSuccessfulBot(data) - case TypeMessageContactRegistered: - return UnmarshalMessageContactRegistered(data) + case TypeMessageContactRegistered: + return UnmarshalMessageContactRegistered(data) - case TypeMessageWebsiteConnected: - return UnmarshalMessageWebsiteConnected(data) + case TypeMessageWebsiteConnected: + return UnmarshalMessageWebsiteConnected(data) - case TypeMessagePassportDataSent: - return UnmarshalMessagePassportDataSent(data) + case TypeMessagePassportDataSent: + return UnmarshalMessagePassportDataSent(data) - case TypeMessagePassportDataReceived: - return UnmarshalMessagePassportDataReceived(data) + case TypeMessagePassportDataReceived: + return UnmarshalMessagePassportDataReceived(data) - case TypeMessageUnsupported: - return UnmarshalMessageUnsupported(data) + case TypeMessageUnsupported: + return UnmarshalMessageUnsupported(data) - case TypeTextEntityTypeMention: - return UnmarshalTextEntityTypeMention(data) + case TypeTextEntityTypeMention: + return UnmarshalTextEntityTypeMention(data) - case TypeTextEntityTypeHashtag: - return UnmarshalTextEntityTypeHashtag(data) + case TypeTextEntityTypeHashtag: + return UnmarshalTextEntityTypeHashtag(data) - case TypeTextEntityTypeCashtag: - return UnmarshalTextEntityTypeCashtag(data) + case TypeTextEntityTypeCashtag: + return UnmarshalTextEntityTypeCashtag(data) - case TypeTextEntityTypeBotCommand: - return UnmarshalTextEntityTypeBotCommand(data) + case TypeTextEntityTypeBotCommand: + return UnmarshalTextEntityTypeBotCommand(data) - case TypeTextEntityTypeUrl: - return UnmarshalTextEntityTypeUrl(data) + case TypeTextEntityTypeUrl: + return UnmarshalTextEntityTypeUrl(data) - case TypeTextEntityTypeEmailAddress: - return UnmarshalTextEntityTypeEmailAddress(data) + case TypeTextEntityTypeEmailAddress: + return UnmarshalTextEntityTypeEmailAddress(data) - case TypeTextEntityTypeBold: - return UnmarshalTextEntityTypeBold(data) + case TypeTextEntityTypeBold: + return UnmarshalTextEntityTypeBold(data) - case TypeTextEntityTypeItalic: - return UnmarshalTextEntityTypeItalic(data) + case TypeTextEntityTypeItalic: + return UnmarshalTextEntityTypeItalic(data) - case TypeTextEntityTypeCode: - return UnmarshalTextEntityTypeCode(data) + case TypeTextEntityTypeCode: + return UnmarshalTextEntityTypeCode(data) - case TypeTextEntityTypePre: - return UnmarshalTextEntityTypePre(data) + case TypeTextEntityTypePre: + return UnmarshalTextEntityTypePre(data) - case TypeTextEntityTypePreCode: - return UnmarshalTextEntityTypePreCode(data) + case TypeTextEntityTypePreCode: + return UnmarshalTextEntityTypePreCode(data) - case TypeTextEntityTypeTextUrl: - return UnmarshalTextEntityTypeTextUrl(data) + case TypeTextEntityTypeTextUrl: + return UnmarshalTextEntityTypeTextUrl(data) - case TypeTextEntityTypeMentionName: - return UnmarshalTextEntityTypeMentionName(data) + case TypeTextEntityTypeMentionName: + return UnmarshalTextEntityTypeMentionName(data) - case TypeTextEntityTypePhoneNumber: - return UnmarshalTextEntityTypePhoneNumber(data) + case TypeTextEntityTypePhoneNumber: + return UnmarshalTextEntityTypePhoneNumber(data) - case TypeInputThumbnail: - return UnmarshalInputThumbnail(data) + case TypeInputThumbnail: + return UnmarshalInputThumbnail(data) - case TypeInputMessageText: - return UnmarshalInputMessageText(data) + case TypeInputMessageText: + return UnmarshalInputMessageText(data) - case TypeInputMessageAnimation: - return UnmarshalInputMessageAnimation(data) + case TypeInputMessageAnimation: + return UnmarshalInputMessageAnimation(data) - case TypeInputMessageAudio: - return UnmarshalInputMessageAudio(data) + case TypeInputMessageAudio: + return UnmarshalInputMessageAudio(data) - case TypeInputMessageDocument: - return UnmarshalInputMessageDocument(data) + case TypeInputMessageDocument: + return UnmarshalInputMessageDocument(data) - case TypeInputMessagePhoto: - return UnmarshalInputMessagePhoto(data) + case TypeInputMessagePhoto: + return UnmarshalInputMessagePhoto(data) - case TypeInputMessageSticker: - return UnmarshalInputMessageSticker(data) + case TypeInputMessageSticker: + return UnmarshalInputMessageSticker(data) - case TypeInputMessageVideo: - return UnmarshalInputMessageVideo(data) + case TypeInputMessageVideo: + return UnmarshalInputMessageVideo(data) - case TypeInputMessageVideoNote: - return UnmarshalInputMessageVideoNote(data) + case TypeInputMessageVideoNote: + return UnmarshalInputMessageVideoNote(data) - case TypeInputMessageVoiceNote: - return UnmarshalInputMessageVoiceNote(data) + case TypeInputMessageVoiceNote: + return UnmarshalInputMessageVoiceNote(data) - case TypeInputMessageLocation: - return UnmarshalInputMessageLocation(data) + case TypeInputMessageLocation: + return UnmarshalInputMessageLocation(data) - case TypeInputMessageVenue: - return UnmarshalInputMessageVenue(data) + case TypeInputMessageVenue: + return UnmarshalInputMessageVenue(data) - case TypeInputMessageContact: - return UnmarshalInputMessageContact(data) + case TypeInputMessageContact: + return UnmarshalInputMessageContact(data) - case TypeInputMessageGame: - return UnmarshalInputMessageGame(data) + case TypeInputMessageGame: + return UnmarshalInputMessageGame(data) - case TypeInputMessageInvoice: - return UnmarshalInputMessageInvoice(data) + case TypeInputMessageInvoice: + return UnmarshalInputMessageInvoice(data) - case TypeInputMessageForwarded: - return UnmarshalInputMessageForwarded(data) + case TypeInputMessageForwarded: + return UnmarshalInputMessageForwarded(data) - case TypeSearchMessagesFilterEmpty: - return UnmarshalSearchMessagesFilterEmpty(data) + case TypeSearchMessagesFilterEmpty: + return UnmarshalSearchMessagesFilterEmpty(data) - case TypeSearchMessagesFilterAnimation: - return UnmarshalSearchMessagesFilterAnimation(data) + case TypeSearchMessagesFilterAnimation: + return UnmarshalSearchMessagesFilterAnimation(data) - case TypeSearchMessagesFilterAudio: - return UnmarshalSearchMessagesFilterAudio(data) + case TypeSearchMessagesFilterAudio: + return UnmarshalSearchMessagesFilterAudio(data) - case TypeSearchMessagesFilterDocument: - return UnmarshalSearchMessagesFilterDocument(data) + case TypeSearchMessagesFilterDocument: + return UnmarshalSearchMessagesFilterDocument(data) - case TypeSearchMessagesFilterPhoto: - return UnmarshalSearchMessagesFilterPhoto(data) + case TypeSearchMessagesFilterPhoto: + return UnmarshalSearchMessagesFilterPhoto(data) - case TypeSearchMessagesFilterVideo: - return UnmarshalSearchMessagesFilterVideo(data) + case TypeSearchMessagesFilterVideo: + return UnmarshalSearchMessagesFilterVideo(data) - case TypeSearchMessagesFilterVoiceNote: - return UnmarshalSearchMessagesFilterVoiceNote(data) + case TypeSearchMessagesFilterVoiceNote: + return UnmarshalSearchMessagesFilterVoiceNote(data) - case TypeSearchMessagesFilterPhotoAndVideo: - return UnmarshalSearchMessagesFilterPhotoAndVideo(data) + case TypeSearchMessagesFilterPhotoAndVideo: + return UnmarshalSearchMessagesFilterPhotoAndVideo(data) - case TypeSearchMessagesFilterUrl: - return UnmarshalSearchMessagesFilterUrl(data) + case TypeSearchMessagesFilterUrl: + return UnmarshalSearchMessagesFilterUrl(data) - case TypeSearchMessagesFilterChatPhoto: - return UnmarshalSearchMessagesFilterChatPhoto(data) + case TypeSearchMessagesFilterChatPhoto: + return UnmarshalSearchMessagesFilterChatPhoto(data) - case TypeSearchMessagesFilterCall: - return UnmarshalSearchMessagesFilterCall(data) + case TypeSearchMessagesFilterCall: + return UnmarshalSearchMessagesFilterCall(data) - case TypeSearchMessagesFilterMissedCall: - return UnmarshalSearchMessagesFilterMissedCall(data) + case TypeSearchMessagesFilterMissedCall: + return UnmarshalSearchMessagesFilterMissedCall(data) - case TypeSearchMessagesFilterVideoNote: - return UnmarshalSearchMessagesFilterVideoNote(data) + case TypeSearchMessagesFilterVideoNote: + return UnmarshalSearchMessagesFilterVideoNote(data) - case TypeSearchMessagesFilterVoiceAndVideoNote: - return UnmarshalSearchMessagesFilterVoiceAndVideoNote(data) + case TypeSearchMessagesFilterVoiceAndVideoNote: + return UnmarshalSearchMessagesFilterVoiceAndVideoNote(data) - case TypeSearchMessagesFilterMention: - return UnmarshalSearchMessagesFilterMention(data) + case TypeSearchMessagesFilterMention: + return UnmarshalSearchMessagesFilterMention(data) - case TypeSearchMessagesFilterUnreadMention: - return UnmarshalSearchMessagesFilterUnreadMention(data) + case TypeSearchMessagesFilterUnreadMention: + return UnmarshalSearchMessagesFilterUnreadMention(data) - case TypeChatActionTyping: - return UnmarshalChatActionTyping(data) + case TypeChatActionTyping: + return UnmarshalChatActionTyping(data) - case TypeChatActionRecordingVideo: - return UnmarshalChatActionRecordingVideo(data) + case TypeChatActionRecordingVideo: + return UnmarshalChatActionRecordingVideo(data) - case TypeChatActionUploadingVideo: - return UnmarshalChatActionUploadingVideo(data) + case TypeChatActionUploadingVideo: + return UnmarshalChatActionUploadingVideo(data) - case TypeChatActionRecordingVoiceNote: - return UnmarshalChatActionRecordingVoiceNote(data) + case TypeChatActionRecordingVoiceNote: + return UnmarshalChatActionRecordingVoiceNote(data) - case TypeChatActionUploadingVoiceNote: - return UnmarshalChatActionUploadingVoiceNote(data) + case TypeChatActionUploadingVoiceNote: + return UnmarshalChatActionUploadingVoiceNote(data) - case TypeChatActionUploadingPhoto: - return UnmarshalChatActionUploadingPhoto(data) + case TypeChatActionUploadingPhoto: + return UnmarshalChatActionUploadingPhoto(data) - case TypeChatActionUploadingDocument: - return UnmarshalChatActionUploadingDocument(data) + case TypeChatActionUploadingDocument: + return UnmarshalChatActionUploadingDocument(data) - case TypeChatActionChoosingLocation: - return UnmarshalChatActionChoosingLocation(data) + case TypeChatActionChoosingLocation: + return UnmarshalChatActionChoosingLocation(data) - case TypeChatActionChoosingContact: - return UnmarshalChatActionChoosingContact(data) + case TypeChatActionChoosingContact: + return UnmarshalChatActionChoosingContact(data) - case TypeChatActionStartPlayingGame: - return UnmarshalChatActionStartPlayingGame(data) + case TypeChatActionStartPlayingGame: + return UnmarshalChatActionStartPlayingGame(data) - case TypeChatActionRecordingVideoNote: - return UnmarshalChatActionRecordingVideoNote(data) + case TypeChatActionRecordingVideoNote: + return UnmarshalChatActionRecordingVideoNote(data) - case TypeChatActionUploadingVideoNote: - return UnmarshalChatActionUploadingVideoNote(data) + case TypeChatActionUploadingVideoNote: + return UnmarshalChatActionUploadingVideoNote(data) - case TypeChatActionCancel: - return UnmarshalChatActionCancel(data) + case TypeChatActionCancel: + return UnmarshalChatActionCancel(data) - case TypeUserStatusEmpty: - return UnmarshalUserStatusEmpty(data) + case TypeUserStatusEmpty: + return UnmarshalUserStatusEmpty(data) - case TypeUserStatusOnline: - return UnmarshalUserStatusOnline(data) + case TypeUserStatusOnline: + return UnmarshalUserStatusOnline(data) - case TypeUserStatusOffline: - return UnmarshalUserStatusOffline(data) + case TypeUserStatusOffline: + return UnmarshalUserStatusOffline(data) - case TypeUserStatusRecently: - return UnmarshalUserStatusRecently(data) + case TypeUserStatusRecently: + return UnmarshalUserStatusRecently(data) - case TypeUserStatusLastWeek: - return UnmarshalUserStatusLastWeek(data) + case TypeUserStatusLastWeek: + return UnmarshalUserStatusLastWeek(data) - case TypeUserStatusLastMonth: - return UnmarshalUserStatusLastMonth(data) + case TypeUserStatusLastMonth: + return UnmarshalUserStatusLastMonth(data) - case TypeStickers: - return UnmarshalStickers(data) + case TypeStickers: + return UnmarshalStickers(data) - case TypeStickerEmojis: - return UnmarshalStickerEmojis(data) + case TypeStickerEmojis: + return UnmarshalStickerEmojis(data) - case TypeStickerSet: - return UnmarshalStickerSet(data) + case TypeStickerSet: + return UnmarshalStickerSet(data) - case TypeStickerSetInfo: - return UnmarshalStickerSetInfo(data) + case TypeStickerSetInfo: + return UnmarshalStickerSetInfo(data) - case TypeStickerSets: - return UnmarshalStickerSets(data) + case TypeStickerSets: + return UnmarshalStickerSets(data) - case TypeCallDiscardReasonEmpty: - return UnmarshalCallDiscardReasonEmpty(data) + case TypeCallDiscardReasonEmpty: + return UnmarshalCallDiscardReasonEmpty(data) - case TypeCallDiscardReasonMissed: - return UnmarshalCallDiscardReasonMissed(data) + case TypeCallDiscardReasonMissed: + return UnmarshalCallDiscardReasonMissed(data) - case TypeCallDiscardReasonDeclined: - return UnmarshalCallDiscardReasonDeclined(data) + case TypeCallDiscardReasonDeclined: + return UnmarshalCallDiscardReasonDeclined(data) - case TypeCallDiscardReasonDisconnected: - return UnmarshalCallDiscardReasonDisconnected(data) + case TypeCallDiscardReasonDisconnected: + return UnmarshalCallDiscardReasonDisconnected(data) - case TypeCallDiscardReasonHungUp: - return UnmarshalCallDiscardReasonHungUp(data) + case TypeCallDiscardReasonHungUp: + return UnmarshalCallDiscardReasonHungUp(data) - case TypeCallProtocol: - return UnmarshalCallProtocol(data) + case TypeCallProtocol: + return UnmarshalCallProtocol(data) - case TypeCallConnection: - return UnmarshalCallConnection(data) + case TypeCallConnection: + return UnmarshalCallConnection(data) - case TypeCallId: - return UnmarshalCallId(data) + case TypeCallId: + return UnmarshalCallId(data) - case TypeCallStatePending: - return UnmarshalCallStatePending(data) + case TypeCallStatePending: + return UnmarshalCallStatePending(data) - case TypeCallStateExchangingKeys: - return UnmarshalCallStateExchangingKeys(data) + case TypeCallStateExchangingKeys: + return UnmarshalCallStateExchangingKeys(data) - case TypeCallStateReady: - return UnmarshalCallStateReady(data) + case TypeCallStateReady: + return UnmarshalCallStateReady(data) - case TypeCallStateHangingUp: - return UnmarshalCallStateHangingUp(data) + case TypeCallStateHangingUp: + return UnmarshalCallStateHangingUp(data) - case TypeCallStateDiscarded: - return UnmarshalCallStateDiscarded(data) + case TypeCallStateDiscarded: + return UnmarshalCallStateDiscarded(data) - case TypeCallStateError: - return UnmarshalCallStateError(data) + case TypeCallStateError: + return UnmarshalCallStateError(data) - case TypeCall: - return UnmarshalCall(data) + case TypeCall: + return UnmarshalCall(data) - case TypeAnimations: - return UnmarshalAnimations(data) + case TypeAnimations: + return UnmarshalAnimations(data) - case TypeImportedContacts: - return UnmarshalImportedContacts(data) + case TypeImportedContacts: + return UnmarshalImportedContacts(data) - case TypeInputInlineQueryResultAnimatedGif: - return UnmarshalInputInlineQueryResultAnimatedGif(data) + case TypeInputInlineQueryResultAnimatedGif: + return UnmarshalInputInlineQueryResultAnimatedGif(data) - case TypeInputInlineQueryResultAnimatedMpeg4: - return UnmarshalInputInlineQueryResultAnimatedMpeg4(data) + case TypeInputInlineQueryResultAnimatedMpeg4: + return UnmarshalInputInlineQueryResultAnimatedMpeg4(data) - case TypeInputInlineQueryResultArticle: - return UnmarshalInputInlineQueryResultArticle(data) + case TypeInputInlineQueryResultArticle: + return UnmarshalInputInlineQueryResultArticle(data) - case TypeInputInlineQueryResultAudio: - return UnmarshalInputInlineQueryResultAudio(data) + case TypeInputInlineQueryResultAudio: + return UnmarshalInputInlineQueryResultAudio(data) - case TypeInputInlineQueryResultContact: - return UnmarshalInputInlineQueryResultContact(data) + case TypeInputInlineQueryResultContact: + return UnmarshalInputInlineQueryResultContact(data) - case TypeInputInlineQueryResultDocument: - return UnmarshalInputInlineQueryResultDocument(data) + case TypeInputInlineQueryResultDocument: + return UnmarshalInputInlineQueryResultDocument(data) - case TypeInputInlineQueryResultGame: - return UnmarshalInputInlineQueryResultGame(data) + case TypeInputInlineQueryResultGame: + return UnmarshalInputInlineQueryResultGame(data) - case TypeInputInlineQueryResultLocation: - return UnmarshalInputInlineQueryResultLocation(data) + case TypeInputInlineQueryResultLocation: + return UnmarshalInputInlineQueryResultLocation(data) - case TypeInputInlineQueryResultPhoto: - return UnmarshalInputInlineQueryResultPhoto(data) + case TypeInputInlineQueryResultPhoto: + return UnmarshalInputInlineQueryResultPhoto(data) - case TypeInputInlineQueryResultSticker: - return UnmarshalInputInlineQueryResultSticker(data) + case TypeInputInlineQueryResultSticker: + return UnmarshalInputInlineQueryResultSticker(data) - case TypeInputInlineQueryResultVenue: - return UnmarshalInputInlineQueryResultVenue(data) + case TypeInputInlineQueryResultVenue: + return UnmarshalInputInlineQueryResultVenue(data) - case TypeInputInlineQueryResultVideo: - return UnmarshalInputInlineQueryResultVideo(data) + case TypeInputInlineQueryResultVideo: + return UnmarshalInputInlineQueryResultVideo(data) - case TypeInputInlineQueryResultVoiceNote: - return UnmarshalInputInlineQueryResultVoiceNote(data) + case TypeInputInlineQueryResultVoiceNote: + return UnmarshalInputInlineQueryResultVoiceNote(data) - case TypeInlineQueryResultArticle: - return UnmarshalInlineQueryResultArticle(data) + case TypeInlineQueryResultArticle: + return UnmarshalInlineQueryResultArticle(data) - case TypeInlineQueryResultContact: - return UnmarshalInlineQueryResultContact(data) + case TypeInlineQueryResultContact: + return UnmarshalInlineQueryResultContact(data) - case TypeInlineQueryResultLocation: - return UnmarshalInlineQueryResultLocation(data) + case TypeInlineQueryResultLocation: + return UnmarshalInlineQueryResultLocation(data) - case TypeInlineQueryResultVenue: - return UnmarshalInlineQueryResultVenue(data) + case TypeInlineQueryResultVenue: + return UnmarshalInlineQueryResultVenue(data) - case TypeInlineQueryResultGame: - return UnmarshalInlineQueryResultGame(data) + case TypeInlineQueryResultGame: + return UnmarshalInlineQueryResultGame(data) - case TypeInlineQueryResultAnimation: - return UnmarshalInlineQueryResultAnimation(data) + case TypeInlineQueryResultAnimation: + return UnmarshalInlineQueryResultAnimation(data) - case TypeInlineQueryResultAudio: - return UnmarshalInlineQueryResultAudio(data) + case TypeInlineQueryResultAudio: + return UnmarshalInlineQueryResultAudio(data) - case TypeInlineQueryResultDocument: - return UnmarshalInlineQueryResultDocument(data) + case TypeInlineQueryResultDocument: + return UnmarshalInlineQueryResultDocument(data) - case TypeInlineQueryResultPhoto: - return UnmarshalInlineQueryResultPhoto(data) + case TypeInlineQueryResultPhoto: + return UnmarshalInlineQueryResultPhoto(data) - case TypeInlineQueryResultSticker: - return UnmarshalInlineQueryResultSticker(data) + case TypeInlineQueryResultSticker: + return UnmarshalInlineQueryResultSticker(data) - case TypeInlineQueryResultVideo: - return UnmarshalInlineQueryResultVideo(data) + case TypeInlineQueryResultVideo: + return UnmarshalInlineQueryResultVideo(data) - case TypeInlineQueryResultVoiceNote: - return UnmarshalInlineQueryResultVoiceNote(data) + case TypeInlineQueryResultVoiceNote: + return UnmarshalInlineQueryResultVoiceNote(data) - case TypeInlineQueryResults: - return UnmarshalInlineQueryResults(data) + case TypeInlineQueryResults: + return UnmarshalInlineQueryResults(data) - case TypeCallbackQueryPayloadData: - return UnmarshalCallbackQueryPayloadData(data) + case TypeCallbackQueryPayloadData: + return UnmarshalCallbackQueryPayloadData(data) - case TypeCallbackQueryPayloadGame: - return UnmarshalCallbackQueryPayloadGame(data) + case TypeCallbackQueryPayloadGame: + return UnmarshalCallbackQueryPayloadGame(data) - case TypeCallbackQueryAnswer: - return UnmarshalCallbackQueryAnswer(data) + case TypeCallbackQueryAnswer: + return UnmarshalCallbackQueryAnswer(data) - case TypeCustomRequestResult: - return UnmarshalCustomRequestResult(data) + case TypeCustomRequestResult: + return UnmarshalCustomRequestResult(data) - case TypeGameHighScore: - return UnmarshalGameHighScore(data) + case TypeGameHighScore: + return UnmarshalGameHighScore(data) - case TypeGameHighScores: - return UnmarshalGameHighScores(data) + case TypeGameHighScores: + return UnmarshalGameHighScores(data) - case TypeChatEventMessageEdited: - return UnmarshalChatEventMessageEdited(data) + case TypeChatEventMessageEdited: + return UnmarshalChatEventMessageEdited(data) - case TypeChatEventMessageDeleted: - return UnmarshalChatEventMessageDeleted(data) + case TypeChatEventMessageDeleted: + return UnmarshalChatEventMessageDeleted(data) - case TypeChatEventMessagePinned: - return UnmarshalChatEventMessagePinned(data) + case TypeChatEventMessagePinned: + return UnmarshalChatEventMessagePinned(data) - case TypeChatEventMessageUnpinned: - return UnmarshalChatEventMessageUnpinned(data) + case TypeChatEventMessageUnpinned: + return UnmarshalChatEventMessageUnpinned(data) - case TypeChatEventMemberJoined: - return UnmarshalChatEventMemberJoined(data) + case TypeChatEventMemberJoined: + return UnmarshalChatEventMemberJoined(data) - case TypeChatEventMemberLeft: - return UnmarshalChatEventMemberLeft(data) + case TypeChatEventMemberLeft: + return UnmarshalChatEventMemberLeft(data) - case TypeChatEventMemberInvited: - return UnmarshalChatEventMemberInvited(data) + case TypeChatEventMemberInvited: + return UnmarshalChatEventMemberInvited(data) - case TypeChatEventMemberPromoted: - return UnmarshalChatEventMemberPromoted(data) + case TypeChatEventMemberPromoted: + return UnmarshalChatEventMemberPromoted(data) - case TypeChatEventMemberRestricted: - return UnmarshalChatEventMemberRestricted(data) + case TypeChatEventMemberRestricted: + return UnmarshalChatEventMemberRestricted(data) - case TypeChatEventTitleChanged: - return UnmarshalChatEventTitleChanged(data) + case TypeChatEventTitleChanged: + return UnmarshalChatEventTitleChanged(data) - case TypeChatEventDescriptionChanged: - return UnmarshalChatEventDescriptionChanged(data) + case TypeChatEventDescriptionChanged: + return UnmarshalChatEventDescriptionChanged(data) - case TypeChatEventUsernameChanged: - return UnmarshalChatEventUsernameChanged(data) + case TypeChatEventUsernameChanged: + return UnmarshalChatEventUsernameChanged(data) - case TypeChatEventPhotoChanged: - return UnmarshalChatEventPhotoChanged(data) + case TypeChatEventPhotoChanged: + return UnmarshalChatEventPhotoChanged(data) - case TypeChatEventInvitesToggled: - return UnmarshalChatEventInvitesToggled(data) + case TypeChatEventInvitesToggled: + return UnmarshalChatEventInvitesToggled(data) - case TypeChatEventSignMessagesToggled: - return UnmarshalChatEventSignMessagesToggled(data) + case TypeChatEventSignMessagesToggled: + return UnmarshalChatEventSignMessagesToggled(data) - case TypeChatEventStickerSetChanged: - return UnmarshalChatEventStickerSetChanged(data) + case TypeChatEventStickerSetChanged: + return UnmarshalChatEventStickerSetChanged(data) - case TypeChatEventIsAllHistoryAvailableToggled: - return UnmarshalChatEventIsAllHistoryAvailableToggled(data) + case TypeChatEventIsAllHistoryAvailableToggled: + return UnmarshalChatEventIsAllHistoryAvailableToggled(data) - case TypeChatEvent: - return UnmarshalChatEvent(data) + case TypeChatEvent: + return UnmarshalChatEvent(data) - case TypeChatEvents: - return UnmarshalChatEvents(data) + case TypeChatEvents: + return UnmarshalChatEvents(data) - case TypeChatEventLogFilters: - return UnmarshalChatEventLogFilters(data) + case TypeChatEventLogFilters: + return UnmarshalChatEventLogFilters(data) - case TypeLanguagePackStringValueOrdinary: - return UnmarshalLanguagePackStringValueOrdinary(data) + case TypeLanguagePackStringValueOrdinary: + return UnmarshalLanguagePackStringValueOrdinary(data) - case TypeLanguagePackStringValuePluralized: - return UnmarshalLanguagePackStringValuePluralized(data) + case TypeLanguagePackStringValuePluralized: + return UnmarshalLanguagePackStringValuePluralized(data) - case TypeLanguagePackStringValueDeleted: - return UnmarshalLanguagePackStringValueDeleted(data) + case TypeLanguagePackStringValueDeleted: + return UnmarshalLanguagePackStringValueDeleted(data) - case TypeLanguagePackString: - return UnmarshalLanguagePackString(data) + case TypeLanguagePackString: + return UnmarshalLanguagePackString(data) - case TypeLanguagePackStrings: - return UnmarshalLanguagePackStrings(data) + case TypeLanguagePackStrings: + return UnmarshalLanguagePackStrings(data) - case TypeLanguagePackInfo: - return UnmarshalLanguagePackInfo(data) + case TypeLanguagePackInfo: + return UnmarshalLanguagePackInfo(data) - case TypeLocalizationTargetInfo: - return UnmarshalLocalizationTargetInfo(data) + case TypeLocalizationTargetInfo: + return UnmarshalLocalizationTargetInfo(data) - case TypeDeviceTokenGoogleCloudMessaging: - return UnmarshalDeviceTokenGoogleCloudMessaging(data) + case TypeDeviceTokenGoogleCloudMessaging: + return UnmarshalDeviceTokenGoogleCloudMessaging(data) - case TypeDeviceTokenApplePush: - return UnmarshalDeviceTokenApplePush(data) + case TypeDeviceTokenApplePush: + return UnmarshalDeviceTokenApplePush(data) - case TypeDeviceTokenApplePushVoIP: - return UnmarshalDeviceTokenApplePushVoIP(data) + case TypeDeviceTokenApplePushVoIP: + return UnmarshalDeviceTokenApplePushVoIP(data) - case TypeDeviceTokenWindowsPush: - return UnmarshalDeviceTokenWindowsPush(data) + case TypeDeviceTokenWindowsPush: + return UnmarshalDeviceTokenWindowsPush(data) - case TypeDeviceTokenMicrosoftPush: - return UnmarshalDeviceTokenMicrosoftPush(data) + case TypeDeviceTokenMicrosoftPush: + return UnmarshalDeviceTokenMicrosoftPush(data) - case TypeDeviceTokenMicrosoftPushVoIP: - return UnmarshalDeviceTokenMicrosoftPushVoIP(data) + case TypeDeviceTokenMicrosoftPushVoIP: + return UnmarshalDeviceTokenMicrosoftPushVoIP(data) - case TypeDeviceTokenWebPush: - return UnmarshalDeviceTokenWebPush(data) + case TypeDeviceTokenWebPush: + return UnmarshalDeviceTokenWebPush(data) - case TypeDeviceTokenSimplePush: - return UnmarshalDeviceTokenSimplePush(data) + case TypeDeviceTokenSimplePush: + return UnmarshalDeviceTokenSimplePush(data) - case TypeDeviceTokenUbuntuPush: - return UnmarshalDeviceTokenUbuntuPush(data) + case TypeDeviceTokenUbuntuPush: + return UnmarshalDeviceTokenUbuntuPush(data) - case TypeDeviceTokenBlackBerryPush: - return UnmarshalDeviceTokenBlackBerryPush(data) + case TypeDeviceTokenBlackBerryPush: + return UnmarshalDeviceTokenBlackBerryPush(data) - case TypeDeviceTokenTizenPush: - return UnmarshalDeviceTokenTizenPush(data) + case TypeDeviceTokenTizenPush: + return UnmarshalDeviceTokenTizenPush(data) - case TypeWallpaper: - return UnmarshalWallpaper(data) + case TypeWallpaper: + return UnmarshalWallpaper(data) - case TypeWallpapers: - return UnmarshalWallpapers(data) + case TypeWallpapers: + return UnmarshalWallpapers(data) - case TypeHashtags: - return UnmarshalHashtags(data) + case TypeHashtags: + return UnmarshalHashtags(data) - case TypeCheckChatUsernameResultOk: - return UnmarshalCheckChatUsernameResultOk(data) + case TypeCheckChatUsernameResultOk: + return UnmarshalCheckChatUsernameResultOk(data) - case TypeCheckChatUsernameResultUsernameInvalid: - return UnmarshalCheckChatUsernameResultUsernameInvalid(data) + case TypeCheckChatUsernameResultUsernameInvalid: + return UnmarshalCheckChatUsernameResultUsernameInvalid(data) - case TypeCheckChatUsernameResultUsernameOccupied: - return UnmarshalCheckChatUsernameResultUsernameOccupied(data) + case TypeCheckChatUsernameResultUsernameOccupied: + return UnmarshalCheckChatUsernameResultUsernameOccupied(data) - case TypeCheckChatUsernameResultPublicChatsTooMuch: - return UnmarshalCheckChatUsernameResultPublicChatsTooMuch(data) + case TypeCheckChatUsernameResultPublicChatsTooMuch: + return UnmarshalCheckChatUsernameResultPublicChatsTooMuch(data) - case TypeCheckChatUsernameResultPublicGroupsUnavailable: - return UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(data) + case TypeCheckChatUsernameResultPublicGroupsUnavailable: + return UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(data) - case TypeOptionValueBoolean: - return UnmarshalOptionValueBoolean(data) + case TypeOptionValueBoolean: + return UnmarshalOptionValueBoolean(data) - case TypeOptionValueEmpty: - return UnmarshalOptionValueEmpty(data) + case TypeOptionValueEmpty: + return UnmarshalOptionValueEmpty(data) - case TypeOptionValueInteger: - return UnmarshalOptionValueInteger(data) + case TypeOptionValueInteger: + return UnmarshalOptionValueInteger(data) - case TypeOptionValueString: - return UnmarshalOptionValueString(data) + case TypeOptionValueString: + return UnmarshalOptionValueString(data) - case TypeUserPrivacySettingRuleAllowAll: - return UnmarshalUserPrivacySettingRuleAllowAll(data) + case TypeUserPrivacySettingRuleAllowAll: + return UnmarshalUserPrivacySettingRuleAllowAll(data) - case TypeUserPrivacySettingRuleAllowContacts: - return UnmarshalUserPrivacySettingRuleAllowContacts(data) + case TypeUserPrivacySettingRuleAllowContacts: + return UnmarshalUserPrivacySettingRuleAllowContacts(data) - case TypeUserPrivacySettingRuleAllowUsers: - return UnmarshalUserPrivacySettingRuleAllowUsers(data) + case TypeUserPrivacySettingRuleAllowUsers: + return UnmarshalUserPrivacySettingRuleAllowUsers(data) - case TypeUserPrivacySettingRuleRestrictAll: - return UnmarshalUserPrivacySettingRuleRestrictAll(data) + case TypeUserPrivacySettingRuleRestrictAll: + return UnmarshalUserPrivacySettingRuleRestrictAll(data) - case TypeUserPrivacySettingRuleRestrictContacts: - return UnmarshalUserPrivacySettingRuleRestrictContacts(data) + case TypeUserPrivacySettingRuleRestrictContacts: + return UnmarshalUserPrivacySettingRuleRestrictContacts(data) - case TypeUserPrivacySettingRuleRestrictUsers: - return UnmarshalUserPrivacySettingRuleRestrictUsers(data) + case TypeUserPrivacySettingRuleRestrictUsers: + return UnmarshalUserPrivacySettingRuleRestrictUsers(data) - case TypeUserPrivacySettingRules: - return UnmarshalUserPrivacySettingRules(data) + case TypeUserPrivacySettingRules: + return UnmarshalUserPrivacySettingRules(data) - case TypeUserPrivacySettingShowStatus: - return UnmarshalUserPrivacySettingShowStatus(data) + case TypeUserPrivacySettingShowStatus: + return UnmarshalUserPrivacySettingShowStatus(data) - case TypeUserPrivacySettingAllowChatInvites: - return UnmarshalUserPrivacySettingAllowChatInvites(data) + case TypeUserPrivacySettingAllowChatInvites: + return UnmarshalUserPrivacySettingAllowChatInvites(data) - case TypeUserPrivacySettingAllowCalls: - return UnmarshalUserPrivacySettingAllowCalls(data) + case TypeUserPrivacySettingAllowCalls: + return UnmarshalUserPrivacySettingAllowCalls(data) - case TypeAccountTtl: - return UnmarshalAccountTtl(data) + case TypeAccountTtl: + return UnmarshalAccountTtl(data) - case TypeSession: - return UnmarshalSession(data) + case TypeSession: + return UnmarshalSession(data) - case TypeSessions: - return UnmarshalSessions(data) + case TypeSessions: + return UnmarshalSessions(data) - case TypeConnectedWebsite: - return UnmarshalConnectedWebsite(data) + case TypeConnectedWebsite: + return UnmarshalConnectedWebsite(data) - case TypeConnectedWebsites: - return UnmarshalConnectedWebsites(data) + case TypeConnectedWebsites: + return UnmarshalConnectedWebsites(data) - case TypeChatReportSpamState: - return UnmarshalChatReportSpamState(data) + case TypeChatReportSpamState: + return UnmarshalChatReportSpamState(data) - case TypeChatReportReasonSpam: - return UnmarshalChatReportReasonSpam(data) + case TypeChatReportReasonSpam: + return UnmarshalChatReportReasonSpam(data) - case TypeChatReportReasonViolence: - return UnmarshalChatReportReasonViolence(data) + case TypeChatReportReasonViolence: + return UnmarshalChatReportReasonViolence(data) - case TypeChatReportReasonPornography: - return UnmarshalChatReportReasonPornography(data) + case TypeChatReportReasonPornography: + return UnmarshalChatReportReasonPornography(data) - case TypeChatReportReasonCopyright: - return UnmarshalChatReportReasonCopyright(data) + case TypeChatReportReasonCopyright: + return UnmarshalChatReportReasonCopyright(data) - case TypeChatReportReasonCustom: - return UnmarshalChatReportReasonCustom(data) + case TypeChatReportReasonCustom: + return UnmarshalChatReportReasonCustom(data) - case TypePublicMessageLink: - return UnmarshalPublicMessageLink(data) + case TypePublicMessageLink: + return UnmarshalPublicMessageLink(data) - case TypeFileTypeNone: - return UnmarshalFileTypeNone(data) + case TypeFileTypeNone: + return UnmarshalFileTypeNone(data) - case TypeFileTypeAnimation: - return UnmarshalFileTypeAnimation(data) + case TypeFileTypeAnimation: + return UnmarshalFileTypeAnimation(data) - case TypeFileTypeAudio: - return UnmarshalFileTypeAudio(data) + case TypeFileTypeAudio: + return UnmarshalFileTypeAudio(data) - case TypeFileTypeDocument: - return UnmarshalFileTypeDocument(data) + case TypeFileTypeDocument: + return UnmarshalFileTypeDocument(data) - case TypeFileTypePhoto: - return UnmarshalFileTypePhoto(data) + case TypeFileTypePhoto: + return UnmarshalFileTypePhoto(data) - case TypeFileTypeProfilePhoto: - return UnmarshalFileTypeProfilePhoto(data) + case TypeFileTypeProfilePhoto: + return UnmarshalFileTypeProfilePhoto(data) - case TypeFileTypeSecret: - return UnmarshalFileTypeSecret(data) + case TypeFileTypeSecret: + return UnmarshalFileTypeSecret(data) - case TypeFileTypeSecretThumbnail: - return UnmarshalFileTypeSecretThumbnail(data) + case TypeFileTypeSecretThumbnail: + return UnmarshalFileTypeSecretThumbnail(data) - case TypeFileTypeSecure: - return UnmarshalFileTypeSecure(data) + case TypeFileTypeSecure: + return UnmarshalFileTypeSecure(data) - case TypeFileTypeSticker: - return UnmarshalFileTypeSticker(data) + case TypeFileTypeSticker: + return UnmarshalFileTypeSticker(data) - case TypeFileTypeThumbnail: - return UnmarshalFileTypeThumbnail(data) + case TypeFileTypeThumbnail: + return UnmarshalFileTypeThumbnail(data) - case TypeFileTypeUnknown: - return UnmarshalFileTypeUnknown(data) + case TypeFileTypeUnknown: + return UnmarshalFileTypeUnknown(data) - case TypeFileTypeVideo: - return UnmarshalFileTypeVideo(data) + case TypeFileTypeVideo: + return UnmarshalFileTypeVideo(data) - case TypeFileTypeVideoNote: - return UnmarshalFileTypeVideoNote(data) + case TypeFileTypeVideoNote: + return UnmarshalFileTypeVideoNote(data) - case TypeFileTypeVoiceNote: - return UnmarshalFileTypeVoiceNote(data) + case TypeFileTypeVoiceNote: + return UnmarshalFileTypeVoiceNote(data) - case TypeFileTypeWallpaper: - return UnmarshalFileTypeWallpaper(data) + case TypeFileTypeWallpaper: + return UnmarshalFileTypeWallpaper(data) - case TypeStorageStatisticsByFileType: - return UnmarshalStorageStatisticsByFileType(data) + case TypeStorageStatisticsByFileType: + return UnmarshalStorageStatisticsByFileType(data) - case TypeStorageStatisticsByChat: - return UnmarshalStorageStatisticsByChat(data) + case TypeStorageStatisticsByChat: + return UnmarshalStorageStatisticsByChat(data) - case TypeStorageStatistics: - return UnmarshalStorageStatistics(data) + case TypeStorageStatistics: + return UnmarshalStorageStatistics(data) - case TypeStorageStatisticsFast: - return UnmarshalStorageStatisticsFast(data) + case TypeStorageStatisticsFast: + return UnmarshalStorageStatisticsFast(data) - case TypeNetworkTypeNone: - return UnmarshalNetworkTypeNone(data) + case TypeNetworkTypeNone: + return UnmarshalNetworkTypeNone(data) - case TypeNetworkTypeMobile: - return UnmarshalNetworkTypeMobile(data) + case TypeNetworkTypeMobile: + return UnmarshalNetworkTypeMobile(data) - case TypeNetworkTypeMobileRoaming: - return UnmarshalNetworkTypeMobileRoaming(data) + case TypeNetworkTypeMobileRoaming: + return UnmarshalNetworkTypeMobileRoaming(data) - case TypeNetworkTypeWiFi: - return UnmarshalNetworkTypeWiFi(data) + case TypeNetworkTypeWiFi: + return UnmarshalNetworkTypeWiFi(data) - case TypeNetworkTypeOther: - return UnmarshalNetworkTypeOther(data) + case TypeNetworkTypeOther: + return UnmarshalNetworkTypeOther(data) - case TypeNetworkStatisticsEntryFile: - return UnmarshalNetworkStatisticsEntryFile(data) + case TypeNetworkStatisticsEntryFile: + return UnmarshalNetworkStatisticsEntryFile(data) - case TypeNetworkStatisticsEntryCall: - return UnmarshalNetworkStatisticsEntryCall(data) + case TypeNetworkStatisticsEntryCall: + return UnmarshalNetworkStatisticsEntryCall(data) - case TypeNetworkStatistics: - return UnmarshalNetworkStatistics(data) + case TypeNetworkStatistics: + return UnmarshalNetworkStatistics(data) - case TypeConnectionStateWaitingForNetwork: - return UnmarshalConnectionStateWaitingForNetwork(data) + case TypeConnectionStateWaitingForNetwork: + return UnmarshalConnectionStateWaitingForNetwork(data) - case TypeConnectionStateConnectingToProxy: - return UnmarshalConnectionStateConnectingToProxy(data) + case TypeConnectionStateConnectingToProxy: + return UnmarshalConnectionStateConnectingToProxy(data) - case TypeConnectionStateConnecting: - return UnmarshalConnectionStateConnecting(data) + case TypeConnectionStateConnecting: + return UnmarshalConnectionStateConnecting(data) - case TypeConnectionStateUpdating: - return UnmarshalConnectionStateUpdating(data) + case TypeConnectionStateUpdating: + return UnmarshalConnectionStateUpdating(data) - case TypeConnectionStateReady: - return UnmarshalConnectionStateReady(data) + case TypeConnectionStateReady: + return UnmarshalConnectionStateReady(data) - case TypeTopChatCategoryUsers: - return UnmarshalTopChatCategoryUsers(data) + case TypeTopChatCategoryUsers: + return UnmarshalTopChatCategoryUsers(data) - case TypeTopChatCategoryBots: - return UnmarshalTopChatCategoryBots(data) + case TypeTopChatCategoryBots: + return UnmarshalTopChatCategoryBots(data) - case TypeTopChatCategoryGroups: - return UnmarshalTopChatCategoryGroups(data) + case TypeTopChatCategoryGroups: + return UnmarshalTopChatCategoryGroups(data) - case TypeTopChatCategoryChannels: - return UnmarshalTopChatCategoryChannels(data) + case TypeTopChatCategoryChannels: + return UnmarshalTopChatCategoryChannels(data) - case TypeTopChatCategoryInlineBots: - return UnmarshalTopChatCategoryInlineBots(data) + case TypeTopChatCategoryInlineBots: + return UnmarshalTopChatCategoryInlineBots(data) - case TypeTopChatCategoryCalls: - return UnmarshalTopChatCategoryCalls(data) + case TypeTopChatCategoryCalls: + return UnmarshalTopChatCategoryCalls(data) - case TypeTMeUrlTypeUser: - return UnmarshalTMeUrlTypeUser(data) + case TypeTMeUrlTypeUser: + return UnmarshalTMeUrlTypeUser(data) - case TypeTMeUrlTypeSupergroup: - return UnmarshalTMeUrlTypeSupergroup(data) + case TypeTMeUrlTypeSupergroup: + return UnmarshalTMeUrlTypeSupergroup(data) - case TypeTMeUrlTypeChatInvite: - return UnmarshalTMeUrlTypeChatInvite(data) + case TypeTMeUrlTypeChatInvite: + return UnmarshalTMeUrlTypeChatInvite(data) - case TypeTMeUrlTypeStickerSet: - return UnmarshalTMeUrlTypeStickerSet(data) + case TypeTMeUrlTypeStickerSet: + return UnmarshalTMeUrlTypeStickerSet(data) - case TypeTMeUrl: - return UnmarshalTMeUrl(data) + case TypeTMeUrl: + return UnmarshalTMeUrl(data) - case TypeTMeUrls: - return UnmarshalTMeUrls(data) + case TypeTMeUrls: + return UnmarshalTMeUrls(data) - case TypeCount: - return UnmarshalCount(data) + case TypeCount: + return UnmarshalCount(data) - case TypeText: - return UnmarshalText(data) + case TypeText: + return UnmarshalText(data) - case TypeSeconds: - return UnmarshalSeconds(data) + case TypeSeconds: + return UnmarshalSeconds(data) - case TypeDeepLinkInfo: - return UnmarshalDeepLinkInfo(data) + case TypeDeepLinkInfo: + return UnmarshalDeepLinkInfo(data) - case TypeTextParseModeMarkdown: - return UnmarshalTextParseModeMarkdown(data) + case TypeTextParseModeMarkdown: + return UnmarshalTextParseModeMarkdown(data) - case TypeTextParseModeHTML: - return UnmarshalTextParseModeHTML(data) + case TypeTextParseModeHTML: + return UnmarshalTextParseModeHTML(data) - case TypeProxyTypeSocks5: - return UnmarshalProxyTypeSocks5(data) + case TypeProxyTypeSocks5: + return UnmarshalProxyTypeSocks5(data) - case TypeProxyTypeHttp: - return UnmarshalProxyTypeHttp(data) + case TypeProxyTypeHttp: + return UnmarshalProxyTypeHttp(data) - case TypeProxyTypeMtproto: - return UnmarshalProxyTypeMtproto(data) + case TypeProxyTypeMtproto: + return UnmarshalProxyTypeMtproto(data) - case TypeProxy: - return UnmarshalProxy(data) + case TypeProxy: + return UnmarshalProxy(data) - case TypeProxies: - return UnmarshalProxies(data) + case TypeProxies: + return UnmarshalProxies(data) - case TypeInputSticker: - return UnmarshalInputSticker(data) + case TypeInputSticker: + return UnmarshalInputSticker(data) - case TypeUpdateAuthorizationState: - return UnmarshalUpdateAuthorizationState(data) + case TypeUpdateAuthorizationState: + return UnmarshalUpdateAuthorizationState(data) - case TypeUpdateNewMessage: - return UnmarshalUpdateNewMessage(data) + case TypeUpdateNewMessage: + return UnmarshalUpdateNewMessage(data) - case TypeUpdateMessageSendAcknowledged: - return UnmarshalUpdateMessageSendAcknowledged(data) + case TypeUpdateMessageSendAcknowledged: + return UnmarshalUpdateMessageSendAcknowledged(data) - case TypeUpdateMessageSendSucceeded: - return UnmarshalUpdateMessageSendSucceeded(data) + case TypeUpdateMessageSendSucceeded: + return UnmarshalUpdateMessageSendSucceeded(data) - case TypeUpdateMessageSendFailed: - return UnmarshalUpdateMessageSendFailed(data) + case TypeUpdateMessageSendFailed: + return UnmarshalUpdateMessageSendFailed(data) - case TypeUpdateMessageContent: - return UnmarshalUpdateMessageContent(data) + case TypeUpdateMessageContent: + return UnmarshalUpdateMessageContent(data) - case TypeUpdateMessageEdited: - return UnmarshalUpdateMessageEdited(data) + case TypeUpdateMessageEdited: + return UnmarshalUpdateMessageEdited(data) - case TypeUpdateMessageViews: - return UnmarshalUpdateMessageViews(data) + case TypeUpdateMessageViews: + return UnmarshalUpdateMessageViews(data) - case TypeUpdateMessageContentOpened: - return UnmarshalUpdateMessageContentOpened(data) + case TypeUpdateMessageContentOpened: + return UnmarshalUpdateMessageContentOpened(data) - case TypeUpdateMessageMentionRead: - return UnmarshalUpdateMessageMentionRead(data) + case TypeUpdateMessageMentionRead: + return UnmarshalUpdateMessageMentionRead(data) - case TypeUpdateNewChat: - return UnmarshalUpdateNewChat(data) + case TypeUpdateNewChat: + return UnmarshalUpdateNewChat(data) - case TypeUpdateChatTitle: - return UnmarshalUpdateChatTitle(data) + case TypeUpdateChatTitle: + return UnmarshalUpdateChatTitle(data) - case TypeUpdateChatPhoto: - return UnmarshalUpdateChatPhoto(data) + case TypeUpdateChatPhoto: + return UnmarshalUpdateChatPhoto(data) - case TypeUpdateChatLastMessage: - return UnmarshalUpdateChatLastMessage(data) + case TypeUpdateChatLastMessage: + return UnmarshalUpdateChatLastMessage(data) - case TypeUpdateChatOrder: - return UnmarshalUpdateChatOrder(data) + case TypeUpdateChatOrder: + return UnmarshalUpdateChatOrder(data) - case TypeUpdateChatIsPinned: - return UnmarshalUpdateChatIsPinned(data) + case TypeUpdateChatIsPinned: + return UnmarshalUpdateChatIsPinned(data) - case TypeUpdateChatIsMarkedAsUnread: - return UnmarshalUpdateChatIsMarkedAsUnread(data) + case TypeUpdateChatIsMarkedAsUnread: + return UnmarshalUpdateChatIsMarkedAsUnread(data) - case TypeUpdateChatIsSponsored: - return UnmarshalUpdateChatIsSponsored(data) + case TypeUpdateChatIsSponsored: + return UnmarshalUpdateChatIsSponsored(data) - case TypeUpdateChatDefaultDisableNotification: - return UnmarshalUpdateChatDefaultDisableNotification(data) + case TypeUpdateChatDefaultDisableNotification: + return UnmarshalUpdateChatDefaultDisableNotification(data) - case TypeUpdateChatReadInbox: - return UnmarshalUpdateChatReadInbox(data) + case TypeUpdateChatReadInbox: + return UnmarshalUpdateChatReadInbox(data) - case TypeUpdateChatReadOutbox: - return UnmarshalUpdateChatReadOutbox(data) + case TypeUpdateChatReadOutbox: + return UnmarshalUpdateChatReadOutbox(data) - case TypeUpdateChatUnreadMentionCount: - return UnmarshalUpdateChatUnreadMentionCount(data) + case TypeUpdateChatUnreadMentionCount: + return UnmarshalUpdateChatUnreadMentionCount(data) - case TypeUpdateChatNotificationSettings: - return UnmarshalUpdateChatNotificationSettings(data) + case TypeUpdateChatNotificationSettings: + return UnmarshalUpdateChatNotificationSettings(data) - case TypeUpdateScopeNotificationSettings: - return UnmarshalUpdateScopeNotificationSettings(data) + case TypeUpdateScopeNotificationSettings: + return UnmarshalUpdateScopeNotificationSettings(data) - case TypeUpdateChatReplyMarkup: - return UnmarshalUpdateChatReplyMarkup(data) + case TypeUpdateChatReplyMarkup: + return UnmarshalUpdateChatReplyMarkup(data) - case TypeUpdateChatDraftMessage: - return UnmarshalUpdateChatDraftMessage(data) + case TypeUpdateChatDraftMessage: + return UnmarshalUpdateChatDraftMessage(data) - case TypeUpdateDeleteMessages: - return UnmarshalUpdateDeleteMessages(data) + case TypeUpdateDeleteMessages: + return UnmarshalUpdateDeleteMessages(data) - case TypeUpdateUserChatAction: - return UnmarshalUpdateUserChatAction(data) + case TypeUpdateUserChatAction: + return UnmarshalUpdateUserChatAction(data) - case TypeUpdateUserStatus: - return UnmarshalUpdateUserStatus(data) + case TypeUpdateUserStatus: + return UnmarshalUpdateUserStatus(data) - case TypeUpdateUser: - return UnmarshalUpdateUser(data) + case TypeUpdateUser: + return UnmarshalUpdateUser(data) - case TypeUpdateBasicGroup: - return UnmarshalUpdateBasicGroup(data) + case TypeUpdateBasicGroup: + return UnmarshalUpdateBasicGroup(data) - case TypeUpdateSupergroup: - return UnmarshalUpdateSupergroup(data) + case TypeUpdateSupergroup: + return UnmarshalUpdateSupergroup(data) - case TypeUpdateSecretChat: - return UnmarshalUpdateSecretChat(data) + case TypeUpdateSecretChat: + return UnmarshalUpdateSecretChat(data) - case TypeUpdateUserFullInfo: - return UnmarshalUpdateUserFullInfo(data) + case TypeUpdateUserFullInfo: + return UnmarshalUpdateUserFullInfo(data) - case TypeUpdateBasicGroupFullInfo: - return UnmarshalUpdateBasicGroupFullInfo(data) + case TypeUpdateBasicGroupFullInfo: + return UnmarshalUpdateBasicGroupFullInfo(data) - case TypeUpdateSupergroupFullInfo: - return UnmarshalUpdateSupergroupFullInfo(data) + case TypeUpdateSupergroupFullInfo: + return UnmarshalUpdateSupergroupFullInfo(data) - case TypeUpdateServiceNotification: - return UnmarshalUpdateServiceNotification(data) + case TypeUpdateServiceNotification: + return UnmarshalUpdateServiceNotification(data) - case TypeUpdateFile: - return UnmarshalUpdateFile(data) + case TypeUpdateFile: + return UnmarshalUpdateFile(data) - case TypeUpdateFileGenerationStart: - return UnmarshalUpdateFileGenerationStart(data) + case TypeUpdateFileGenerationStart: + return UnmarshalUpdateFileGenerationStart(data) - case TypeUpdateFileGenerationStop: - return UnmarshalUpdateFileGenerationStop(data) + case TypeUpdateFileGenerationStop: + return UnmarshalUpdateFileGenerationStop(data) - case TypeUpdateCall: - return UnmarshalUpdateCall(data) + case TypeUpdateCall: + return UnmarshalUpdateCall(data) - case TypeUpdateUserPrivacySettingRules: - return UnmarshalUpdateUserPrivacySettingRules(data) + case TypeUpdateUserPrivacySettingRules: + return UnmarshalUpdateUserPrivacySettingRules(data) - case TypeUpdateUnreadMessageCount: - return UnmarshalUpdateUnreadMessageCount(data) + case TypeUpdateUnreadMessageCount: + return UnmarshalUpdateUnreadMessageCount(data) - case TypeUpdateUnreadChatCount: - return UnmarshalUpdateUnreadChatCount(data) + case TypeUpdateUnreadChatCount: + return UnmarshalUpdateUnreadChatCount(data) - case TypeUpdateOption: - return UnmarshalUpdateOption(data) + case TypeUpdateOption: + return UnmarshalUpdateOption(data) - case TypeUpdateInstalledStickerSets: - return UnmarshalUpdateInstalledStickerSets(data) + case TypeUpdateInstalledStickerSets: + return UnmarshalUpdateInstalledStickerSets(data) - case TypeUpdateTrendingStickerSets: - return UnmarshalUpdateTrendingStickerSets(data) + case TypeUpdateTrendingStickerSets: + return UnmarshalUpdateTrendingStickerSets(data) - case TypeUpdateRecentStickers: - return UnmarshalUpdateRecentStickers(data) + case TypeUpdateRecentStickers: + return UnmarshalUpdateRecentStickers(data) - case TypeUpdateFavoriteStickers: - return UnmarshalUpdateFavoriteStickers(data) + case TypeUpdateFavoriteStickers: + return UnmarshalUpdateFavoriteStickers(data) - case TypeUpdateSavedAnimations: - return UnmarshalUpdateSavedAnimations(data) + case TypeUpdateSavedAnimations: + return UnmarshalUpdateSavedAnimations(data) - case TypeUpdateLanguagePackStrings: - return UnmarshalUpdateLanguagePackStrings(data) + case TypeUpdateLanguagePackStrings: + return UnmarshalUpdateLanguagePackStrings(data) - case TypeUpdateConnectionState: - return UnmarshalUpdateConnectionState(data) + case TypeUpdateConnectionState: + return UnmarshalUpdateConnectionState(data) - case TypeUpdateTermsOfService: - return UnmarshalUpdateTermsOfService(data) + case TypeUpdateTermsOfService: + return UnmarshalUpdateTermsOfService(data) - case TypeUpdateNewInlineQuery: - return UnmarshalUpdateNewInlineQuery(data) + case TypeUpdateNewInlineQuery: + return UnmarshalUpdateNewInlineQuery(data) - case TypeUpdateNewChosenInlineResult: - return UnmarshalUpdateNewChosenInlineResult(data) + case TypeUpdateNewChosenInlineResult: + return UnmarshalUpdateNewChosenInlineResult(data) - case TypeUpdateNewCallbackQuery: - return UnmarshalUpdateNewCallbackQuery(data) + case TypeUpdateNewCallbackQuery: + return UnmarshalUpdateNewCallbackQuery(data) - case TypeUpdateNewInlineCallbackQuery: - return UnmarshalUpdateNewInlineCallbackQuery(data) + case TypeUpdateNewInlineCallbackQuery: + return UnmarshalUpdateNewInlineCallbackQuery(data) - case TypeUpdateNewShippingQuery: - return UnmarshalUpdateNewShippingQuery(data) + case TypeUpdateNewShippingQuery: + return UnmarshalUpdateNewShippingQuery(data) - case TypeUpdateNewPreCheckoutQuery: - return UnmarshalUpdateNewPreCheckoutQuery(data) + case TypeUpdateNewPreCheckoutQuery: + return UnmarshalUpdateNewPreCheckoutQuery(data) - case TypeUpdateNewCustomEvent: - return UnmarshalUpdateNewCustomEvent(data) + case TypeUpdateNewCustomEvent: + return UnmarshalUpdateNewCustomEvent(data) - case TypeUpdateNewCustomQuery: - return UnmarshalUpdateNewCustomQuery(data) + case TypeUpdateNewCustomQuery: + return UnmarshalUpdateNewCustomQuery(data) - case TypeTestInt: - return UnmarshalTestInt(data) + case TypeTestInt: + return UnmarshalTestInt(data) - case TypeTestString: - return UnmarshalTestString(data) + case TypeTestString: + return UnmarshalTestString(data) - case TypeTestBytes: - return UnmarshalTestBytes(data) + case TypeTestBytes: + return UnmarshalTestBytes(data) - case TypeTestVectorInt: - return UnmarshalTestVectorInt(data) + case TypeTestVectorInt: + return UnmarshalTestVectorInt(data) - case TypeTestVectorIntObject: - return UnmarshalTestVectorIntObject(data) + case TypeTestVectorIntObject: + return UnmarshalTestVectorIntObject(data) - case TypeTestVectorString: - return UnmarshalTestVectorString(data) + case TypeTestVectorString: + return UnmarshalTestVectorString(data) - case TypeTestVectorStringObject: - return UnmarshalTestVectorStringObject(data) + case TypeTestVectorStringObject: + return UnmarshalTestVectorStringObject(data) - default: - return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) - } + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } }