github.com/twilio/twilio-go@v1.20.1/rest/video/v1/rooms_recording_rules.go (about) 1 /* 2 * This code was generated by 3 * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ 4 * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ 5 * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ 6 * 7 * Twilio - Video 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 // Returns a list of Recording Rules for the Room. 24 func (c *ApiService) FetchRoomRecordingRule(RoomSid string) (*VideoV1RoomRecordingRule, error) { 25 path := "/v1/Rooms/{RoomSid}/RecordingRules" 26 path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) 27 28 data := url.Values{} 29 headers := make(map[string]interface{}) 30 31 resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) 32 if err != nil { 33 return nil, err 34 } 35 36 defer resp.Body.Close() 37 38 ps := &VideoV1RoomRecordingRule{} 39 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 40 return nil, err 41 } 42 43 return ps, err 44 } 45 46 // Optional parameters for the method 'UpdateRoomRecordingRule' 47 type UpdateRoomRecordingRuleParams struct { 48 // A JSON-encoded array of recording rules. 49 Rules *interface{} `json:"Rules,omitempty"` 50 } 51 52 func (params *UpdateRoomRecordingRuleParams) SetRules(Rules interface{}) *UpdateRoomRecordingRuleParams { 53 params.Rules = &Rules 54 return params 55 } 56 57 // Update the Recording Rules for the Room 58 func (c *ApiService) UpdateRoomRecordingRule(RoomSid string, params *UpdateRoomRecordingRuleParams) (*VideoV1RoomRecordingRule, error) { 59 path := "/v1/Rooms/{RoomSid}/RecordingRules" 60 path = strings.Replace(path, "{"+"RoomSid"+"}", RoomSid, -1) 61 62 data := url.Values{} 63 headers := make(map[string]interface{}) 64 65 if params != nil && params.Rules != nil { 66 v, err := json.Marshal(params.Rules) 67 68 if err != nil { 69 return nil, err 70 } 71 72 data.Set("Rules", string(v)) 73 } 74 75 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 76 if err != nil { 77 return nil, err 78 } 79 80 defer resp.Body.Close() 81 82 ps := &VideoV1RoomRecordingRule{} 83 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 84 return nil, err 85 } 86 87 return ps, err 88 }