github.com/twilio/twilio-go@v1.20.1/rest/video/v1/composition_settings_default.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 "fmt" 20 "net/url" 21 ) 22 23 // Optional parameters for the method 'CreateCompositionSettings' 24 type CreateCompositionSettingsParams struct { 25 // A descriptive string that you create to describe the resource and show to the user in the console 26 FriendlyName *string `json:"FriendlyName,omitempty"` 27 // The SID of the stored Credential resource. 28 AwsCredentialsSid *string `json:"AwsCredentialsSid,omitempty"` 29 // The SID of the Public Key resource to use for encryption. 30 EncryptionKeySid *string `json:"EncryptionKeySid,omitempty"` 31 // The URL of the AWS S3 bucket where the compositions should be stored. We only support DNS-compliant URLs like `https://documentation-example-twilio-bucket/compositions`, where `compositions` is the path in which you want the compositions to be stored. This URL accepts only URI-valid characters, as described in the [RFC 3986](https://tools.ietf.org/html/rfc3986#section-2). 32 AwsS3Url *string `json:"AwsS3Url,omitempty"` 33 // Whether all compositions should be written to the `aws_s3_url`. When `false`, all compositions are stored in our cloud. 34 AwsStorageEnabled *bool `json:"AwsStorageEnabled,omitempty"` 35 // Whether all compositions should be stored in an encrypted form. The default is `false`. 36 EncryptionEnabled *bool `json:"EncryptionEnabled,omitempty"` 37 } 38 39 func (params *CreateCompositionSettingsParams) SetFriendlyName(FriendlyName string) *CreateCompositionSettingsParams { 40 params.FriendlyName = &FriendlyName 41 return params 42 } 43 func (params *CreateCompositionSettingsParams) SetAwsCredentialsSid(AwsCredentialsSid string) *CreateCompositionSettingsParams { 44 params.AwsCredentialsSid = &AwsCredentialsSid 45 return params 46 } 47 func (params *CreateCompositionSettingsParams) SetEncryptionKeySid(EncryptionKeySid string) *CreateCompositionSettingsParams { 48 params.EncryptionKeySid = &EncryptionKeySid 49 return params 50 } 51 func (params *CreateCompositionSettingsParams) SetAwsS3Url(AwsS3Url string) *CreateCompositionSettingsParams { 52 params.AwsS3Url = &AwsS3Url 53 return params 54 } 55 func (params *CreateCompositionSettingsParams) SetAwsStorageEnabled(AwsStorageEnabled bool) *CreateCompositionSettingsParams { 56 params.AwsStorageEnabled = &AwsStorageEnabled 57 return params 58 } 59 func (params *CreateCompositionSettingsParams) SetEncryptionEnabled(EncryptionEnabled bool) *CreateCompositionSettingsParams { 60 params.EncryptionEnabled = &EncryptionEnabled 61 return params 62 } 63 64 // 65 func (c *ApiService) CreateCompositionSettings(params *CreateCompositionSettingsParams) (*VideoV1CompositionSettings, error) { 66 path := "/v1/CompositionSettings/Default" 67 68 data := url.Values{} 69 headers := make(map[string]interface{}) 70 71 if params != nil && params.FriendlyName != nil { 72 data.Set("FriendlyName", *params.FriendlyName) 73 } 74 if params != nil && params.AwsCredentialsSid != nil { 75 data.Set("AwsCredentialsSid", *params.AwsCredentialsSid) 76 } 77 if params != nil && params.EncryptionKeySid != nil { 78 data.Set("EncryptionKeySid", *params.EncryptionKeySid) 79 } 80 if params != nil && params.AwsS3Url != nil { 81 data.Set("AwsS3Url", *params.AwsS3Url) 82 } 83 if params != nil && params.AwsStorageEnabled != nil { 84 data.Set("AwsStorageEnabled", fmt.Sprint(*params.AwsStorageEnabled)) 85 } 86 if params != nil && params.EncryptionEnabled != nil { 87 data.Set("EncryptionEnabled", fmt.Sprint(*params.EncryptionEnabled)) 88 } 89 90 resp, err := c.requestHandler.Post(c.baseURL+path, data, headers) 91 if err != nil { 92 return nil, err 93 } 94 95 defer resp.Body.Close() 96 97 ps := &VideoV1CompositionSettings{} 98 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 99 return nil, err 100 } 101 102 return ps, err 103 } 104 105 // 106 func (c *ApiService) FetchCompositionSettings() (*VideoV1CompositionSettings, error) { 107 path := "/v1/CompositionSettings/Default" 108 109 data := url.Values{} 110 headers := make(map[string]interface{}) 111 112 resp, err := c.requestHandler.Get(c.baseURL+path, data, headers) 113 if err != nil { 114 return nil, err 115 } 116 117 defer resp.Body.Close() 118 119 ps := &VideoV1CompositionSettings{} 120 if err := json.NewDecoder(resp.Body).Decode(ps); err != nil { 121 return nil, err 122 } 123 124 return ps, err 125 }