Update to TDLib 1.8.32

This commit is contained in:
c0re100 2024-07-02 01:51:28 +08:00
parent fefab36108
commit 1f84ff6e15
No known key found for this signature in database
GPG key ID: 7C3B3004FE745AAF
4 changed files with 899 additions and 230 deletions

View file

@ -4346,7 +4346,7 @@ type EditMessageCaptionRequest struct {
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption
Caption *FormattedText `json:"caption"`
// Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages
// Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages
ShowCaptionAboveMedia bool `json:"show_caption_above_media"`
}
@ -4519,7 +4519,7 @@ type EditInlineMessageCaptionRequest struct {
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters
Caption *FormattedText `json:"caption"`
// Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages
// Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages
ShowCaptionAboveMedia bool `json:"show_caption_above_media"`
}
@ -4865,7 +4865,7 @@ type EditBusinessMessageCaptionRequest struct {
ReplyMarkup ReplyMarkup `json:"reply_markup"`
// New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters
Caption *FormattedText `json:"caption"`
// Pass true to show the caption above the media; otherwise, caption will be shown below the media. Can be true only for animation, photo, and video messages
// Pass true to show the caption above the media; otherwise, the caption will be shown below the media. Can be true only for animation, photo, and video messages
ShowCaptionAboveMedia bool `json:"show_caption_above_media"`
}
@ -17701,7 +17701,7 @@ type GetPaymentFormRequest struct {
Theme *ThemeParameters `json:"theme"`
}
// Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy
// Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy, or wants to buy access to media in a messagePaidMedia message
func (client *Client) GetPaymentForm(req *GetPaymentFormRequest) (*PaymentForm, error) {
result, err := client.Send(Request{
meta: meta{
@ -19039,7 +19039,7 @@ type GetChatRevenueWithdrawalUrlRequest struct {
Password string `json:"password"`
}
// Returns URL for chat revenue withdrawal; requires owner privileges in the chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true and getOption("can_withdraw_chat_revenue")
// Returns a URL for chat revenue withdrawal; requires owner privileges in the chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true and getOption("can_withdraw_chat_revenue")
func (client *Client) GetChatRevenueWithdrawalUrl(req *GetChatRevenueWithdrawalUrlRequest) (*HttpUrl, error) {
result, err := client.Send(Request{
meta: meta{
@ -19094,7 +19094,7 @@ func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactions
}
type GetStarRevenueStatisticsRequest struct {
// Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true
// Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat
OwnerId MessageSender `json:"owner_id"`
// Pass true if a dark theme is used by the application
IsDark bool `json:"is_dark"`
@ -19123,7 +19123,7 @@ func (client *Client) GetStarRevenueStatistics(req *GetStarRevenueStatisticsRequ
}
type GetStarWithdrawalUrlRequest struct {
// Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of a channel chat with supergroupFullInfo.can_get_revenue_statistics == true
// Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat
OwnerId MessageSender `json:"owner_id"`
// The number of Telegram stars to withdraw. Must be at least getOption("star_withdrawal_count_min")
StarCount int64 `json:"star_count"`
@ -19131,7 +19131,7 @@ type GetStarWithdrawalUrlRequest struct {
Password string `json:"password"`
}
// Returns URL for Telegram star withdrawal
// Returns a URL for Telegram star withdrawal
func (client *Client) GetStarWithdrawalUrl(req *GetStarWithdrawalUrlRequest) (*HttpUrl, error) {
result, err := client.Send(Request{
meta: meta{
@ -19154,6 +19154,32 @@ func (client *Client) GetStarWithdrawalUrl(req *GetStarWithdrawalUrlRequest) (*H
return UnmarshalHttpUrl(result.Data)
}
type GetStarAdAccountUrlRequest struct {
// Identifier of the owner of the Telegram stars; can be identifier of an owned bot, or identifier of an owned channel chat
OwnerId MessageSender `json:"owner_id"`
}
// Returns a URL for a Telegram Ad platform account that can be used to set up advertisments for the chat paid in the owned Telegram stars
func (client *Client) GetStarAdAccountUrl(req *GetStarAdAccountUrlRequest) (*HttpUrl, error) {
result, err := client.Send(Request{
meta: meta{
Type: "getStarAdAccountUrl",
},
Data: map[string]interface{}{
"owner_id": req.OwnerId,
},
})
if err != nil {
return nil, err
}
if result.Type == "error" {
return nil, buildResponseError(result.Data)
}
return UnmarshalHttpUrl(result.Data)
}
type GetChatStatisticsRequest struct {
// Chat identifier
ChatId int64 `json:"chat_id"`

File diff suppressed because it is too large Load diff

View file

@ -200,6 +200,40 @@ func UnmarshalListOfAuthorizationState(dataList []json.RawMessage) ([]Authorizat
return list, nil
}
func UnmarshalFirebaseDeviceVerificationParameters(data json.RawMessage) (FirebaseDeviceVerificationParameters, error) {
var meta meta
err := json.Unmarshal(data, &meta)
if err != nil {
return nil, err
}
switch meta.Type {
case TypeFirebaseDeviceVerificationParametersSafetyNet:
return UnmarshalFirebaseDeviceVerificationParametersSafetyNet(data)
case TypeFirebaseDeviceVerificationParametersPlayIntegrity:
return UnmarshalFirebaseDeviceVerificationParametersPlayIntegrity(data)
default:
return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type)
}
}
func UnmarshalListOfFirebaseDeviceVerificationParameters(dataList []json.RawMessage) ([]FirebaseDeviceVerificationParameters, error) {
list := []FirebaseDeviceVerificationParameters{}
for _, data := range dataList {
entity, err := UnmarshalFirebaseDeviceVerificationParameters(data)
if err != nil {
return nil, err
}
list = append(list, entity)
}
return list, nil
}
func UnmarshalInputFile(data json.RawMessage) (InputFile, error) {
var meta meta
@ -680,8 +714,11 @@ func UnmarshalStarTransactionPartner(data json.RawMessage) (StarTransactionPartn
case TypeStarTransactionPartnerFragment:
return UnmarshalStarTransactionPartnerFragment(data)
case TypeStarTransactionPartnerUser:
return UnmarshalStarTransactionPartnerUser(data)
case TypeStarTransactionPartnerTelegramAds:
return UnmarshalStarTransactionPartnerTelegramAds(data)
case TypeStarTransactionPartnerBot:
return UnmarshalStarTransactionPartnerBot(data)
case TypeStarTransactionPartnerChannel:
return UnmarshalStarTransactionPartnerChannel(data)
@ -2398,7 +2435,7 @@ func UnmarshalListOfInputInvoice(dataList []json.RawMessage) ([]InputInvoice, er
return list, nil
}
func UnmarshalMessageExtendedMedia(data json.RawMessage) (MessageExtendedMedia, error) {
func UnmarshalPaidMedia(data json.RawMessage) (PaidMedia, error) {
var meta meta
err := json.Unmarshal(data, &meta)
@ -2407,28 +2444,28 @@ func UnmarshalMessageExtendedMedia(data json.RawMessage) (MessageExtendedMedia,
}
switch meta.Type {
case TypeMessageExtendedMediaPreview:
return UnmarshalMessageExtendedMediaPreview(data)
case TypePaidMediaPreview:
return UnmarshalPaidMediaPreview(data)
case TypeMessageExtendedMediaPhoto:
return UnmarshalMessageExtendedMediaPhoto(data)
case TypePaidMediaPhoto:
return UnmarshalPaidMediaPhoto(data)
case TypeMessageExtendedMediaVideo:
return UnmarshalMessageExtendedMediaVideo(data)
case TypePaidMediaVideo:
return UnmarshalPaidMediaVideo(data)
case TypeMessageExtendedMediaUnsupported:
return UnmarshalMessageExtendedMediaUnsupported(data)
case TypePaidMediaUnsupported:
return UnmarshalPaidMediaUnsupported(data)
default:
return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type)
}
}
func UnmarshalListOfMessageExtendedMedia(dataList []json.RawMessage) ([]MessageExtendedMedia, error) {
list := []MessageExtendedMedia{}
func UnmarshalListOfPaidMedia(dataList []json.RawMessage) ([]PaidMedia, error) {
list := []PaidMedia{}
for _, data := range dataList {
entity, err := UnmarshalMessageExtendedMedia(data)
entity, err := UnmarshalPaidMedia(data)
if err != nil {
return nil, err
}
@ -2770,6 +2807,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) {
case TypeMessageDocument:
return UnmarshalMessageDocument(data)
case TypeMessagePaidMedia:
return UnmarshalMessagePaidMedia(data)
case TypeMessagePhoto:
return UnmarshalMessagePhoto(data)
@ -3078,6 +3118,40 @@ func UnmarshalListOfTextEntityType(dataList []json.RawMessage) ([]TextEntityType
return list, nil
}
func UnmarshalInputPaidMediaType(data json.RawMessage) (InputPaidMediaType, error) {
var meta meta
err := json.Unmarshal(data, &meta)
if err != nil {
return nil, err
}
switch meta.Type {
case TypeInputPaidMediaTypePhoto:
return UnmarshalInputPaidMediaTypePhoto(data)
case TypeInputPaidMediaTypeVideo:
return UnmarshalInputPaidMediaTypeVideo(data)
default:
return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type)
}
}
func UnmarshalListOfInputPaidMediaType(dataList []json.RawMessage) ([]InputPaidMediaType, error) {
list := []InputPaidMediaType{}
for _, data := range dataList {
entity, err := UnmarshalInputPaidMediaType(data)
if err != nil {
return nil, err
}
list = append(list, entity)
}
return list, nil
}
func UnmarshalMessageSchedulingState(data json.RawMessage) (MessageSchedulingState, error) {
var meta meta
@ -3167,6 +3241,9 @@ func UnmarshalInputMessageContent(data json.RawMessage) (InputMessageContent, er
case TypeInputMessageDocument:
return UnmarshalInputMessageDocument(data)
case TypeInputMessagePaidMedia:
return UnmarshalInputMessagePaidMedia(data)
case TypeInputMessagePhoto:
return UnmarshalInputMessagePhoto(data)
@ -4838,6 +4915,9 @@ func UnmarshalPremiumFeature(data json.RawMessage) (PremiumFeature, error) {
case TypePremiumFeatureBusiness:
return UnmarshalPremiumFeatureBusiness(data)
case TypePremiumFeatureMessageEffects:
return UnmarshalPremiumFeatureMessageEffects(data)
default:
return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type)
}
@ -5553,6 +5633,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro
case TypePushMessageContentLocation:
return UnmarshalPushMessageContentLocation(data)
case TypePushMessageContentPaidMedia:
return UnmarshalPushMessageContentPaidMedia(data)
case TypePushMessageContentPhoto:
return UnmarshalPushMessageContentPhoto(data)
@ -7931,6 +8014,22 @@ func UnmarshalAuthorizationStateClosed(data json.RawMessage) (*AuthorizationStat
return &resp, err
}
func UnmarshalFirebaseDeviceVerificationParametersSafetyNet(data json.RawMessage) (*FirebaseDeviceVerificationParametersSafetyNet, error) {
var resp FirebaseDeviceVerificationParametersSafetyNet
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalFirebaseDeviceVerificationParametersPlayIntegrity(data json.RawMessage) (*FirebaseDeviceVerificationParametersPlayIntegrity, error) {
var resp FirebaseDeviceVerificationParametersPlayIntegrity
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalPasswordState(data json.RawMessage) (*PasswordState, error) {
var resp PasswordState
@ -8819,8 +8918,16 @@ func UnmarshalStarTransactionPartnerFragment(data json.RawMessage) (*StarTransac
return &resp, err
}
func UnmarshalStarTransactionPartnerUser(data json.RawMessage) (*StarTransactionPartnerUser, error) {
var resp StarTransactionPartnerUser
func UnmarshalStarTransactionPartnerTelegramAds(data json.RawMessage) (*StarTransactionPartnerTelegramAds, error) {
var resp StarTransactionPartnerTelegramAds
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalStarTransactionPartnerBot(data json.RawMessage) (*StarTransactionPartnerBot, error) {
var resp StarTransactionPartnerBot
err := json.Unmarshal(data, &resp)
@ -11395,32 +11502,32 @@ func UnmarshalInputInvoiceTelegram(data json.RawMessage) (*InputInvoiceTelegram,
return &resp, err
}
func UnmarshalMessageExtendedMediaPreview(data json.RawMessage) (*MessageExtendedMediaPreview, error) {
var resp MessageExtendedMediaPreview
func UnmarshalPaidMediaPreview(data json.RawMessage) (*PaidMediaPreview, error) {
var resp PaidMediaPreview
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalMessageExtendedMediaPhoto(data json.RawMessage) (*MessageExtendedMediaPhoto, error) {
var resp MessageExtendedMediaPhoto
func UnmarshalPaidMediaPhoto(data json.RawMessage) (*PaidMediaPhoto, error) {
var resp PaidMediaPhoto
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalMessageExtendedMediaVideo(data json.RawMessage) (*MessageExtendedMediaVideo, error) {
var resp MessageExtendedMediaVideo
func UnmarshalPaidMediaVideo(data json.RawMessage) (*PaidMediaVideo, error) {
var resp PaidMediaVideo
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalMessageExtendedMediaUnsupported(data json.RawMessage) (*MessageExtendedMediaUnsupported, error) {
var resp MessageExtendedMediaUnsupported
func UnmarshalPaidMediaUnsupported(data json.RawMessage) (*PaidMediaUnsupported, error) {
var resp PaidMediaUnsupported
err := json.Unmarshal(data, &resp)
@ -12051,6 +12158,14 @@ func UnmarshalMessageDocument(data json.RawMessage) (*MessageDocument, error) {
return &resp, err
}
func UnmarshalMessagePaidMedia(data json.RawMessage) (*MessagePaidMedia, error) {
var resp MessagePaidMedia
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalMessagePhoto(data json.RawMessage) (*MessagePhoto, error) {
var resp MessagePhoto
@ -12755,6 +12870,30 @@ func UnmarshalInputThumbnail(data json.RawMessage) (*InputThumbnail, error) {
return &resp, err
}
func UnmarshalInputPaidMediaTypePhoto(data json.RawMessage) (*InputPaidMediaTypePhoto, error) {
var resp InputPaidMediaTypePhoto
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalInputPaidMediaTypeVideo(data json.RawMessage) (*InputPaidMediaTypeVideo, error) {
var resp InputPaidMediaTypeVideo
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalInputPaidMedia(data json.RawMessage) (*InputPaidMedia, error) {
var resp InputPaidMedia
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalMessageSchedulingStateSendAtDate(data json.RawMessage) (*MessageSchedulingStateSendAtDate, error) {
var resp MessageSchedulingStateSendAtDate
@ -12835,6 +12974,14 @@ func UnmarshalInputMessageDocument(data json.RawMessage) (*InputMessageDocument,
return &resp, err
}
func UnmarshalInputMessagePaidMedia(data json.RawMessage) (*InputMessagePaidMedia, error) {
var resp InputMessagePaidMedia
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalInputMessagePhoto(data json.RawMessage) (*InputMessagePhoto, error) {
var resp InputMessagePhoto
@ -15443,6 +15590,14 @@ func UnmarshalPremiumFeatureBusiness(data json.RawMessage) (*PremiumFeatureBusin
return &resp, err
}
func UnmarshalPremiumFeatureMessageEffects(data json.RawMessage) (*PremiumFeatureMessageEffects, error) {
var resp PremiumFeatureMessageEffects
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalBusinessFeatureLocation(data json.RawMessage) (*BusinessFeatureLocation, error) {
var resp BusinessFeatureLocation
@ -16251,6 +16406,14 @@ func UnmarshalPushMessageContentLocation(data json.RawMessage) (*PushMessageCont
return &resp, err
}
func UnmarshalPushMessageContentPaidMedia(data json.RawMessage) (*PushMessageContentPaidMedia, error) {
var resp PushMessageContentPaidMedia
err := json.Unmarshal(data, &resp)
return &resp, err
}
func UnmarshalPushMessageContentPhoto(data json.RawMessage) (*PushMessageContentPhoto, error) {
var resp PushMessageContentPhoto
@ -19997,6 +20160,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeAuthorizationStateClosed:
return UnmarshalAuthorizationStateClosed(data)
case TypeFirebaseDeviceVerificationParametersSafetyNet:
return UnmarshalFirebaseDeviceVerificationParametersSafetyNet(data)
case TypeFirebaseDeviceVerificationParametersPlayIntegrity:
return UnmarshalFirebaseDeviceVerificationParametersPlayIntegrity(data)
case TypePasswordState:
return UnmarshalPasswordState(data)
@ -20330,8 +20499,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeStarTransactionPartnerFragment:
return UnmarshalStarTransactionPartnerFragment(data)
case TypeStarTransactionPartnerUser:
return UnmarshalStarTransactionPartnerUser(data)
case TypeStarTransactionPartnerTelegramAds:
return UnmarshalStarTransactionPartnerTelegramAds(data)
case TypeStarTransactionPartnerBot:
return UnmarshalStarTransactionPartnerBot(data)
case TypeStarTransactionPartnerChannel:
return UnmarshalStarTransactionPartnerChannel(data)
@ -21296,17 +21468,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeInputInvoiceTelegram:
return UnmarshalInputInvoiceTelegram(data)
case TypeMessageExtendedMediaPreview:
return UnmarshalMessageExtendedMediaPreview(data)
case TypePaidMediaPreview:
return UnmarshalPaidMediaPreview(data)
case TypeMessageExtendedMediaPhoto:
return UnmarshalMessageExtendedMediaPhoto(data)
case TypePaidMediaPhoto:
return UnmarshalPaidMediaPhoto(data)
case TypeMessageExtendedMediaVideo:
return UnmarshalMessageExtendedMediaVideo(data)
case TypePaidMediaVideo:
return UnmarshalPaidMediaVideo(data)
case TypeMessageExtendedMediaUnsupported:
return UnmarshalMessageExtendedMediaUnsupported(data)
case TypePaidMediaUnsupported:
return UnmarshalPaidMediaUnsupported(data)
case TypePremiumGiveawayParameters:
return UnmarshalPremiumGiveawayParameters(data)
@ -21542,6 +21714,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeMessageDocument:
return UnmarshalMessageDocument(data)
case TypeMessagePaidMedia:
return UnmarshalMessagePaidMedia(data)
case TypeMessagePhoto:
return UnmarshalMessagePhoto(data)
@ -21806,6 +21981,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeInputThumbnail:
return UnmarshalInputThumbnail(data)
case TypeInputPaidMediaTypePhoto:
return UnmarshalInputPaidMediaTypePhoto(data)
case TypeInputPaidMediaTypeVideo:
return UnmarshalInputPaidMediaTypeVideo(data)
case TypeInputPaidMedia:
return UnmarshalInputPaidMedia(data)
case TypeMessageSchedulingStateSendAtDate:
return UnmarshalMessageSchedulingStateSendAtDate(data)
@ -21836,6 +22020,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypeInputMessageDocument:
return UnmarshalInputMessageDocument(data)
case TypeInputMessagePaidMedia:
return UnmarshalInputMessagePaidMedia(data)
case TypeInputMessagePhoto:
return UnmarshalInputMessagePhoto(data)
@ -22814,6 +23001,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypePremiumFeatureBusiness:
return UnmarshalPremiumFeatureBusiness(data)
case TypePremiumFeatureMessageEffects:
return UnmarshalPremiumFeatureMessageEffects(data)
case TypeBusinessFeatureLocation:
return UnmarshalBusinessFeatureLocation(data)
@ -23117,6 +23307,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) {
case TypePushMessageContentLocation:
return UnmarshalPushMessageContentLocation(data)
case TypePushMessageContentPaidMedia:
return UnmarshalPushMessageContentPaidMedia(data)
case TypePushMessageContentPhoto:
return UnmarshalPushMessageContentPhoto(data)