Skip to content

Commit

Permalink
Merge branch 'master' into sdk_sms_optional_field
Browse files Browse the repository at this point in the history
  • Loading branch information
narayana-plivo authored Sep 24, 2018
2 parents 5a376e0 + 1b6eded commit 1d7bcd6
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 37 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ go:
- 1.1.x
# - 1.2.x There is a known Timeout error in http.Client. Skipping builds.
# - 1.3.x There is an error in Travis env while using logrus for testing.
- 1.4.x
- 1.5.x
- 1.6.x
# - 1.4.x
# - 1.5.x
# - 1.6.x
- 1.7.x
- 1.8.x
- 1.9.x
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

## [4.0.2](https://github.com/plivo/plivo-go/tree/v4.0.2) (2018-09-18)
- Added parent_call_uuid parameter to filter calls.
- Queued status added for filtering calls in queued status.
- Added log_incoming_messages parameter to application create and update.
- Added powerpack support.

## [4.0.1](https://github.com/plivo/plivo-go/tree/v4.0.1) (2018-07-25)
- Fixed caller id retrieval

Expand Down
58 changes: 30 additions & 28 deletions applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ type ApplicationService struct {
}

type Application struct {
FallbackMethod string `json:"fallback_method,omitempty" url:"fallback_method,omitempty"`
DefaultApp bool `json:"default_app,omitempty" url:"default_app,omitempty"`
AppName string `json:"app_name,omitempty" url:"app_name,omitempty"`
ProductionApp bool `json:"production_app,omitempty" url:"production_app,omitempty"`
AppID string `json:"app_id,omitempty" url:"app_id,omitempty"`
HangupURL string `json:"hangup_url,omitempty" url:"hangup_url,omitempty"`
AnswerURL string `json:"answer_url,omitempty" url:"answer_url,omitempty"`
MessageURL string `json:"message_url,omitempty" url:"message_url,omitempty"`
ResourceURI string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
HangupMethod string `json:"hangup_method,omitempty" url:"hangup_method,omitempty"`
MessageMethod string `json:"message_method,omitempty" url:"message_method,omitempty"`
FallbackAnswerURL string `json:"fallback_answer_url,omitempty" url:"fallback_answer_url,omitempty"`
AnswerMethod string `json:"answer_method,omitempty" url:"answer_method,omitempty"`
ApiID string `json:"api_id,omitempty" url:"api_id,omitempty"`
FallbackMethod string `json:"fallback_method,omitempty" url:"fallback_method,omitempty"`
DefaultApp bool `json:"default_app,omitempty" url:"default_app,omitempty"`
AppName string `json:"app_name,omitempty" url:"app_name,omitempty"`
ProductionApp bool `json:"production_app,omitempty" url:"production_app,omitempty"`
AppID string `json:"app_id,omitempty" url:"app_id,omitempty"`
HangupURL string `json:"hangup_url,omitempty" url:"hangup_url,omitempty"`
AnswerURL string `json:"answer_url,omitempty" url:"answer_url,omitempty"`
MessageURL string `json:"message_url,omitempty" url:"message_url,omitempty"`
ResourceURI string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
HangupMethod string `json:"hangup_method,omitempty" url:"hangup_method,omitempty"`
MessageMethod string `json:"message_method,omitempty" url:"message_method,omitempty"`
FallbackAnswerURL string `json:"fallback_answer_url,omitempty" url:"fallback_answer_url,omitempty"`
AnswerMethod string `json:"answer_method,omitempty" url:"answer_method,omitempty"`
ApiID string `json:"api_id,omitempty" url:"api_id,omitempty"`
LogIncomingMessages bool `json:"log_incoming_messages,omitempty" url:"log_incoming_messages,omitempty"`

// Additional fields for Modify calls
DefaultNumberApp bool `json:"default_number_app,omitempty" url:"default_number_app,omitempty"`
Expand All @@ -27,20 +28,21 @@ type Application struct {

//TODO Verify against docs
type ApplicationCreateParams struct {
FallbackMethod string `json:"fallback_method,omitempty" url:"fallback_method,omitempty"`
DefaultApp bool `json:"default_app,omitempty" url:"default_app,omitempty"`
AppName string `json:"app_name,omitempty" url:"app_name,omitempty"`
ProductionApp bool `json:"production_app,omitempty" url:"production_app,omitempty"`
AppID string `json:"app_id,omitempty" url:"app_id,omitempty"`
HangupURL string `json:"hangup_url,omitempty" url:"hangup_url,omitempty"`
AnswerURL string `json:"answer_url,omitempty" url:"answer_url,omitempty"`
MessageURL string `json:"message_url,omitempty" url:"message_url,omitempty"`
ResourceURI string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
HangupMethod string `json:"hangup_method,omitempty" url:"hangup_method,omitempty"`
MessageMethod string `json:"message_method,omitempty" url:"message_method,omitempty"`
FallbackAnswerURL string `json:"fallback_answer_url,omitempty" url:"fallback_answer_url,omitempty"`
AnswerMethod string `json:"answer_method,omitempty" url:"answer_method,omitempty"`
ApiID string `json:"api_id,omitempty" url:"api_id,omitempty"`
FallbackMethod string `json:"fallback_method,omitempty" url:"fallback_method,omitempty"`
DefaultApp bool `json:"default_app,omitempty" url:"default_app,omitempty"`
AppName string `json:"app_name,omitempty" url:"app_name,omitempty"`
ProductionApp bool `json:"production_app,omitempty" url:"production_app,omitempty"`
AppID string `json:"app_id,omitempty" url:"app_id,omitempty"`
HangupURL string `json:"hangup_url,omitempty" url:"hangup_url,omitempty"`
AnswerURL string `json:"answer_url,omitempty" url:"answer_url,omitempty"`
MessageURL string `json:"message_url,omitempty" url:"message_url,omitempty"`
ResourceURI string `json:"resource_uri,omitempty" url:"resource_uri,omitempty"`
HangupMethod string `json:"hangup_method,omitempty" url:"hangup_method,omitempty"`
MessageMethod string `json:"message_method,omitempty" url:"message_method,omitempty"`
FallbackAnswerURL string `json:"fallback_answer_url,omitempty" url:"fallback_answer_url,omitempty"`
AnswerMethod string `json:"answer_method,omitempty" url:"answer_method,omitempty"`
ApiID string `json:"api_id,omitempty" url:"api_id,omitempty"`
LogIncomingMessages bool `json:"log_incoming_messages,omitempty" url:"log_incoming_messages,omitempty"`

// Additional fields for Modify calls
DefaultNumberApp bool `json:"default_number_app,omitempty" url:"default_number_app,omitempty"`
Expand Down
56 changes: 51 additions & 5 deletions calls.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ type LiveCallService struct {
client *Client
}

type QueuedCallService struct {
client *Client
}

type Call struct {
FromNumber string `json:"from_number,omitempty" url:"from_number,omitempty"`
ToNumber string `json:"to_number,omitempty" url:"to_number,omitempty"`
Expand All @@ -32,11 +36,28 @@ type LiveCall struct {
SessionStart string `json:"session_start,omitempty" url:"session_start,omitempty"`
}

type QueuedCall struct {
From string `json:"from,omitempty" url:"from,omitempty"`
To string `json:"to,omitempty" url:"to,omitempty"`
Status string `json:"call_status,omitempty" url:"call_status,omitempty"`
CallUUID string `json:"call_uuid,omitempty" url:"call_uuid,omitempty"`
CallerName string `json:"caller_name,omitempty" url:"caller_name,omitempty"`
APIID string `json:"api_id,omitempty" url:"api_id,omitempty"`
Direction string `json:"direction,omitempty" url:"direction,omitempty"`
RequestUUID string `json:"request_uuid,omitempty" url:"request_uuid,omitempty"`
}

type LiveCallIDListResponse struct {
APIID string `json:"api_id" url:"api_id"`
Calls []string `json:"calls" url:"calls"`
}

type QueuedCallIDListResponse struct {
APIID string `json:"api_id" url:"api_id"`
Calls []string `json:"calls" url:"calls"`
}


type CallCreateParams struct {
// Required parameters.
From string `json:"from,omitempty" url:"from,omitempty"`
Expand Down Expand Up @@ -71,11 +92,12 @@ type CallCreateResponse struct {

type CallListParams struct {
// Query parameters.
Subaccount string `json:"subaccount,omitempty" url:"subaccount,omitempty"`
CallDirection string `json:"call_direction,omitempty" url:"call_direction,omitempty"`
FromNumber string `json:"from_number,omitempty" url:"from_number,omitempty"`
ToNumber string `json:"to_number,omitempty" url:"to_number,omitempty"`
EndTimeEquals string `json:"end_time,omitempty" url:"end_time,omitempty"`
Subaccount string `json:"subaccount,omitempty" url:"subaccount,omitempty"`
CallDirection string `json:"call_direction,omitempty" url:"call_direction,omitempty"`
FromNumber string `json:"from_number,omitempty" url:"from_number,omitempty"`
ToNumber string `json:"to_number,omitempty" url:"to_number,omitempty"`
ParentCallUUID string `json:"parent_call_uuid,omitempty" url:"parent_call_uuid,omitempty"`
EndTimeEquals string `json:"end_time,omitempty" url:"end_time,omitempty"`

EndTimeLessThan string `json:"end_time__lt,omitempty" url:"end_time__lt,omitempty"`

Expand Down Expand Up @@ -244,6 +266,30 @@ func (service *LiveCallService) IDList() (response *LiveCallIDListResponse, err
return
}

func (service *QueuedCallService) IDList() (response *QueuedCallIDListResponse, err error) {
req, err := service.client.NewRequest("GET", struct {
Status string `json:"status" url:"status"`
}{"queued"}, "Call")
if err != nil {
return
}
response = &QueuedCallIDListResponse{}
err = service.client.ExecuteRequest(req, response)
return
}

func (service *QueuedCallService) Get(QueuedCallId string) (response *QueuedCall, err error) {
req, err := service.client.NewRequest("GET", struct {
Status string `json:"status" url:"status"`
}{"queued"}, "Call/%s", QueuedCallId)
if err != nil {
return
}
response = &QueuedCall{}
err = service.client.ExecuteRequest(req, response)
return
}

func (service *CallService) Record(callId string, params CallRecordParams) (response *CallRecordResponse, err error) {
req, err := service.client.NewRequest("POST", params, "Call/%s/Record", callId)
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ type MessageCreateParams struct {
Method string `json:"method,omitempty" url:"method,omitempty"`
Trackable bool `json:"trackable,omitempty" url:"trackable,omitempty"`
Log bool `json:"log,omitempty" url:"log,omitempty"`
// Either one of src and powerpackuuid should be given
PowerpackUUID string `json:"powerpack_uuid,omitempty" url:"powerpack_uuid,omitempty"`
}

type Message struct {
Expand Down
4 changes: 3 additions & 1 deletion plivoclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (

const baseUrlString = "https://api.plivo.com/"

const sdkVersion = "4.0.1"
const sdkVersion = "4.0.2"

type Client struct {
httpClient *http.Client
Expand All @@ -39,6 +39,7 @@ type Client struct {
Recordings *RecordingService
Calls *CallService
LiveCalls *LiveCallService
QueuedCalls *QueuedCallService
Conferences *ConferenceService

RequestInterceptor func(request *http.Request)
Expand Down Expand Up @@ -104,6 +105,7 @@ func NewClient(authId, authToken string, options *ClientOptions) (client *Client
client.Recordings = &RecordingService{client: client}
client.Calls = &CallService{client: client}
client.LiveCalls = &LiveCallService{client: client}
client.QueuedCalls = &QueuedCallService{client: client}
client.Conferences = &ConferenceService{client: client}

return
Expand Down

0 comments on commit 1d7bcd6

Please sign in to comment.