github.com/twilio/twilio-go@v1.20.1/rest/api/v2010/accounts_messages_feedback.go (about) 1 /* 2 * This code was generated by 3 * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 * 7 * Twilio - Api 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 "strings" 21 ) 22 23 // Optional parameters for the method 'CreateMessageFeedback' 24 type CreateMessageFeedbackParams struct { 25 // The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource for which to create MessageFeedback. 26 PathAccountSid *string `json:"PathAccountSid,omitempty"` 27 // 28 Outcome *string `json:"Outcome,omitempty"` 29 } 30 31 func (params *CreateMessageFeedbackParams) SetPathAccountSid(PathAccountSid string) *CreateMessageFeedbackParams { 32 params.PathAccountSid = &PathAccountSid 33 return params 34 } 35 func (params *CreateMessageFeedbackParams) SetOutcome(Outcome string) *CreateMessageFeedbackParams { 36 params.Outcome = &Outcome 37 return params 38 } 39 40 // Create Message Feedback to confirm a tracked user action was performed by the recipient of the associated Message 41 func (c *ApiService) CreateMessageFeedback(MessageSid string, params *CreateMessageFeedbackParams) (*ApiV2010MessageFeedback, error) { 42 path := "/2010-04-01/Accounts/{AccountSid}/Messages/{MessageSid}/Feedback.json" 43 if params != nil && params.PathAccountSid != nil { 44 path = strings.Replace(path, "{"+"AccountSid"+"}", *params.PathAccountSid, -1) 45 } else { 46 path = strings.Replace(path, "{"+"AccountSid"+"}", c.requestHandler.Client.AccountSid(), -1) 47 } 48 path = strings.Replace(path, "{"+"MessageSid"+"}", MessageSid, -1) 49 50 data := url.Values{} 51 headers := make(map[string]interface{}) 52 53 if params != nil && params.Outcome != nil { 54 data.Set("Outcome", *params.Outcome) 55 } 56 57 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 58 if err != nil { 59 return nil, err 60 } 61 62 defer resp.Body.Close() 63 64 ps := &ApiV2010MessageFeedback{} 65 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 66 return nil, err 67 } 68 69 return ps, err 70 }