Skip to content

Commit 6e7d60c

Browse files
committed
[client] provide message content in state
1 parent f83a97a commit 6e7d60c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

smsgateway/domain_messages.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ type TextMessage struct {
4343
Text string `json:"text" validate:"required,min=1,max=65535" example:"Hello World!"`
4444
}
4545

46+
// HashedMessage represents an SMS message with a hashed payload.
47+
//
48+
// Hash is the SHA256 hash of the message content (text or data).
49+
type HashedMessage struct {
50+
Hash string `json:"hash" validate:"required,sha256" example:"1d4b6e3b1b6e3b1b6e3b1b6e3b1b6e3b1b6e3b1b"`
51+
}
52+
4653
// DataMessage represents an SMS message with a binary payload.
4754
//
4855
// Data is the base64-encoded payload.
@@ -155,6 +162,11 @@ type MessageState struct {
155162
IsEncrypted bool `json:"isEncrypted" example:"false"` // Encrypted
156163
Recipients []RecipientState `json:"recipients" validate:"required,min=1,dive"` // Recipients states
157164
States map[string]time.Time `json:"states"` // History of states
165+
166+
TextMessage *TextMessage `json:"textMessage,omitempty"` // Present only when `includeContent=true` and the message type is text.
167+
DataMessage *DataMessage `json:"dataMessage,omitempty"` // Present only when `includeContent=true` and the message type is data.
168+
HashedMessage *HashedMessage `json:"hashedMessage,omitempty"` // Hashed message content, if isHashed is true
169+
158170
}
159171

160172
func (m MessageState) Validate() error {

0 commit comments

Comments
 (0)