github.com/twilio/twilio-go@v1.20.1/rest/studio/v2/flows_validate.go (about) 1 /* 2 * This code was generated by 3 * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 * 7 * Twilio - Studio 8 * This is the public Twilio REST API. 9 * 10 * NOTE: This class is auto generated by OpenAPI Generator. 11 * https://openapi-generator.tech 12 * Do not edit the class manually. 13 */ 14 15 package openapi 16 17 import ( 18 "encoding/json" 19 "net/url" 20 ) 21 22 // Optional parameters for the method 'UpdateFlowValidate' 23 type UpdateFlowValidateParams struct { 24 // The string that you assigned to describe the Flow. 25 FriendlyName *string `json:"FriendlyName,omitempty"` 26 // 27 Status *string `json:"Status,omitempty"` 28 // JSON representation of flow definition. 29 Definition *interface{} `json:"Definition,omitempty"` 30 // Description of change made in the revision. 31 CommitMessage *string `json:"CommitMessage,omitempty"` 32 } 33 34 func (params *UpdateFlowValidateParams) SetFriendlyName(FriendlyName string) *UpdateFlowValidateParams { 35 params.FriendlyName = &FriendlyName 36 return params 37 } 38 func (params *UpdateFlowValidateParams) SetStatus(Status string) *UpdateFlowValidateParams { 39 params.Status = &Status 40 return params 41 } 42 func (params *UpdateFlowValidateParams) SetDefinition(Definition interface{}) *UpdateFlowValidateParams { 43 params.Definition = &Definition 44 return params 45 } 46 func (params *UpdateFlowValidateParams) SetCommitMessage(CommitMessage string) *UpdateFlowValidateParams { 47 params.CommitMessage = &CommitMessage 48 return params 49 } 50 51 // Validate flow JSON definition 52 func (c *ApiService) UpdateFlowValidate(params *UpdateFlowValidateParams) (*StudioV2FlowValidate, error) { 53 path := "/v2/Flows/Validate" 54 55 data := url.Values{} 56 headers := make(map[string]interface{}) 57 58 if params != nil && params.FriendlyName != nil { 59 data.Set("FriendlyName", *params.FriendlyName) 60 } 61 if params != nil && params.Status != nil { 62 data.Set("Status", *params.Status) 63 } 64 if params != nil && params.Definition != nil { 65 v, err := json.Marshal(params.Definition) 66 67 if err != nil { 68 return nil, err 69 } 70 71 data.Set("Definition", string(v)) 72 } 73 if params != nil && params.CommitMessage != nil { 74 data.Set("CommitMessage", *params.CommitMessage) 75 } 76 77 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 78 if err != nil { 79 return nil, err 80 } 81 82 defer resp.Body.Close() 83 84 ps := &StudioV2FlowValidate{} 85 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 86 return nil, err 87 } 88 89 return ps, err 90 }