github.com/twilio/twilio-go@v1.20.1/rest/verify/v2/services_verification_check.go (about) 1 /* 2 * This code was generated by 3 * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 * 7 * Twilio - Verify 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 'CreateVerificationCheck' 24 type CreateVerificationCheckParams struct { 25 // The 4-10 character string being verified. 26 Code *string `json:"Code,omitempty"` 27 // The phone number or [email](https://www.twilio.com/docs/verify/email) to verify. Either this parameter or the `verification_sid` must be specified. Phone numbers must be in [E.164 format](https://www.twilio.com/docs/glossary/what-e164). 28 To *string `json:"To,omitempty"` 29 // A SID that uniquely identifies the Verification Check. Either this parameter or the `to` phone number/[email](https://www.twilio.com/docs/verify/email) must be specified. 30 VerificationSid *string `json:"VerificationSid,omitempty"` 31 // The amount of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. 32 Amount *string `json:"Amount,omitempty"` 33 // The payee of the associated PSD2 compliant transaction. Requires the PSD2 Service flag enabled. 34 Payee *string `json:"Payee,omitempty"` 35 } 36 37 func (params *CreateVerificationCheckParams) SetCode(Code string) *CreateVerificationCheckParams { 38 params.Code = &Code 39 return params 40 } 41 func (params *CreateVerificationCheckParams) SetTo(To string) *CreateVerificationCheckParams { 42 params.To = &To 43 return params 44 } 45 func (params *CreateVerificationCheckParams) SetVerificationSid(VerificationSid string) *CreateVerificationCheckParams { 46 params.VerificationSid = &VerificationSid 47 return params 48 } 49 func (params *CreateVerificationCheckParams) SetAmount(Amount string) *CreateVerificationCheckParams { 50 params.Amount = &Amount 51 return params 52 } 53 func (params *CreateVerificationCheckParams) SetPayee(Payee string) *CreateVerificationCheckParams { 54 params.Payee = &Payee 55 return params 56 } 57 58 // challenge a specific Verification Check. 59 func (c *ApiService) CreateVerificationCheck(ServiceSid string, params *CreateVerificationCheckParams) (*VerifyV2VerificationCheck, error) { 60 path := "/v2/Services/{ServiceSid}/VerificationCheck" 61 path = strings.Replace(path, "{"+"ServiceSid"+"}", ServiceSid, -1) 62 63 data := url.Values{} 64 headers := make(map[string]interface{}) 65 66 if params != nil && params.Code != nil { 67 data.Set("Code", *params.Code) 68 } 69 if params != nil && params.To != nil { 70 data.Set("To", *params.To) 71 } 72 if params != nil && params.VerificationSid != nil { 73 data.Set("VerificationSid", *params.VerificationSid) 74 } 75 if params != nil && params.Amount != nil { 76 data.Set("Amount", *params.Amount) 77 } 78 if params != nil && params.Payee != nil { 79 data.Set("Payee", *params.Payee) 80 } 81 82 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 83 if err != nil { 84 return nil, err 85 } 86 87 defer resp.Body.Close() 88 89 ps := &VerifyV2VerificationCheck{} 90 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 91 return nil, err 92 } 93 94 return ps, err 95 }