From 852e4a711b727d3b5d532ed2d9a7a276cebf704b Mon Sep 17 00:00:00 2001 From: Shwetha Radhakrishna Date: Sat, 7 Aug 2021 17:39:06 -0500 Subject: [PATCH] fix: twilio-go pagination --- src/main/resources/twilio-go/api.mustache | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/resources/twilio-go/api.mustache b/src/main/resources/twilio-go/api.mustache index 4772accad..e539aed55 100644 --- a/src/main/resources/twilio-go/api.mustache +++ b/src/main/resources/twilio-go/api.mustache @@ -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 } @@ -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 } @@ -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 }