diff --git a/v1/client_test.go b/v1/client_test.go index 89f04a0..63fbd37 100644 --- a/v1/client_test.go +++ b/v1/client_test.go @@ -3,8 +3,10 @@ package v1 import ( "bytes" "encoding/base64" + "encoding/json" "errors" "fmt" + "io" "net/http" "strings" "testing" @@ -497,6 +499,7 @@ func (t *MGClientTest) Test_TextMessages() { ExternalID: "external_id", Type: MsgTypeText, Text: "hello!", + PageLink: "https://example.loca/catalog/1", }, Originator: OriginatorCustomer, Customer: Customer{ @@ -515,6 +518,17 @@ func (t *MGClientTest) Test_TextMessages() { defer gock.Off() t.gock(). Post(t.transportURL("messages")). + Filter(func(request *http.Request) bool { + data, err := io.ReadAll(request.Body) + if err != nil { + return false + } + request.Body = io.NopCloser(bytes.NewReader(data)) + + var snd SendData + t.Require().NoError(json.Unmarshal(data, &snd)) + return t.Assert().Equal("https://example.loca/catalog/1", snd.Message.PageLink) + }). Reply(http.StatusOK). JSON( MessagesResponse{ diff --git a/v1/types.go b/v1/types.go index 408f17e..218d471 100644 --- a/v1/types.go +++ b/v1/types.go @@ -283,6 +283,7 @@ type Message struct { Text string `json:"text,omitempty"` Note string `json:"note,omitempty"` Items []Item `json:"items,omitempty"` + PageLink string `json:"pageLink,omitempty"` } // SendMessage struct.