Reviewed-on: phoenix/twilio_sender#1 Co-authored-by: kdeng00 <kundeng94@gmail.com> Co-committed-by: kdeng00 <kundeng94@gmail.com>
66 lines
1.1 KiB
Go
66 lines
1.1 KiB
Go
package models
|
|
|
|
import (
|
|
"fmt"
|
|
)
|
|
|
|
type Number struct {
|
|
PhoneNumber string `json:"number"`
|
|
}
|
|
|
|
func (nbr Number) IsEmpty() bool {
|
|
if nbr.PhoneNumber == "" {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
}
|
|
|
|
func PrintNumbers(numbers [](Number)) {
|
|
for _, element := range numbers {
|
|
fmt.Println("Phone number:", element.PhoneNumber)
|
|
}
|
|
}
|
|
|
|
type Message struct {
|
|
Text string `json:"text"`
|
|
}
|
|
|
|
func (msg Message) IsEmpty() bool {
|
|
if msg.Text == "" {
|
|
return true
|
|
} else {
|
|
return false
|
|
}
|
|
}
|
|
|
|
func (msg Message) Print() {
|
|
fmt.Println("Message:", msg.Text)
|
|
}
|
|
|
|
type TwiloDetails struct {
|
|
AccountSID string `json:"account_sid"`
|
|
ServiceSID string `json:"service_sid"`
|
|
URI string `json:"uri"`
|
|
AuthToken string `json:"auth_token"`
|
|
Number string `json:"number"`
|
|
}
|
|
|
|
func (config TwiloDetails) PrintConfig() {
|
|
fmt.Printf("Account SID: %s\n", config.AccountSID)
|
|
fmt.Printf("Service SID: %s\n", config.ServiceSID)
|
|
fmt.Println("URI:", config.URI)
|
|
fmt.Printf("Auth Token: %s\n", config.AuthToken)
|
|
fmt.Printf("Number: %s\n", config.Number)
|
|
}
|
|
|
|
func Init() TwiloDetails {
|
|
return TwiloDetails{
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
"",
|
|
}
|
|
}
|