Skip to content

Commit

Permalink
fix: twilio-go pagination (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
shwetha-manvinkurke authored Aug 10, 2021
1 parent 916f5e0 commit fba6406
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/resources/twilio-go/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (c *ApiService) List{{{vendorExtensions.x-domain-name}}}({{#allParams}}{{#r
records = append(records, response.{{{vendorExtensions.x-payload-field-name}}}...)

var record interface{}
if record, err = client.GetNext(response, &curRecord, params.Limit, c.getNext{{{returnType}}}); record == nil || err != nil {
if record, err = client.GetNext(c.baseURL, response, &curRecord, params.Limit, c.getNext{{{returnType}}}); record == nil || err != nil {
return records, err
}

Expand Down Expand Up @@ -155,7 +155,7 @@ func (c *ApiService) Stream{{{vendorExtensions.x-domain-name}}}({{#allParams}}{{


var record interface{}
if record, err = client.GetNext(response, &curRecord, params.Limit, c.getNext{{{returnType}}}); record == nil || err != nil {
if record, err = client.GetNext(c.baseURL, response, &curRecord, params.Limit, c.getNext{{{returnType}}}); record == nil || err != nil {
close(channel)
return
}
Expand All @@ -168,11 +168,11 @@ func (c *ApiService) Stream{{{vendorExtensions.x-domain-name}}}({{#allParams}}{{
return channel, err
}

func (c *ApiService) getNext{{{returnType}}}(nextPageUri string) (interface{}, error) {
if nextPageUri == "" {
func (c *ApiService) getNext{{{returnType}}}(nextPageUrl string) (interface{}, error) {
if nextPageUrl == "" {
return nil, nil
}
resp, err := c.requestHandler.Get(c.baseURL+nextPageUri, nil, nil)
resp, err := c.requestHandler.Get(nextPageUrl, nil, nil)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit fba6406

Please sign in to comment.