// Create a new Subscription.
Create a new Subscription.
// Create a new Subscription .
func (c *DefaultApiService) CreateSubscription(params *CreateSubscriptionParams) (*EventsV1Subscription, error) {
	path := "/v1/Subscriptions"
	data := url.Values{}
	headers := make(map[string]interface{})
	if params != nil && params.Description != nil {
		data.Set("Description", *params.Description)
	}
	if params != nil && params.SinkSid != nil {
		data.Set("SinkSid", *params.SinkSid)
	}
	if params != nil && params.Types != nil {
		v, err := json.Marshal(params.Types)
		if err != nil {
			return nil, err
		}
		data.Set("Types", string(v))
	}
	resp, err := c.requestHandler.Post(c.baseURL+path, data, headers)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	ps := &EventsV1Subscription{}
	if err := json.NewDecoder(resp.Body).Decode(ps); err != nil {
		return nil, err
	}
	return ps, err
}
func ( c * DefaultApiService ) CreateSubscription ( params * CreateSubscriptionParams ) ( * EventsV1Subscription , error ) { path := " " data := url . Values { } headers := make ( map [ string ] interface { } ) if params != nil && params . Description != nil { data . Set ( " " , * params . Description ) } if params != nil && params . SinkSid != nil { data . Set ( " " , * params . SinkSid ) } if params != nil && params . Types != nil { v , err := json . Marshal ( params . Types ) if err != nil { return nil , err } data . Set ( " " , string ( v ) ) } resp , err := c . requestHandler . Post ( c . baseURL + path , data , headers ) if err != nil { return nil , err } defer resp . Body . Close ( ) ps := & EventsV1Subscription { } if err := json . NewDecoder ( resp . Body ) . Decode ( ps ) ; err != nil { return nil , err } return ps , err }
Create a new Subscription.
Create a new Subscription .