Documentation
¶
Overview ¶
Package client provides a Twilio API client wrapper using the official twilio-go SDK.
Index ¶
- type Call
- type Client
- func (c *Client) AccountSID() string
- func (c *Client) GetCall(ctx context.Context, callSID string) (*Call, error)
- func (c *Client) HangupCall(ctx context.Context, callSID string) (*Call, error)
- func (c *Client) ListPhoneNumbers(ctx context.Context) ([]PhoneNumber, error)
- func (c *Client) MakeCall(ctx context.Context, params *MakeCallParams) (*Call, error)
- func (c *Client) RestClient() *twilio.RestClient
- func (c *Client) SendSMS(ctx context.Context, params *SendSMSParams) (*Message, error)
- func (c *Client) UpdateCall(ctx context.Context, callSID string, params *UpdateCallParams) (*Call, error)
- type Config
- type MakeCallParams
- type Message
- type PhoneNumber
- type SendSMSParams
- type UpdateCallParams
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Call ¶
type Call struct {
SID string
AccountSID string
To string
From string
Status string
Direction string
Duration string
StartTime string
EndTime string
}
Call represents a Twilio call resource.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the official Twilio SDK for internal use.
func (*Client) AccountSID ¶
AccountSID returns the account SID.
func (*Client) HangupCall ¶
HangupCall ends a call.
func (*Client) ListPhoneNumbers ¶
func (c *Client) ListPhoneNumbers(ctx context.Context) ([]PhoneNumber, error)
ListPhoneNumbers returns all phone numbers on the account.
func (*Client) RestClient ¶
func (c *Client) RestClient() *twilio.RestClient
RestClient returns the underlying Twilio REST client.
func (*Client) UpdateCall ¶
func (c *Client) UpdateCall(ctx context.Context, callSID string, params *UpdateCallParams) (*Call, error)
UpdateCall modifies an in-progress call.
type Config ¶
type Config struct {
AccountSID string
AuthToken string //nolint:gosec // G117: field intentionally stores credential
}
Config configures the Twilio client.
type MakeCallParams ¶
type MakeCallParams struct {
To string
From string
URL string // TwiML URL
Twiml string // Inline TwiML
StatusCallback string // Webhook for status updates
StatusCallbackEvent []string // Events to receive
MachineDetection string // "Enable" or "DetectMessageEnd"
Timeout int // Ring timeout in seconds
Record bool // Record the call
RecordingChannels string // "mono" or "dual"
CustomParameters map[string]string // Custom parameters (unused with SDK)
}
MakeCallParams are parameters for making a call.
type Message ¶
type Message struct {
SID string
AccountSID string
To string
From string
Body string
Status string
Direction string
DateSent string
}
Message represents an SMS/MMS message.
type PhoneNumber ¶
type PhoneNumber struct {
SID string
PhoneNumber string
FriendlyName string
VoiceCapable bool
SMSCapable bool
MMSCapable bool
}
PhoneNumber represents a Twilio phone number.
type SendSMSParams ¶
SendSMSParams are parameters for sending an SMS.
type UpdateCallParams ¶
type UpdateCallParams struct {
URL string // New TwiML URL
Twiml string // Inline TwiML
Status string // "completed" to hang up, "canceled" to cancel
}
UpdateCallParams are parameters for updating a call.