tsk-59: Get MessageEventResponse endpoint (#61)
Closes #59 Reviewed-on: phoenix/textsender-api#61 Co-authored-by: phoenix <kundeng00@pm.me> Co-committed-by: phoenix <kundeng00@pm.me>
This commit is contained in:
@@ -2,6 +2,7 @@ package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
@@ -74,3 +75,36 @@ func TestScheduledMessage(id uuid.UUID, userId uuid.UUID, now time.Time) schedul
|
||||
func TestScheduledMessageEvent(messageId, contactId, scheduledMessageId uuid.UUID) scheduling.ScheduledMessageEvent {
|
||||
return scheduling.ScheduledMessageEvent{MessageId: messageId, ContactId: contactId, ScheduledMessageId: scheduledMessageId}
|
||||
}
|
||||
|
||||
func TestMERResponseInString() string {
|
||||
return `{
|
||||
"body": "Whoknows?",
|
||||
"num_segments": "0",
|
||||
"direction": "outbound-api",
|
||||
"from": "+12243026041",
|
||||
"to": "+16303831708",
|
||||
"date_updated": "Sat,29Nov202519:06:59+0000",
|
||||
"uri": "/2010-04-01/Accounts/ACefa1ef516314c9d1a68cbd657de49277/Messages/SM1193a529e7f7a840667cd1e0f13ea95a.json",
|
||||
"account_sid": "ACefa1ef516314c9d1a68cbd657de49277",
|
||||
"num_media": "0",
|
||||
"status": "scheduled",
|
||||
"messaging_service_sid": "MG803f3676706b92eb02e18dd820c447f2",
|
||||
"sid": "SM1193a529e7f7a840667cd1e0f13ea95a",
|
||||
"date_created": "Sat,29Nov202519:06:59+0000",
|
||||
"api_version": "2010-04-01",
|
||||
"subresource_uris": {
|
||||
"media": "/2010-04-01/Accounts/ACefa1ef516314c9d1a68cbd657de49277/Messages/SM1193a529e7f7a840667cd1e0f13ea95a/Media.json"
|
||||
}
|
||||
}`
|
||||
}
|
||||
|
||||
func TestConvertStringToMapOfAny(response string) (map[string]any, error) {
|
||||
bytes := []byte(response)
|
||||
var merResponse map[string]any
|
||||
err := json.Unmarshal(bytes, &merResponse)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return merResponse, nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user