File size: 1,006 Bytes
83a59ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
34
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,
	}
}