github.com/twilio/twilio-go@v1.20.1/rest/messaging/v1/deactivations.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 "fmt" 20 "net/url" 21 ) 22 23 // Optional parameters for the method 'FetchDeactivation' 24 type FetchDeactivationParams struct { 25 // The request will return a list of all United States Phone Numbers that were deactivated on the day specified by this parameter. This date should be specified in YYYY-MM-DD format. 26 Date *string `json:"Date,omitempty"` 27 } 28 29 func (params *FetchDeactivationParams) SetDate(Date string) *FetchDeactivationParams { 30 params.Date = &Date 31 return params 32 } 33 34 // Fetch a list of all United States numbers that have been deactivated on a specific date. 35 func (c *ApiService) FetchDeactivation(params *FetchDeactivationParams) (*MessagingV1Deactivation, error) { 36 path := "/v1/Deactivations" 37 38 data := url.Values{} 39 headers := make(map[string]interface{}) 40 41 if params != nil && params.Date != nil { 42 data.Set("Date", fmt.Sprint(*params.Date)) 43 } 44 45 resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) 46 if err != nil { 47 return nil, err 48 } 49 50 defer resp.Body.Close() 51 52 ps := &MessagingV1Deactivation{} 53 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 54 return nil, err 55 } 56 57 return ps, err 58 }