Skip to content

Commit 25ba31c

Browse files
committed
Implement call flow listing functionality
1 parent a59c610 commit 25ba31c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

callflow.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ import (
66
"time"
77
)
88

9+
// CallFlowList is a single page from the total collection of call flows.
10+
type CallFlowList struct {
11+
Items []CallFlow `json:"data"`
12+
Pagination struct {
13+
TotalCount int `json:"totalCount"`
14+
PageCount int `json:"pageCount"`
15+
CurrentPage int `json:"currentPage"`
16+
PerPage int `json:"perPage"`
17+
} `json:"pagination"`
18+
}
19+
920
// A CallFlow describes the flow of operations (steps) to be executed when
1021
// handling an incoming call.
1122
type CallFlow struct {
@@ -106,6 +117,17 @@ func (c *Client) CallFlowByID(id string) (*CallFlow, error) {
106117
return callflow, err
107118
}
108119

120+
// CallFlows lists the callflows on the specified page.
121+
//
122+
// Page indices start at 1.
123+
//
124+
// Typically, a page contains 10 callflows.
125+
func (c *Client) CallFlows(page int) (*CallFlowList, error) {
126+
list := &CallFlowList{}
127+
err := c.request(list, "GET", fmt.Sprintf("call-flow/?page=%d", page), nil)
128+
return list, err
129+
}
130+
109131
// CreateCallFlow creates the specified callflow.
110132
//
111133
// The updated callflow is returned.

0 commit comments

Comments
 (0)