func (c *ApiService) StreamComposition(params *ListCompositionParams) (chan VideoV1Composition, error) {
	if params == nil {
		params = &ListCompositionParams{}
	}
	params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit))
	response, err := c.PageComposition(params, "", "")
	if err != nil {
		return nil, err
	}
	curRecord := 0
	channel := make(chan VideoV1Composition, 1)
	go func() {
		for response != nil {
			for item := range response.Compositions {
				channel <- response.Compositions[item]
			}
			var record interface{}
			if record, err = client.GetNext(c.baseURL, response, &curRecord, params.Limit, c.getNextListCompositionResponse); record == nil || err != nil {
				close(channel)
				return
			}
			response = record.(*ListCompositionResponse)
		}
		close(channel)
	}()
	return channel, err
}
Streams Composition 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"
	"time"
	"github.com/twilio/twilio-go/client"
)
type CreateCompositionParams struct {
	AudioSources *[]string `json:"AudioSources,omitempty"`
	AudioSourcesExcluded *[]string `json:"AudioSourcesExcluded,omitempty"`
	Format *string `json:"Format,omitempty"`
	Resolution *string `json:"Resolution,omitempty"`
	RoomSid *string `json:"RoomSid,omitempty"`
	StatusCallback *string `json:"StatusCallback,omitempty"`
	StatusCallbackMethod *string `json:"StatusCallbackMethod,omitempty"`
	Trim *bool `json:"Trim,omitempty"`
	VideoLayout *map[string]interface{} `json:"VideoLayout,omitempty"`
}
func (params *CreateCompositionParams) SetAudioSources(AudioSources []string) *CreateCompositionParams {
	params.AudioSources = &AudioSources
	return params
}
func (params *CreateCompositionParams) SetAudioSourcesExcluded(AudioSourcesExcluded []string) *CreateCompositionParams {
	params.AudioSourcesExcluded = &AudioSourcesExcluded
	return params
}
func (params *CreateCompositionParams) SetFormat(Format string) *CreateCompositionParams {
	params.Format = &Format
	return params
}
func (params *CreateCompositionParams) SetResolution(Resolution string) *CreateCompositionParams {
	params.Resolution = &Resolution
	return params
}
func (params *CreateCompositionParams) SetRoomSid(RoomSid string) *CreateCompositionParams {
	params.RoomSid = &RoomSid
	return params
}
func (params *CreateCompositionParams) SetStatusCallback(StatusCallback string) *CreateCompositionParams {
	params.StatusCallback = &StatusCallback
	return params
}
func (params *CreateCompositionParams) SetStatusCallbackMethod(StatusCallbackMethod string) *CreateCompositionParams {
	params.StatusCallbackMethod = &StatusCallbackMethod
	return params
}
func (params *CreateCompositionParams) SetTrim(Trim bool) *CreateCompositionParams {
	params.Trim = &Trim
	return params
}
func (params *CreateCompositionParams) SetVideoLayout(VideoLayout map[string]interface{}) *CreateCompositionParams {
	params.VideoLayout = &VideoLayout
	return params
}
func (c *ApiService) CreateComposition(params *CreateCompositionParams) (*VideoV1Composition, error) {
	path := "/v1/Compositions"
	data := url.Values{}
	headers := make(map[string]interface{})
	if params != nil && params.AudioSources != nil {
		for _, item := range *params.AudioSources {
			data.Add("AudioSources", item)
		}
	}
	if params != nil && params.AudioSourcesExcluded != nil {
		for _, item := range *params.AudioSourcesExcluded {
			data.Add("AudioSourcesExcluded", item)
		}
	}
	if params != nil && params.Format != nil {
		data.Set("Format", *params.Format)
	}
	if params != nil && params.Resolution != nil {
		data.Set("Resolution", *params.Resolution)
	}
	if params != nil && params.RoomSid != nil {
		data.Set("RoomSid", *params.RoomSid)
	}
	if params != nil && params.StatusCallback != nil {
		data.Set("StatusCallback", *params.StatusCallback)
	}
	if params != nil && params.StatusCallbackMethod != nil {
		data.Set("StatusCallbackMethod", *params.StatusCallbackMethod)
	}
	if params != nil && params.Trim != nil {
		data.Set("Trim", fmt.Sprint(*params.Trim))
	}
	if params != nil && params.VideoLayout != nil {
		v, err := json.Marshal(params.VideoLayout)
		if err != nil {
			return nil, err
		}
		data.Set("VideoLayout", string(v))
	}
	resp, err := c.requestHandler.Post(c.baseURL+path, data, headers)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	ps := &VideoV1Composition{}
	if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
		return nil, err
	}
	return ps, err
}
func (c *ApiService) DeleteComposition(Sid string) error {
	path := "/v1/Compositions/{Sid}"
	path = strings.Replace(path, "{"+"Sid"+"}", Sid, -1)
	data := url.Values{}
	headers := make(map[string]interface{})
	resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers)
	if err != nil {
		return err
	}
	defer resp.Body.Close()
	return nil
}
func (c *ApiService) FetchComposition(Sid string) (*VideoV1Composition, error) {
	path := "/v1/Compositions/{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 := &VideoV1Composition{}
	if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
		return nil, err
	}
	return ps, err
}
type ListCompositionParams struct {
	Status *string `json:"Status,omitempty"`
	DateCreatedAfter *time.Time `json:"DateCreatedAfter,omitempty"`
	DateCreatedBefore *time.Time `json:"DateCreatedBefore,omitempty"`
	RoomSid *string `json:"RoomSid,omitempty"`
	PageSize *int `json:"PageSize,omitempty"`
	Limit *int `json:"limit,omitempty"`
}
func (params *ListCompositionParams) SetStatus(Status string) *ListCompositionParams {
	params.Status = &Status
	return params
}
func (params *ListCompositionParams) SetDateCreatedAfter(DateCreatedAfter time.Time) *ListCompositionParams {
	params.DateCreatedAfter = &DateCreatedAfter
	return params
}
func (params *ListCompositionParams) SetDateCreatedBefore(DateCreatedBefore time.Time) *ListCompositionParams {
	params.DateCreatedBefore = &DateCreatedBefore
	return params
}
func (params *ListCompositionParams) SetRoomSid(RoomSid string) *ListCompositionParams {
	params.RoomSid = &RoomSid
	return params
}
func (params *ListCompositionParams) SetPageSize(PageSize int) *ListCompositionParams {
	params.PageSize = &PageSize
	return params
}
func (params *ListCompositionParams) SetLimit(Limit int) *ListCompositionParams {
	params.Limit = &Limit
	return params
}
func (c *ApiService) PageComposition(params *ListCompositionParams, pageToken, pageNumber string) (*ListCompositionResponse, error) {
	path := "/v1/Compositions"
	data := url.Values{}
	headers := make(map[string]interface{})
	if params != nil && params.Status != nil {
		data.Set("Status", *params.Status)
	}
	if params != nil && params.DateCreatedAfter != nil {
		data.Set("DateCreatedAfter", fmt.Sprint((*params.DateCreatedAfter).Format(time.RFC3339)))
	}
	if params != nil && params.DateCreatedBefore != nil {
		data.Set("DateCreatedBefore", fmt.Sprint((*params.DateCreatedBefore).Format(time.RFC3339)))
	}
	if params != nil && params.RoomSid != nil {
		data.Set("RoomSid", *params.RoomSid)
	}
	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 := &ListCompositionResponse{}
	if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
		return nil, err
	}
	return ps, err
}
func (c *ApiService) ListComposition(params *ListCompositionParams) ([]VideoV1Composition, error) {
	if params == nil {
		params = &ListCompositionParams{}
	}
	params.SetPageSize(client.ReadLimits(params.PageSize, params.Limit))
	response, err := c.PageComposition(params, "", "")
	if err != nil {
		return nil, err
	}
	curRecord := 0
	var records []VideoV1Composition
	for response != nil {
		records = append(records, response.Compositions...)
		var record interface{}
		if record, err = client.GetNext(c.baseURL, response, &curRecord, params.Limit, c.getNextListCompositionResponse); record == nil || err != nil {
			return records, err
		}
		response = record.(*ListCompositionResponse)
	}
	return records, err
}