/* * Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.chimesdkmessaging.model; import java.io.Serializable; /** *

* Stores information about a callback. *

*/ public class ChannelMessageCallback implements Serializable { /** *

* The message ID. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [-_a-zA-Z0-9]*
*/ private String messageId; /** *

* The message content. For Amazon Lex V2 bot responses, this field holds a * list of messages originating from the bot. For more information, refer to * Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

*

* Constraints:
* Length: 1 -
* Pattern: [\s\S]*
*/ private String content; /** *

* The message metadata. *

*

* Constraints:
* Length: 0 - 1024
* Pattern: .*
*/ private String metadata; /** *

* The push notification configuration of the message. *

*/ private PushNotificationConfiguration pushNotification; /** *

* The attributes for the channel message. For Amazon Lex V2 bot responses, * the attributes are mapped to specific fields from the bot. For more * information, refer to Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

*/ private java.util.Map messageAttributes; /** *

* The ID of the SubChannel. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [-_a-zA-Z0-9]*
*/ private String subChannelId; /** *

* The content type of the call-back message. For Amazon Lex V2 bot * responses, the content type is * application/amz-chime-lex-msgs for success responses and * application/amz-chime-lex-error for failure responses. For * more information, refer to Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

*

* Constraints:
* Length: 0 - 45
* Pattern: [\s\S]*
*/ private String contentType; /** *

* The message ID. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [-_a-zA-Z0-9]*
* * @return

* The message ID. *

*/ public String getMessageId() { return messageId; } /** *

* The message ID. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [-_a-zA-Z0-9]*
* * @param messageId

* The message ID. *

*/ public void setMessageId(String messageId) { this.messageId = messageId; } /** *

* The message ID. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 1 - 128
* Pattern: [-_a-zA-Z0-9]*
* * @param messageId

* The message ID. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ChannelMessageCallback withMessageId(String messageId) { this.messageId = messageId; return this; } /** *

* The message content. For Amazon Lex V2 bot responses, this field holds a * list of messages originating from the bot. For more information, refer to * Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

*

* Constraints:
* Length: 1 -
* Pattern: [\s\S]*
* * @return

* The message content. For Amazon Lex V2 bot responses, this field * holds a list of messages originating from the bot. For more * information, refer to Processing responses from an AppInstanceBot in the Amazon * Chime SDK Messaging Developer Guide. *

*/ public String getContent() { return content; } /** *

* The message content. For Amazon Lex V2 bot responses, this field holds a * list of messages originating from the bot. For more information, refer to * Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

*

* Constraints:
* Length: 1 -
* Pattern: [\s\S]*
* * @param content

* The message content. For Amazon Lex V2 bot responses, this * field holds a list of messages originating from the bot. For * more information, refer to Processing responses from an AppInstanceBot in the * Amazon Chime SDK Messaging Developer Guide. *

*/ public void setContent(String content) { this.content = content; } /** *

* The message content. For Amazon Lex V2 bot responses, this field holds a * list of messages originating from the bot. For more information, refer to * Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 1 -
* Pattern: [\s\S]*
* * @param content

* The message content. For Amazon Lex V2 bot responses, this * field holds a list of messages originating from the bot. For * more information, refer to Processing responses from an AppInstanceBot in the * Amazon Chime SDK Messaging Developer Guide. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ChannelMessageCallback withContent(String content) { this.content = content; return this; } /** *

* The message metadata. *

*

* Constraints:
* Length: 0 - 1024
* Pattern: .*
* * @return

* The message metadata. *

*/ public String getMetadata() { return metadata; } /** *

* The message metadata. *

*

* Constraints:
* Length: 0 - 1024
* Pattern: .*
* * @param metadata

* The message metadata. *

*/ public void setMetadata(String metadata) { this.metadata = metadata; } /** *

* The message metadata. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 0 - 1024
* Pattern: .*
* * @param metadata

* The message metadata. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ChannelMessageCallback withMetadata(String metadata) { this.metadata = metadata; return this; } /** *

* The push notification configuration of the message. *

* * @return

* The push notification configuration of the message. *

*/ public PushNotificationConfiguration getPushNotification() { return pushNotification; } /** *

* The push notification configuration of the message. *

* * @param pushNotification

* The push notification configuration of the message. *

*/ public void setPushNotification(PushNotificationConfiguration pushNotification) { this.pushNotification = pushNotification; } /** *

* The push notification configuration of the message. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param pushNotification

* The push notification configuration of the message. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ChannelMessageCallback withPushNotification( PushNotificationConfiguration pushNotification) { this.pushNotification = pushNotification; return this; } /** *

* The attributes for the channel message. For Amazon Lex V2 bot responses, * the attributes are mapped to specific fields from the bot. For more * information, refer to Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

* * @return

* The attributes for the channel message. For Amazon Lex V2 bot * responses, the attributes are mapped to specific fields from the * bot. For more information, refer to Processing responses from an AppInstanceBot in the Amazon * Chime SDK Messaging Developer Guide. *

*/ public java.util.Map getMessageAttributes() { return messageAttributes; } /** *

* The attributes for the channel message. For Amazon Lex V2 bot responses, * the attributes are mapped to specific fields from the bot. For more * information, refer to Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

* * @param messageAttributes

* The attributes for the channel message. For Amazon Lex V2 bot * responses, the attributes are mapped to specific fields from * the bot. For more information, refer to Processing responses from an AppInstanceBot in the * Amazon Chime SDK Messaging Developer Guide. *

*/ public void setMessageAttributes(java.util.Map messageAttributes) { this.messageAttributes = messageAttributes; } /** *

* The attributes for the channel message. For Amazon Lex V2 bot responses, * the attributes are mapped to specific fields from the bot. For more * information, refer to Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

*

* Returns a reference to this object so that method calls can be chained * together. * * @param messageAttributes

* The attributes for the channel message. For Amazon Lex V2 bot * responses, the attributes are mapped to specific fields from * the bot. For more information, refer to Processing responses from an AppInstanceBot in the * Amazon Chime SDK Messaging Developer Guide. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ChannelMessageCallback withMessageAttributes( java.util.Map messageAttributes) { this.messageAttributes = messageAttributes; return this; } /** *

* The attributes for the channel message. For Amazon Lex V2 bot responses, * the attributes are mapped to specific fields from the bot. For more * information, refer to Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

*

* The method adds a new key-value pair into MessageAttributes parameter, * and returns a reference to this object so that method calls can be * chained together. * * @param key The key of the entry to be added into MessageAttributes. * @param value The corresponding value of the entry to be added into * MessageAttributes. * @return A reference to this updated object so that method calls can be * chained together. */ public ChannelMessageCallback addMessageAttributesEntry(String key, MessageAttributeValue value) { if (null == this.messageAttributes) { this.messageAttributes = new java.util.HashMap(); } if (this.messageAttributes.containsKey(key)) throw new IllegalArgumentException("Duplicated keys (" + key.toString() + ") are provided."); this.messageAttributes.put(key, value); return this; } /** * Removes all the entries added into MessageAttributes. *

* Returns a reference to this object so that method calls can be chained * together. */ public ChannelMessageCallback clearMessageAttributesEntries() { this.messageAttributes = null; return this; } /** *

* The ID of the SubChannel. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [-_a-zA-Z0-9]*
* * @return

* The ID of the SubChannel. *

*/ public String getSubChannelId() { return subChannelId; } /** *

* The ID of the SubChannel. *

*

* Constraints:
* Length: 1 - 128
* Pattern: [-_a-zA-Z0-9]*
* * @param subChannelId

* The ID of the SubChannel. *

*/ public void setSubChannelId(String subChannelId) { this.subChannelId = subChannelId; } /** *

* The ID of the SubChannel. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 1 - 128
* Pattern: [-_a-zA-Z0-9]*
* * @param subChannelId

* The ID of the SubChannel. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ChannelMessageCallback withSubChannelId(String subChannelId) { this.subChannelId = subChannelId; return this; } /** *

* The content type of the call-back message. For Amazon Lex V2 bot * responses, the content type is * application/amz-chime-lex-msgs for success responses and * application/amz-chime-lex-error for failure responses. For * more information, refer to Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

*

* Constraints:
* Length: 0 - 45
* Pattern: [\s\S]*
* * @return

* The content type of the call-back message. For Amazon Lex V2 bot * responses, the content type is * application/amz-chime-lex-msgs for success responses * and application/amz-chime-lex-error for failure * responses. For more information, refer to Processing responses from an AppInstanceBot in the Amazon * Chime SDK Messaging Developer Guide. *

*/ public String getContentType() { return contentType; } /** *

* The content type of the call-back message. For Amazon Lex V2 bot * responses, the content type is * application/amz-chime-lex-msgs for success responses and * application/amz-chime-lex-error for failure responses. For * more information, refer to Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

*

* Constraints:
* Length: 0 - 45
* Pattern: [\s\S]*
* * @param contentType

* The content type of the call-back message. For Amazon Lex V2 * bot responses, the content type is * application/amz-chime-lex-msgs for success * responses and application/amz-chime-lex-error for * failure responses. For more information, refer to Processing responses from an AppInstanceBot in the * Amazon Chime SDK Messaging Developer Guide. *

*/ public void setContentType(String contentType) { this.contentType = contentType; } /** *

* The content type of the call-back message. For Amazon Lex V2 bot * responses, the content type is * application/amz-chime-lex-msgs for success responses and * application/amz-chime-lex-error for failure responses. For * more information, refer to Processing responses from an AppInstanceBot in the Amazon Chime * SDK Messaging Developer Guide. *

*

* Returns a reference to this object so that method calls can be chained * together. *

* Constraints:
* Length: 0 - 45
* Pattern: [\s\S]*
* * @param contentType

* The content type of the call-back message. For Amazon Lex V2 * bot responses, the content type is * application/amz-chime-lex-msgs for success * responses and application/amz-chime-lex-error for * failure responses. For more information, refer to Processing responses from an AppInstanceBot in the * Amazon Chime SDK Messaging Developer Guide. *

* @return A reference to this updated object so that method calls can be * chained together. */ public ChannelMessageCallback withContentType(String contentType) { this.contentType = contentType; return this; } /** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getMessageId() != null) sb.append("MessageId: " + getMessageId() + ","); if (getContent() != null) sb.append("Content: " + getContent() + ","); if (getMetadata() != null) sb.append("Metadata: " + getMetadata() + ","); if (getPushNotification() != null) sb.append("PushNotification: " + getPushNotification() + ","); if (getMessageAttributes() != null) sb.append("MessageAttributes: " + getMessageAttributes() + ","); if (getSubChannelId() != null) sb.append("SubChannelId: " + getSubChannelId() + ","); if (getContentType() != null) sb.append("ContentType: " + getContentType()); sb.append("}"); return sb.toString(); } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getMessageId() == null) ? 0 : getMessageId().hashCode()); hashCode = prime * hashCode + ((getContent() == null) ? 0 : getContent().hashCode()); hashCode = prime * hashCode + ((getMetadata() == null) ? 0 : getMetadata().hashCode()); hashCode = prime * hashCode + ((getPushNotification() == null) ? 0 : getPushNotification().hashCode()); hashCode = prime * hashCode + ((getMessageAttributes() == null) ? 0 : getMessageAttributes().hashCode()); hashCode = prime * hashCode + ((getSubChannelId() == null) ? 0 : getSubChannelId().hashCode()); hashCode = prime * hashCode + ((getContentType() == null) ? 0 : getContentType().hashCode()); return hashCode; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ChannelMessageCallback == false) return false; ChannelMessageCallback other = (ChannelMessageCallback) obj; if (other.getMessageId() == null ^ this.getMessageId() == null) return false; if (other.getMessageId() != null && other.getMessageId().equals(this.getMessageId()) == false) return false; if (other.getContent() == null ^ this.getContent() == null) return false; if (other.getContent() != null && other.getContent().equals(this.getContent()) == false) return false; if (other.getMetadata() == null ^ this.getMetadata() == null) return false; if (other.getMetadata() != null && other.getMetadata().equals(this.getMetadata()) == false) return false; if (other.getPushNotification() == null ^ this.getPushNotification() == null) return false; if (other.getPushNotification() != null && other.getPushNotification().equals(this.getPushNotification()) == false) return false; if (other.getMessageAttributes() == null ^ this.getMessageAttributes() == null) return false; if (other.getMessageAttributes() != null && other.getMessageAttributes().equals(this.getMessageAttributes()) == false) return false; if (other.getSubChannelId() == null ^ this.getSubChannelId() == null) return false; if (other.getSubChannelId() != null && other.getSubChannelId().equals(this.getSubChannelId()) == false) return false; if (other.getContentType() == null ^ this.getContentType() == null) return false; if (other.getContentType() != null && other.getContentType().equals(this.getContentType()) == false) return false; return true; } }