@@ -1603,9 +1603,7 @@ public static FormBody.Builder toForm(ChatPostMessageRequest req) {
16031603 } else if (req .getMetadata () != null ) {
16041604 String json = GSON .toJson (req .getMetadata ());
16051605 form .add ("metadata" , json );
1606- }
1607-
1608- if (req .getEventAndEntityMetadataAsString () != null ) {
1606+ } else if (req .getEventAndEntityMetadataAsString () != null ) {
16091607 form .add ("metadata" , req .getEventAndEntityMetadataAsString ());
16101608 } else if (req .getEventAndEntityMetadata () != null ) {
16111609 Message .EventAndEntityMetadata metadata = req .getEventAndEntityMetadata ();
@@ -1621,6 +1619,21 @@ public static FormBody.Builder toForm(ChatPostMessageRequest req) {
16211619 }
16221620 }
16231621
1622+ // Output warnings related to the metadata property
1623+ Boolean eventMetadataSet = req .getMetadata () != null || req .getMetadataAsString () != null ;
1624+ Boolean eventEntityMetadataSet = req .getEventAndEntityMetadata () != null
1625+ || req .getEventAndEntityMetadataAsString () != null ;
1626+ if (eventMetadataSet && eventEntityMetadataSet ) {
1627+ log .warn ("When both Metadata and EventAndEntityMetadata properties are set, only Metadata will be used." );
1628+ }
1629+ if (req .getMetadata () != null && req .getMetadataAsString () != null ) {
1630+ log .warn ("When both metadata and metadataAsString are set, only metadataAsString will be used." );
1631+ }
1632+ if (req .getEventAndEntityMetadata () != null && req .getEventAndEntityMetadataAsString () != null ) {
1633+ log .warn (
1634+ "When both eventAndEntityMetadata and eventAndEntityMetadataAsString are set, only eventAndEntityMetadataAsString will be used." );
1635+ }
1636+
16241637 if (req .getBlocksAsString () != null ) {
16251638 form .add ("blocks" , req .getBlocksAsString ());
16261639 } else if (req .getBlocks () != null ) {
@@ -1729,12 +1742,17 @@ public static FormBody.Builder toForm(ChatUnfurlRequest req) {
17291742 FormBody .Builder form = new FormBody .Builder ();
17301743 setIfNotNull ("ts" , req .getTs (), form );
17311744 setIfNotNull ("channel" , req .getChannel (), form );
1745+
17321746 if (req .getRawUnfurls () != null ) {
17331747 setIfNotNull ("unfurls" , req .getRawUnfurls (), form );
17341748 } else if (req .getUnfurls () != null ) {
17351749 String json = getJsonWithGsonAnonymInnerClassHandling (req .getUnfurls ());
17361750 setIfNotNull ("unfurls" , json , form );
17371751 }
1752+ if (req .getRawUnfurls () != null && req .getUnfurls () != null ) {
1753+ log .warn ("When both unfurls and rawUnfurls are set, only rawUnfurls will be used." );
1754+ }
1755+
17381756 if (req .getRawMetadata () != null ) {
17391757 setIfNotNull ("metadata" , req .getRawMetadata (), form );
17401758 } else if (req .getMetadata () != null ) {
@@ -1746,6 +1764,10 @@ public static FormBody.Builder toForm(ChatUnfurlRequest req) {
17461764 String json = GSON .toJson (metadata , ChatUnfurlRequest .UnfurlMetadata .class );
17471765 setIfNotNull ("metadata" , json , form );
17481766 }
1767+ if (req .getRawMetadata () != null && req .getMetadata () != null ) {
1768+ log .warn ("When both metadata and rawMetadata are set, only rawMetadata will be used." );
1769+ }
1770+
17491771 setIfNotNull ("user_auth_required" , req .isUserAuthRequired (), form );
17501772 setIfNotNull ("user_auth_message" , req .getUserAuthMessage (), form );
17511773 if (req .getRawUserAuthBlocks () != null ) {
0 commit comments