|
| 1 | +/* |
| 2 | + * This code was generated by |
| 3 | + * ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ |
| 4 | + * | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ |
| 5 | + * | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ |
| 6 | + * |
| 7 | + * Twilio - Content |
| 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 | + |
| 16 | +using Newtonsoft.Json; |
| 17 | +using System; |
| 18 | +using System.Collections.Generic; |
| 19 | +using Twilio.Base; |
| 20 | +using Twilio.Clients; |
| 21 | +using Twilio.Constant; |
| 22 | +using Twilio.Converters; |
| 23 | +using Twilio.Exceptions; |
| 24 | +using Twilio.Http; |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | +namespace Twilio.Rest.Content.V2 |
| 29 | +{ |
| 30 | + public class ContentAndApprovalsResource : Resource |
| 31 | + { |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + private static Request BuildReadRequest(ReadContentAndApprovalsOptions options, ITwilioRestClient client) |
| 38 | + { |
| 39 | + |
| 40 | + string path = "/v2/ContentAndApprovals"; |
| 41 | + |
| 42 | + |
| 43 | + return new Request( |
| 44 | + HttpMethod.Get, |
| 45 | + Rest.Domain.Content, |
| 46 | + path, |
| 47 | + queryParams: options.GetParams(), |
| 48 | + headerParams: null |
| 49 | + ); |
| 50 | + } |
| 51 | + /// <summary> Retrieve a list of Contents with approval statuses belonging to the account used to make the request </summary> |
| 52 | + /// <param name="options"> Read ContentAndApprovals parameters </param> |
| 53 | + /// <param name="client"> Client to make requests to Twilio </param> |
| 54 | + /// <returns> A single instance of ContentAndApprovals </returns> |
| 55 | + public static ResourceSet<ContentAndApprovalsResource> Read(ReadContentAndApprovalsOptions options, ITwilioRestClient client = null) |
| 56 | + { |
| 57 | + client = client ?? TwilioClient.GetRestClient(); |
| 58 | + var response = client.Request(BuildReadRequest(options, client)); |
| 59 | + var page = Page<ContentAndApprovalsResource>.FromJson("contents", response.Content); |
| 60 | + return new ResourceSet<ContentAndApprovalsResource>(page, options, client); |
| 61 | + } |
| 62 | + |
| 63 | + #if !NET35 |
| 64 | + /// <summary> Retrieve a list of Contents with approval statuses belonging to the account used to make the request </summary> |
| 65 | + /// <param name="options"> Read ContentAndApprovals parameters </param> |
| 66 | + /// <param name="client"> Client to make requests to Twilio </param> |
| 67 | + /// <returns> Task that resolves to A single instance of ContentAndApprovals </returns> |
| 68 | + public static async System.Threading.Tasks.Task<ResourceSet<ContentAndApprovalsResource>> ReadAsync(ReadContentAndApprovalsOptions options, |
| 69 | + ITwilioRestClient client = null) |
| 70 | + { |
| 71 | + client = client ?? TwilioClient.GetRestClient(); |
| 72 | + var response = await client.RequestAsync(BuildReadRequest(options, client)); |
| 73 | + |
| 74 | + var page = Page<ContentAndApprovalsResource>.FromJson("contents", response.Content); |
| 75 | + return new ResourceSet<ContentAndApprovalsResource>(page, options, client); |
| 76 | + } |
| 77 | + #endif |
| 78 | + /// <summary> Retrieve a list of Contents with approval statuses belonging to the account used to make the request </summary> |
| 79 | + /// <param name="pageSize"> How many resources to return in each list page. The default is 50, and the maximum is 1000. </param> |
| 80 | + /// <param name="limit"> Record limit </param> |
| 81 | + /// <param name="client"> Client to make requests to Twilio </param> |
| 82 | + /// <returns> A single instance of ContentAndApprovals </returns> |
| 83 | + public static ResourceSet<ContentAndApprovalsResource> Read( |
| 84 | + int? pageSize = null, |
| 85 | + long? limit = null, |
| 86 | + ITwilioRestClient client = null) |
| 87 | + { |
| 88 | + var options = new ReadContentAndApprovalsOptions(){ PageSize = pageSize, Limit = limit}; |
| 89 | + return Read(options, client); |
| 90 | + } |
| 91 | + |
| 92 | + #if !NET35 |
| 93 | + /// <summary> Retrieve a list of Contents with approval statuses belonging to the account used to make the request </summary> |
| 94 | + /// <param name="pageSize"> How many resources to return in each list page. The default is 50, and the maximum is 1000. </param> |
| 95 | + /// <param name="limit"> Record limit </param> |
| 96 | + /// <param name="client"> Client to make requests to Twilio </param> |
| 97 | + /// <returns> Task that resolves to A single instance of ContentAndApprovals </returns> |
| 98 | + public static async System.Threading.Tasks.Task<ResourceSet<ContentAndApprovalsResource>> ReadAsync( |
| 99 | + int? pageSize = null, |
| 100 | + long? limit = null, |
| 101 | + ITwilioRestClient client = null) |
| 102 | + { |
| 103 | + var options = new ReadContentAndApprovalsOptions(){ PageSize = pageSize, Limit = limit}; |
| 104 | + return await ReadAsync(options, client); |
| 105 | + } |
| 106 | + #endif |
| 107 | + |
| 108 | + |
| 109 | + /// <summary> Fetch the target page of records </summary> |
| 110 | + /// <param name="targetUrl"> API-generated URL for the requested results page </param> |
| 111 | + /// <param name="client"> Client to make requests to Twilio </param> |
| 112 | + /// <returns> The target page of records </returns> |
| 113 | + public static Page<ContentAndApprovalsResource> GetPage(string targetUrl, ITwilioRestClient client) |
| 114 | + { |
| 115 | + client = client ?? TwilioClient.GetRestClient(); |
| 116 | + |
| 117 | + var request = new Request( |
| 118 | + HttpMethod.Get, |
| 119 | + targetUrl |
| 120 | + ); |
| 121 | + |
| 122 | + var response = client.Request(request); |
| 123 | + return Page<ContentAndApprovalsResource>.FromJson("contents", response.Content); |
| 124 | + } |
| 125 | + |
| 126 | + /// <summary> Fetch the next page of records </summary> |
| 127 | + /// <param name="page"> current page of records </param> |
| 128 | + /// <param name="client"> Client to make requests to Twilio </param> |
| 129 | + /// <returns> The next page of records </returns> |
| 130 | + public static Page<ContentAndApprovalsResource> NextPage(Page<ContentAndApprovalsResource> page, ITwilioRestClient client) |
| 131 | + { |
| 132 | + var request = new Request( |
| 133 | + HttpMethod.Get, |
| 134 | + page.GetNextPageUrl(Rest.Domain.Api) |
| 135 | + ); |
| 136 | + |
| 137 | + var response = client.Request(request); |
| 138 | + return Page<ContentAndApprovalsResource>.FromJson("contents", response.Content); |
| 139 | + } |
| 140 | + |
| 141 | + /// <summary> Fetch the previous page of records </summary> |
| 142 | + /// <param name="page"> current page of records </param> |
| 143 | + /// <param name="client"> Client to make requests to Twilio </param> |
| 144 | + /// <returns> The previous page of records </returns> |
| 145 | + public static Page<ContentAndApprovalsResource> PreviousPage(Page<ContentAndApprovalsResource> page, ITwilioRestClient client) |
| 146 | + { |
| 147 | + var request = new Request( |
| 148 | + HttpMethod.Get, |
| 149 | + page.GetPreviousPageUrl(Rest.Domain.Api) |
| 150 | + ); |
| 151 | + |
| 152 | + var response = client.Request(request); |
| 153 | + return Page<ContentAndApprovalsResource>.FromJson("contents", response.Content); |
| 154 | + } |
| 155 | + |
| 156 | + |
| 157 | + /// <summary> |
| 158 | + /// Converts a JSON string into a ContentAndApprovalsResource object |
| 159 | + /// </summary> |
| 160 | + /// <param name="json"> Raw JSON string </param> |
| 161 | + /// <returns> ContentAndApprovalsResource object represented by the provided JSON </returns> |
| 162 | + public static ContentAndApprovalsResource FromJson(string json) |
| 163 | + { |
| 164 | + try |
| 165 | + { |
| 166 | + return JsonConvert.DeserializeObject<ContentAndApprovalsResource>(json); |
| 167 | + } |
| 168 | + catch (JsonException e) |
| 169 | + { |
| 170 | + throw new ApiException(e.Message, e); |
| 171 | + } |
| 172 | + } |
| 173 | + /// <summary> |
| 174 | + /// Converts an object into a json string |
| 175 | + /// </summary> |
| 176 | + /// <param name="model"> C# model </param> |
| 177 | + /// <returns> JSON string </returns> |
| 178 | + public static string ToJson(object model) |
| 179 | + { |
| 180 | + try |
| 181 | + { |
| 182 | + return JsonConvert.SerializeObject(model); |
| 183 | + } |
| 184 | + catch (JsonException e) |
| 185 | + { |
| 186 | + throw new ApiException(e.Message, e); |
| 187 | + } |
| 188 | + } |
| 189 | + |
| 190 | + |
| 191 | + ///<summary> The date and time in GMT that the resource was created specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. </summary> |
| 192 | + [JsonProperty("date_created")] |
| 193 | + public DateTime? DateCreated { get; private set; } |
| 194 | + |
| 195 | + ///<summary> The date and time in GMT that the resource was last updated specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format. </summary> |
| 196 | + [JsonProperty("date_updated")] |
| 197 | + public DateTime? DateUpdated { get; private set; } |
| 198 | + |
| 199 | + ///<summary> The unique string that that we created to identify the Content resource. </summary> |
| 200 | + [JsonProperty("sid")] |
| 201 | + public string Sid { get; private set; } |
| 202 | + |
| 203 | + ///<summary> The SID of the [Account](https://www.twilio.com/docs/usage/api/account) that created Content resource. </summary> |
| 204 | + [JsonProperty("account_sid")] |
| 205 | + public string AccountSid { get; private set; } |
| 206 | + |
| 207 | + ///<summary> A string name used to describe the Content resource. Not visible to the end recipient. </summary> |
| 208 | + [JsonProperty("friendly_name")] |
| 209 | + public string FriendlyName { get; private set; } |
| 210 | + |
| 211 | + ///<summary> Two-letter (ISO 639-1) language code (e.g., en) identifying the language the Content resource is in. </summary> |
| 212 | + [JsonProperty("language")] |
| 213 | + public string Language { get; private set; } |
| 214 | + |
| 215 | + ///<summary> Defines the default placeholder values for variables included in the Content resource. e.g. {\"1\": \"Customer_Name\"}. </summary> |
| 216 | + [JsonProperty("variables")] |
| 217 | + public object Variables { get; private set; } |
| 218 | + |
| 219 | + ///<summary> The [Content types](https://www.twilio.com/docs/content/content-types-overview) (e.g. twilio/text) for this Content resource. </summary> |
| 220 | + [JsonProperty("types")] |
| 221 | + public object Types { get; private set; } |
| 222 | + |
| 223 | + ///<summary> The submitted information and approval request status of the Content resource. </summary> |
| 224 | + [JsonProperty("approval_requests")] |
| 225 | + public object ApprovalRequests { get; private set; } |
| 226 | + |
| 227 | + |
| 228 | + |
| 229 | + private ContentAndApprovalsResource() { |
| 230 | + |
| 231 | + } |
| 232 | + } |
| 233 | +} |
| 234 | + |
0 commit comments