forked from NdoleStudio/httpsms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmessage_outstanding_request.go
More file actions
33 lines (28 loc) · 1006 Bytes
/
message_outstanding_request.go
File metadata and controls
33 lines (28 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package requests
import (
"strings"
"time"
"github.com/NdoleStudio/httpsms/pkg/entities"
"github.com/NdoleStudio/httpsms/pkg/services"
"github.com/google/uuid"
)
// MessageOutstanding is the payload fetching outstanding entities.Message
type MessageOutstanding struct {
request
MessageID string `json:"message_id" query:"message_id"`
}
// Sanitize sets defaults to MessageOutstanding
func (input *MessageOutstanding) Sanitize() MessageOutstanding {
input.MessageID = strings.TrimSpace(input.MessageID)
return *input
}
// ToGetOutstandingParams converts MessageOutstanding into services.MessageGetOutstandingParams
func (input *MessageOutstanding) ToGetOutstandingParams(source string, authCtx entities.AuthContext, timestamp time.Time) services.MessageGetOutstandingParams {
return services.MessageGetOutstandingParams{
Source: source,
PhoneNumbers: authCtx.PhoneNumbers,
UserID: authCtx.ID,
MessageID: uuid.MustParse(input.MessageID),
Timestamp: timestamp,
}
}