func (c *ApiService) StreamAvailablePhoneNumberMachineToMachine(CountryCode string, params *ListAvailablePhoneNumberMachineToMachineParams) (chan ApiV2010AvailablePhoneNumberMachineToMachine, error) {
	if params == nil {
		params = &ListAvailablePhoneNumberMachineToMachineParams{}
	}
	params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit))
	response, err := c.PageAvailablePhoneNumberMachineToMachine(CountryCode, params, "", "")
	if err != nil {
		return nil, err
	}
	curRecord := 0
	channel := make(chan ApiV2010AvailablePhoneNumberMachineToMachine, 1)
	go func() {
		for response != nil {
			for item := range response.AvailablePhoneNumbers {
				channel <- response.AvailablePhoneNumbers[item]
			}
			var record interface{}
			if record, err = client.GetNext(c.baseURL, response, &curRecord, params.Limit, c.getNextListAvailablePhoneNumberMachineToMachineResponse); record == nil || err != nil {
				close(channel)
				return
			}
			response = record.(*ListAvailablePhoneNumberMachineToMachineResponse)
		}
		close(channel)
	}()
	return channel, err
}
Streams AvailablePhoneNumberMachineToMachine 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"
)
type ListAvailablePhoneNumberMachineToMachineParams struct {
	PathAccountSid *string `json:"PathAccountSid,omitempty"`
	AreaCode *int `json:"AreaCode,omitempty"`
	Contains *string `json:"Contains,omitempty"`
	SmsEnabled *bool `json:"SmsEnabled,omitempty"`
	MmsEnabled *bool `json:"MmsEnabled,omitempty"`
	VoiceEnabled *bool `json:"VoiceEnabled,omitempty"`
	ExcludeAllAddressRequired *bool `json:"ExcludeAllAddressRequired,omitempty"`
	ExcludeLocalAddressRequired *bool `json:"ExcludeLocalAddressRequired,omitempty"`
	ExcludeForeignAddressRequired *bool `json:"ExcludeForeignAddressRequired,omitempty"`
	Beta *bool `json:"Beta,omitempty"`
	NearNumber *string `json:"NearNumber,omitempty"`
	NearLatLong *string `json:"NearLatLong,omitempty"`
	Distance *int `json:"Distance,omitempty"`
	InPostalCode *string `json:"InPostalCode,omitempty"`
	InRegion *string `json:"InRegion,omitempty"`
	InRateCenter *string `json:"InRateCenter,omitempty"`
	InLata *string `json:"InLata,omitempty"`
	InLocality *string `json:"InLocality,omitempty"`
	FaxEnabled *bool `json:"FaxEnabled,omitempty"`
	PageSize *int `json:"PageSize,omitempty"`
	Limit *int `json:"limit,omitempty"`
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetPathAccountSid(PathAccountSid string) *ListAvailablePhoneNumberMachineToMachineParams {
	params.PathAccountSid = &PathAccountSid
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetAreaCode(AreaCode int) *ListAvailablePhoneNumberMachineToMachineParams {
	params.AreaCode = &AreaCode
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetContains(Contains string) *ListAvailablePhoneNumberMachineToMachineParams {
	params.Contains = &Contains
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetSmsEnabled(SmsEnabled bool) *ListAvailablePhoneNumberMachineToMachineParams {
	params.SmsEnabled = &SmsEnabled
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetMmsEnabled(MmsEnabled bool) *ListAvailablePhoneNumberMachineToMachineParams {
	params.MmsEnabled = &MmsEnabled
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetVoiceEnabled(VoiceEnabled bool) *ListAvailablePhoneNumberMachineToMachineParams {
	params.VoiceEnabled = &VoiceEnabled
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetExcludeAllAddressRequired(ExcludeAllAddressRequired bool) *ListAvailablePhoneNumberMachineToMachineParams {
	params.ExcludeAllAddressRequired = &ExcludeAllAddressRequired
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetExcludeLocalAddressRequired(ExcludeLocalAddressRequired bool) *ListAvailablePhoneNumberMachineToMachineParams {
	params.ExcludeLocalAddressRequired = &ExcludeLocalAddressRequired
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetExcludeForeignAddressRequired(ExcludeForeignAddressRequired bool) *ListAvailablePhoneNumberMachineToMachineParams {
	params.ExcludeForeignAddressRequired = &ExcludeForeignAddressRequired
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetBeta(Beta bool) *ListAvailablePhoneNumberMachineToMachineParams {
	params.Beta = &Beta
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetNearNumber(NearNumber string) *ListAvailablePhoneNumberMachineToMachineParams {
	params.NearNumber = &NearNumber
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetNearLatLong(NearLatLong string) *ListAvailablePhoneNumberMachineToMachineParams {
	params.NearLatLong = &NearLatLong
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetDistance(Distance int) *ListAvailablePhoneNumberMachineToMachineParams {
	params.Distance = &Distance
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInPostalCode(InPostalCode string) *ListAvailablePhoneNumberMachineToMachineParams {
	params.InPostalCode = &InPostalCode
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInRegion(InRegion string) *ListAvailablePhoneNumberMachineToMachineParams {
	params.InRegion = &InRegion
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInRateCenter(InRateCenter string) *ListAvailablePhoneNumberMachineToMachineParams {
	params.InRateCenter = &InRateCenter
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInLata(InLata string) *ListAvailablePhoneNumberMachineToMachineParams {
	params.InLata = &InLata
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetInLocality(InLocality string) *ListAvailablePhoneNumberMachineToMachineParams {
	params.InLocality = &InLocality
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetFaxEnabled(FaxEnabled bool) *ListAvailablePhoneNumberMachineToMachineParams {
	params.FaxEnabled = &FaxEnabled
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetPageSize(PageSize int) *ListAvailablePhoneNumberMachineToMachineParams {
	params.PageSize = &PageSize
	return params
}
func (params *ListAvailablePhoneNumberMachineToMachineParams) SetLimit(Limit int) *ListAvailablePhoneNumberMachineToMachineParams {
	params.Limit = &Limit
	return params
}
func (c *ApiService) PageAvailablePhoneNumberMachineToMachine(CountryCode string, params *ListAvailablePhoneNumberMachineToMachineParams, pageToken, pageNumber string) (*ListAvailablePhoneNumberMachineToMachineResponse, error) {
	path := "/2010-04-01/Accounts/{AccountSid}/AvailablePhoneNumbers/{CountryCode}/MachineToMachine.json"
	if params != nil && params.PathAccountSid != nil {
		path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1)
	} else {
		path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1)
	}
	path = strings.Replace(path, "{"+"CountryCode"+"}", CountryCode, -1)
	data := url.Values{}
	headers := make(map[string]interface{})
	if params != nil && params.AreaCode != nil {
		data.Set("AreaCode", fmt.Sprint(*params.AreaCode))
	}
	if params != nil && params.Contains != nil {
		data.Set("Contains", *params.Contains)
	}
	if params != nil && params.SmsEnabled != nil {
		data.Set("SmsEnabled", fmt.Sprint(*params.SmsEnabled))
	}
	if params != nil && params.MmsEnabled != nil {
		data.Set("MmsEnabled", fmt.Sprint(*params.MmsEnabled))
	}
	if params != nil && params.VoiceEnabled != nil {
		data.Set("VoiceEnabled", fmt.Sprint(*params.VoiceEnabled))
	}
	if params != nil && params.ExcludeAllAddressRequired != nil {
		data.Set("ExcludeAllAddressRequired", fmt.Sprint(*params.ExcludeAllAddressRequired))
	}
	if params != nil && params.ExcludeLocalAddressRequired != nil {
		data.Set("ExcludeLocalAddressRequired", fmt.Sprint(*params.ExcludeLocalAddressRequired))
	}
	if params != nil && params.ExcludeForeignAddressRequired != nil {
		data.Set("ExcludeForeignAddressRequired", fmt.Sprint(*params.ExcludeForeignAddressRequired))
	}
	if params != nil && params.Beta != nil {
		data.Set("Beta", fmt.Sprint(*params.Beta))
	}
	if params != nil && params.NearNumber != nil {
		data.Set("NearNumber", *params.NearNumber)
	}
	if params != nil && params.NearLatLong != nil {
		data.Set("NearLatLong", *params.NearLatLong)
	}
	if params != nil && params.Distance != nil {
		data.Set("Distance", fmt.Sprint(*params.Distance))
	}
	if params != nil && params.InPostalCode != nil {
		data.Set("InPostalCode", *params.InPostalCode)
	}
	if params != nil && params.InRegion != nil {
		data.Set("InRegion", *params.InRegion)
	}
	if params != nil && params.InRateCenter != nil {
		data.Set("InRateCenter", *params.InRateCenter)
	}
	if params != nil && params.InLata != nil {
		data.Set("InLata", *params.InLata)
	}
	if params != nil && params.InLocality != nil {
		data.Set("InLocality", *params.InLocality)
	}
	if params != nil && params.FaxEnabled != nil {
		data.Set("FaxEnabled", fmt.Sprint(*params.FaxEnabled))
	}
	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 := &ListAvailablePhoneNumberMachineToMachineResponse{}
	if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
		return nil, err
	}
	return ps, err
}
func (c *ApiService) ListAvailablePhoneNumberMachineToMachine(CountryCode string, params *ListAvailablePhoneNumberMachineToMachineParams) ([]ApiV2010AvailablePhoneNumberMachineToMachine, error) {
	if params == nil {
		params = &ListAvailablePhoneNumberMachineToMachineParams{}
	}
	params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit))
	response, err := c.PageAvailablePhoneNumberMachineToMachine(CountryCode, params, "", "")
	if err != nil {
		return nil, err
	}
	curRecord := 0
	var records []ApiV2010AvailablePhoneNumberMachineToMachine
	for response != nil {
		records = append(records, response.AvailablePhoneNumbers...)
		var record interface{}
		if record, err = client.GetNext(c.baseURL, response, &curRecord, params.Limit, c.getNextListAvailablePhoneNumberMachineToMachineResponse); record == nil || err != nil {
			return records, err
		}
		response = record.(*ListAvailablePhoneNumberMachineToMachineResponse)
	}
	return records, err
}