Skip to content

Commit

Permalink
expanding lines & properties (MyPureCloud#1180)
Browse files Browse the repository at this point in the history
  • Loading branch information
kavinbalagen authored Jul 23, 2024
1 parent adcbc8a commit 8fe98c4
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ func getAllPhonesFn(ctx context.Context, p *phoneProxy) (*[]platformclientv2.Pho
var allPhones []platformclientv2.Phone
const pageSize = 100
const sortBy = "id"
expand := []string{"lines", "properties"}

phones, response, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(1, pageSize, sortBy, "", "", "", "", "", "", "", "", "", "", "", "", nil, nil)
phones, response, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(1, pageSize, sortBy, "", "", "", "", "", "", "", "", "", "", "", "", expand, nil)
if err != nil || (response != nil && response.StatusCode != http.StatusOK) {
log.Printf("getAllPhonesFn:: error encountered while trying to get first page of phone data #%v statusCode: %d", err, response.StatusCode)
return nil, response, err
Expand All @@ -194,7 +195,7 @@ func getAllPhonesFn(ctx context.Context, p *phoneProxy) (*[]platformclientv2.Pho
}

for pageNum := 2; pageNum <= *phones.PageCount; pageNum++ {
phones, response, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(pageNum, pageSize, sortBy, "", "", "", "", "", "", "", "", "", "", "", "", nil, nil)
phones, response, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(pageNum, pageSize, sortBy, "", "", "", "", "", "", "", "", "", "", "", "", expand, nil)
if err != nil || (response != nil && response.StatusCode != http.StatusOK) {
return nil, response, err
}
Expand Down Expand Up @@ -245,7 +246,8 @@ func getPhoneByIdFn(ctx context.Context, p *phoneProxy, phoneId string) (*platfo
// getPhoneByNameFn is an implementation function for retrieving a Genesys Cloud Phone by name
func getPhoneByNameFn(ctx context.Context, p *phoneProxy, phoneName string) (phone *platformclientv2.Phone, retryable bool, resp *platformclientv2.APIResponse, err error) {
const pageSize = 100
phones, resp, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(1, pageSize, "", "", "", "", "", "", "", "", "", "", phoneName, "", "", nil, nil)
expand := []string{"lines", "properties"}
phones, resp, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(1, pageSize, "", "", "", "", "", "", "", "", "", "", phoneName, "", "", expand, nil)
if err != nil {
return nil, false, resp, err
}
Expand All @@ -260,7 +262,7 @@ func getPhoneByNameFn(ctx context.Context, p *phoneProxy, phoneName string) (pho
}

for pageNum := 2; pageNum <= *phones.PageCount; pageNum++ {
phones, resp, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(pageNum, pageSize, "", "", "", "", "", "", "", "", "", "", phoneName, "", "", nil, nil)
phones, resp, err := p.edgesApi.GetTelephonyProvidersEdgesPhones(pageNum, pageSize, "", "", "", "", "", "", "", "", "", "", phoneName, "", "", expand, nil)
if err != nil {
return nil, false, resp, err
}
Expand Down

0 comments on commit 8fe98c4

Please sign in to comment.