public void SetCustom(string sld, string tld, params string[] nameservers) { var query = new Query(_params) .AddParameter("SLD", sld) .AddParameter("TLD", tld) .AddParameter("Nameservers", string.Join(",", nameservers)); query.Execute("namecheap.domains.dns.setCustom"); }
public DomainContactsResult GetContacts(string domain) { XDocument doc = new Query(_params) .AddParameter("DomainName", domain) .Execute("namecheap.domains.getContacts"); var serializer = new XmlSerializer(typeof(DomainContactsResult), _ns.NamespaceName); using (var reader = doc.Root.Element(_ns + "CommandResponse").Element(_ns + "DomainContactsResult").CreateReader()) { return (DomainContactsResult)serializer.Deserialize(reader); } }
public DomainCheckResult[] AreAvailable(params string[] domains) { XDocument doc = new Query(_params) .AddParameter("DomainList", string.Join(",", domains)) .Execute("namecheap.domains.check"); return doc.Root.Element(_ns + "CommandResponse").Elements() .Select(o => new DomainCheckResult() { DomainName = o.Attribute("Domain").Value, IsAvailable = o.Attribute("Available").Value.Equals("true", StringComparison.OrdinalIgnoreCase) }).ToArray(); }
public DnsEmailForwardingResult GetEmailForwarding(string domain) { var query = new Query(_params); query.AddParameter("DomainName", domain); XDocument doc = query.Execute("namecheap.domains.dns.getEmailForwarding"); var serializer = new XmlSerializer(typeof(DnsEmailForwardingResult), _ns.NamespaceName); using (var reader = doc.Root.Element(_ns + "CommandResponse").Element(_ns + "DomainDNSGetEmailForwardingResult").CreateReader()) { return (DnsEmailForwardingResult)serializer.Deserialize(reader); } }
public DnsListResult GetList(string sld, string tld) { var query = new Query(_params) .AddParameter("SLD", sld) .AddParameter("TLD", tld); XDocument doc = query.Execute("namecheap.domains.dns.getList"); var serializer = new XmlSerializer(typeof(DnsListResult), _ns.NamespaceName); using (var reader = doc.Root.Element(_ns + "CommandResponse").Element(_ns + "DomainDNSGetListResult").CreateReader()) { return (DnsListResult)serializer.Deserialize(reader); } }
public DomainCreateResult Create(DomainCreateRequest domain) { var query = new Query(_params); foreach (var item in GetNamesAndValuesFromProperties(domain)) query.AddParameter(item.Key, item.Value); XDocument doc = query.Execute("namecheap.domains.create"); XElement result = doc.Root.Element(_ns + "CommandResponse").Element(_ns + "DomainCreateResult"); var serializer = new XmlSerializer(typeof(DomainCreateResult), _ns.NamespaceName); using (var reader = result.CreateReader()) { return (DomainCreateResult)serializer.Deserialize(reader); } }
public DomainInfoResult GetInfo(string domain) { XDocument doc = new Query(_params) .AddParameter("DomainName", domain) .Execute("namecheap.domains.getInfo"); XElement root = doc.Root.Element(_ns + "CommandResponse").Element(_ns + "DomainGetInfoResult"); return new DomainInfoResult() { ID = int.Parse(root.Attribute("ID").Value), OwnerName = root.Attribute("OwnerName").Value, IsOwner = bool.Parse(root.Attribute("IsOwner").Value), CreatedDate = root.Element(_ns + "DomainDetails").Element(_ns + "CreatedDate").Value.ParseNameCheapDate(), ExpiredDate = root.Element(_ns + "DomainDetails").Element(_ns + "ExpiredDate").Value.ParseNameCheapDate(), DnsProviderType = root.Element(_ns + "DnsDetails").Attribute("ProviderType").Value }; }
public DomainListResult GetList() { XDocument doc = new Query(_params).Execute("namecheap.domains.getList"); var serializer = new XmlSerializer(typeof(DomainListResult), _ns.NamespaceName); using (var reader = doc.Root.Element(_ns + "CommandResponse").CreateReader()) { return (DomainListResult)serializer.Deserialize(reader); } }
public void SetContacts(DomainContactsRequest contacts) { var query = new Query(_params); foreach (var item in GetNamesAndValuesFromProperties(contacts)) query.AddParameter(item.Key, item.Value); XDocument doc = query.Execute("namecheap.domains.setContacts"); }
public DomainRenewResult Renew(string domain, int years) { XDocument doc = new Query(_params) .AddParameter("DomainName", domain) .AddParameter("Years", years.ToString()) .Execute("namecheap.domains.renew"); var serializer = new XmlSerializer(typeof(DomainRenewResult), _ns.NamespaceName); using (var reader = doc.Root.Element(_ns + "CommandResponse").Element(_ns + "DomainRenewResult").CreateReader()) { return (DomainRenewResult)serializer.Deserialize(reader); } }
public bool GetRegistrarLock(string domain) { XDocument doc = new Query(_params) .AddParameter("DomainName", domain) .Execute("namecheap.domains.getRegistrarLock"); XElement root = doc.Root.Element(_ns + "CommandResponse").Element(_ns + "DomainGetRegistrarLockResult"); return bool.Parse(root.Attribute("RegistrarLockStatus").Value); }
public void SetEmailForwarding(string domain, EmailForwarding[] request) { var query = new Query(_params) .AddParameter("DomainName", domain); for (int i = 0; i < request.Length; i++) { query.AddParameter("MailBox" + (i + 1), request[i].MailBox); query.AddParameter("ForwardTo" + (i + 1), request[i].ForwardTo); } query.Execute("namecheap.domains.dns.setEmailForwarding"); }
public void SetDefault(string sld, string tld) { var query = new Query(_params) .AddParameter("SLD", sld) .AddParameter("TLD", tld); query.Execute("namecheap.domains.dns.setDefault"); }
public void SetHosts(DnsHostsRequest request) { var query = new Query(_params); query.AddParameter("SLD", request.SLD); query.AddParameter("TLD", request.TLD); for (int i = 0; i < request.HostEntries.Length; i++) { query.AddParameter("HostName" + (i + 1), request.HostEntries[i].HostName); query.AddParameter("Address" + (i + 1), request.HostEntries[i].Address); query.AddParameter("MxPref" + (i + 1), request.HostEntries[i].MxPref); query.AddParameter("RecordType" + (i + 1), Enum.GetName(typeof(RecordType), request.HostEntries[i].RecordType)); if (!string.IsNullOrEmpty(request.HostEntries[i].Ttl)) query.AddParameter("TTL" + (i + 1), request.HostEntries[i].Ttl); } XDocument doc = query.Execute("namecheap.domains.dns.setHosts"); }