diff --git a/calls.go b/calls.go index d12a38b..33970a3 100644 --- a/calls.go +++ b/calls.go @@ -120,6 +120,13 @@ type CallListParams struct { Offset int64 `json:"offset:omitempty" url:"offset:omitempty"` } +type LiveCallFilters struct { + 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"` + Status string `json:"status,omitempty" url:"status,omitempty" default:"live"` +} + type CallListResponse struct { ApiID string `json:"api_id" url:"api_id"` Meta *Meta `json:"meta" url:"meta"` @@ -254,10 +261,9 @@ func (service *LiveCallService) Get(LiveCallId string) (response *LiveCall, err return } -func (service *LiveCallService) IDList() (response *LiveCallIDListResponse, err error) { - req, err := service.client.NewRequest("GET", struct { - Status string `json:"status" url:"status"` - }{"live"}, "Call") +func (service *LiveCallService) IDList(params LiveCallFilters) (response *LiveCallIDListResponse, err error) { + params.Status = "live" + req, err := service.client.NewRequest("GET", params, "Call") if err != nil { return } diff --git a/calls_test.go b/calls_test.go index 6fb0511..e5bd6a8 100644 --- a/calls_test.go +++ b/calls_test.go @@ -109,13 +109,13 @@ func TestCallService_Delete(t *testing.T) { func TestLiveCallService_List(t *testing.T) { expectResponse("LiveCallListGetResponse.json", 200) - if _, err := client.LiveCalls.IDList(); err != nil { + if _, err := client.LiveCalls.IDList(LiveCallFilters{}); err != nil { panic(err) } cl := client.httpClient client.httpClient = nil - _, err := client.LiveCalls.IDList() + _, err := client.LiveCalls.IDList(LiveCallFilters{}) if err == nil { client.httpClient = cl panic(errors.New("error expected"))