using System; using System.Collections.Generic; using System.Net.Http; using System.Text.Json; using System.Text.Json.Serialization; using System.Threading.Tasks; namespace Files.com.Models { public class DnsRecord { private Dictionary attributes; private Dictionary options; public DnsRecord() { this.attributes = new Dictionary(); this.options = new Dictionary(); this.attributes.Add("id", null); this.attributes.Add("domain", null); this.attributes.Add("rrtype", null); this.attributes.Add("value", null); } public DnsRecord(Dictionary attributes, Dictionary options) { this.attributes = attributes; this.options = options; } /// /// Unique label for DNS record; used by Zapier and other integrations. /// [JsonPropertyName("id")] public string Id { get { return (string) attributes["id"]; } } /// /// DNS record domain name /// [JsonPropertyName("domain")] public string Domain { get { return (string) attributes["domain"]; } } /// /// DNS record type /// [JsonPropertyName("rrtype")] public string Rrtype { get { return (string) attributes["rrtype"]; } } /// /// DNS record value /// [JsonPropertyName("value")] public string Value { get { return (string) attributes["value"]; } } /// /// Parameters: /// page - integer - Current page number. /// per_page - integer - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended). /// action - string - Deprecated: If set to `count` returns a count of matching records rather than the records themselves. /// /// TODO: Use types for path_and_primary_params /// TODO: Get return values from the operation (either model.class_name or an array of them) public static async Task List( Dictionary parameters = null, Dictionary options = null ) { parameters = parameters != null ? parameters : new Dictionary(); options = options != null ? options : new Dictionary(); if (parameters.ContainsKey("page") && !(parameters["page"] is Nullable )) { throw new ArgumentException("Bad parameter: page must be of type Nullable", "parameters[\"page\"]"); } if (parameters.ContainsKey("per_page") && !(parameters["per_page"] is Nullable )) { throw new ArgumentException("Bad parameter: per_page must be of type Nullable", "parameters[\"per_page\"]"); } if (parameters.ContainsKey("action") && !(parameters["action"] is string )) { throw new ArgumentException("Bad parameter: action must be of type string", "parameters[\"action\"]"); } string responseJson = await FilesApi.SendRequest("/dns_records", HttpMethod.Get, parameters, options); return JsonSerializer.Deserialize(responseJson); } /// TODO: Get return values from the operation (either model.class_name or an array of them) public static async Task All( Dictionary parameters = null, Dictionary options = null ) { return await List(parameters, options); } } }