github.com/twilio/twilio-go@v1.20.1/rest/messaging/v1/link_shortening_domains_certificate.go (about) 1 /* 2 * This code was generated by 3 * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 * 7 * Twilio - Messaging 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 // 24 func (c *ApiService) DeleteDomainCertV4(DomainSid string) error { 25 path := "/v1/LinkShortening/Domains/{DomainSid}/Certificate" 26 path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) 27 28 data := url.Values{} 29 headers := make(map[string]interface{}) 30 31 resp, err := c.requestHandler.Delete(c.baseURL+path, data, headers) 32 if err != nil { 33 return err 34 } 35 36 defer resp.Body.Close() 37 38 return nil 39 } 40 41 // 42 func (c *ApiService) FetchDomainCertV4(DomainSid string) (*MessagingV1DomainCertV4, error) { 43 path := "/v1/LinkShortening/Domains/{DomainSid}/Certificate" 44 path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) 45 46 data := url.Values{} 47 headers := make(map[string]interface{}) 48 49 resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) 50 if err != nil { 51 return nil, err 52 } 53 54 defer resp.Body.Close() 55 56 ps := &MessagingV1DomainCertV4{} 57 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 58 return nil, err 59 } 60 61 return ps, err 62 } 63 64 // Optional parameters for the method 'UpdateDomainCertV4' 65 type UpdateDomainCertV4Params struct { 66 // Contains the full TLS certificate and private for this domain in PEM format: https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail. Twilio uses this information to process HTTPS traffic sent to your domain. 67 TlsCert *string `json:"TlsCert,omitempty"` 68 } 69 70 func (params *UpdateDomainCertV4Params) SetTlsCert(TlsCert string) *UpdateDomainCertV4Params { 71 params.TlsCert = &TlsCert 72 return params 73 } 74 75 // 76 func (c *ApiService) UpdateDomainCertV4(DomainSid string, params *UpdateDomainCertV4Params) (*MessagingV1DomainCertV4, error) { 77 path := "/v1/LinkShortening/Domains/{DomainSid}/Certificate" 78 path = strings.Replace(path, "{"+"DomainSid"+"}", DomainSid, -1) 79 80 data := url.Values{} 81 headers := make(map[string]interface{}) 82 83 if params != nil && params.TlsCert != nil { 84 data.Set("TlsCert", *params.TlsCert) 85 } 86 87 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 88 if err != nil { 89 return nil, err 90 } 91 92 defer resp.Body.Close() 93 94 ps := &MessagingV1DomainCertV4{} 95 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 96 return nil, err 97 } 98 99 return ps, err 100 }