# TdApi.SponsoredMessage (tdlight API 4.0.311 API)
declaration: module: tdlight.api, package: it.tdlight.jni, class: TdApi, class: SponsoredMessage

Module tdlight.api
Package it.tdlight.jni

# Class TdApi.SponsoredMessage

java.lang.Object
it.tdlight.jni.TdApi.Object
it.tdlight.jni.TdApi.SponsoredMessage

Enclosing class:
  TdApi

public static final class TdApi.SponsoredMessage extends TdApi.Object
Describes a sponsored message.

## Field Summary

Fields
Modifier and Type
Field
Description
`String`
`additionalInfo`
If non-empty, additional information about the sponsored message to be shown along with the message.
`static final int`
`CONSTRUCTOR`
`TdApi.MessageContent`
`content`
Content of the message.
`boolean`
`isRecommended`
True, if the message needs to be labeled as "recommended" instead of "sponsored".
`TdApi.InternalLinkType`
`link`
An internal link to be opened when the sponsored message is clicked; may be null if the sponsor chat needs to be opened instead.
`long`
`messageId`
Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages.
`boolean`
`showChatPhoto`
True, if the sponsor's chat photo must be shown.
`long`
`sponsorChatId`
Sponsor chat identifier; 0 if the sponsor chat is accessible through an invite link.
`TdApi.ChatInviteLinkInfo`
`sponsorChatInfo`
Information about the sponsor chat; may be null unless sponsorChatId == 0.
`String`
`sponsorInfo`
If non-empty, information about the sponsor to be shown along with the message.

## Constructor Summary

Constructors
Constructor
Description
`SponsoredMessage()`
Describes a sponsored message.
`SponsoredMessage(long messageId, boolean isRecommended, long sponsorChatId, TdApi.ChatInviteLinkInfo sponsorChatInfo, boolean showChatPhoto, TdApi.InternalLinkType link, TdApi.MessageContent content, String sponsorInfo, String additionalInfo)`
Describes a sponsored message.
`SponsoredMessage(DataInput input)`
Describes a sponsored message.

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object o)`
`int`
`getConstructor()`
`int`
`hashCode()`
`void`
`serialize(DataOutput output)`

### Methods inherited from class it.tdlight.jni.TdApi.Object

`serialize, toString`

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Field Details

### messageId

public long messageId
Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages.

### isRecommended

public boolean isRecommended
True, if the message needs to be labeled as "recommended" instead of "sponsored".

### sponsorChatId

public long sponsorChatId
Sponsor chat identifier; 0 if the sponsor chat is accessible through an invite link.

### sponsorChatInfo

public TdApi.ChatInviteLinkInfo sponsorChatInfo
Information about the sponsor chat; may be null unless sponsorChatId == 0.

### showChatPhoto

public boolean showChatPhoto
True, if the sponsor's chat photo must be shown.

### link

public TdApi.InternalLinkType link
An internal link to be opened when the sponsored message is clicked; may be null if the sponsor chat needs to be opened instead.

### content

public TdApi.MessageContent content
Content of the message. Currently, can be only of the type messageText.

### sponsorInfo

public String sponsorInfo
If non-empty, information about the sponsor to be shown along with the message.

### additionalInfo

public String additionalInfo
If non-empty, additional information about the sponsored message to be shown along with the message.

### CONSTRUCTOR

public static final int CONSTRUCTOR

See Also:
  - Constant Field Values

## Constructor Details

### SponsoredMessage

public SponsoredMessage()
Describes a sponsored message.

### SponsoredMessage

public SponsoredMessage(long messageId, boolean isRecommended, long sponsorChatId, TdApi.ChatInviteLinkInfo sponsorChatInfo, boolean showChatPhoto, TdApi.InternalLinkType link, TdApi.MessageContent content, String sponsorInfo, String additionalInfo)
Describes a sponsored message.

Parameters:
  `messageId` - long Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages.
  `isRecommended` - boolean True, if the message needs to be labeled as "recommended" instead of "sponsored".
  `sponsorChatId` - long Sponsor chat identifier; 0 if the sponsor chat is accessible through an invite link.
  `sponsorChatInfo` - ChatInviteLinkInfo Information about the sponsor chat; may be null unless sponsorChatId == 0.
  `showChatPhoto` - boolean True, if the sponsor's chat photo must be shown.
  `link` - InternalLinkType An internal link to be opened when the sponsored message is clicked; may be null if the sponsor chat needs to be opened instead.
  `content` - MessageContent Content of the message. Currently, can be only of the type messageText.
  `sponsorInfo` - String If non-empty, information about the sponsor to be shown along with the message.
  `additionalInfo` - String If non-empty, additional information about the sponsored message to be shown along with the message.

### SponsoredMessage

public SponsoredMessage(DataInput input) throws IOException
Describes a sponsored message.

Throws:
  `IOException`

## Method Details

### getConstructor

public int getConstructor()

Specified by:
  `getConstructor` in class `TdApi.Object`

### serialize

public void serialize(DataOutput output) throws IOException

Specified by:
  `serialize` in class `TdApi.Object`
Throws:
  `IOException`

### equals

public boolean equals(Object o)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`