func (c *ApiService) StreamPolicies(params *ListPoliciesParams) (chan TrusthubV1Policies, error) {
	if params == nil {
		params = &ListPoliciesParams{}
	}
	params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit))
	response, err := c.PagePolicies(params, "", "")
	if err != nil {
		return nil, err
	}
	curRecord := 0
	channel := make(chan TrusthubV1Policies, 1)
	go func() {
		for response != nil {
			for item := range response.Results {
				channel <- response.Results[item]
			}
			var record interface{}
			if record, err = client.GetNext(c.baseURL, response, &curRecord, params.Limit, c.getNextListPoliciesResponse); record == nil || err != nil {
				close(channel)
				return
			}
			response = record.(*ListPoliciesResponse)
		}
		close(channel)
	}()
	return channel, err
}
Streams Policies records from the API as a channel stream. This operation lazily loads records as efficiently as possible until the limit is reached.
package openapi
import (
	"encoding/json"
	"fmt"
	"net/url"
	"strings"
	"github.com/twilio/twilio-go/client"
)
func (c *ApiService) FetchPolicies(Sid string) (*TrusthubV1Policies, error) {
	path := "/v1/Policies/{Sid}"
	path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1)
	data := url.Values{}
	headers := make(map[string]interface{})
	resp, err := c.requestHandler.Get(c.baseURL+path, data, headers)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	ps := &TrusthubV1Policies{}
	if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
		return nil, err
	}
	return ps, err
}
type ListPoliciesParams struct {
	PageSize *int `json:"PageSize,omitempty"`
	Limit *int `json:"limit,omitempty"`
}
func (params *ListPoliciesParams) SetPageSize(PageSize int) *ListPoliciesParams {
	params.PageSize = &PageSize
	return params
}
func (params *ListPoliciesParams) SetLimit(Limit int) *ListPoliciesParams {
	params.Limit = &Limit
	return params
}
func (c *ApiService) PagePolicies(params *ListPoliciesParams, pageToken, pageNumber string) (*ListPoliciesResponse, error) {
	path := "/v1/Policies"
	data := url.Values{}
	headers := make(map[string]interface{})
	if params != nil && params.PageSize != nil {
		data.Set("PageSize", fmt.Sprint(*params.PageSize))
	}
	if pageToken != "" {
		data.Set("PageToken", pageToken)
	}
	if pageNumber != "" {
		data.Set("Page", pageNumber)
	}
	resp, err := c.requestHandler.Get(c.baseURL+path, data, headers)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	ps := &ListPoliciesResponse{}
	if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
		return nil, err
	}
	return ps, err
}
func (c *ApiService) ListPolicies(params *ListPoliciesParams) ([]TrusthubV1Policies, error) {
	if params == nil {
		params = &ListPoliciesParams{}
	}
	params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit))
	response, err := c.PagePolicies(params, "", "")
	if err != nil {
		return nil, err
	}
	curRecord := 0
	var records []TrusthubV1Policies
	for response != nil {
		records = append(records, response.Results...)
		var record interface{}
		if record, err = client.GetNext(c.baseURL, response, &curRecord, params.Limit, c.getNextListPoliciesResponse); record == nil || err != nil {
			return records, err
		}
		response = record.(*ListPoliciesResponse)
	}
	return records, err
}