コード例 #1
0
        public CustomerAddResponse Add(Customer customer)
        {
            XElement message =
                new XElement("customer",
                             new XElement("add",
                                          new XElement("gen_info",
                                                       customer.ToXml(ModelXmlDataType.CustomerAdd)
                                                       )
                                          )
                             );

            return(CustomerAddResponse.Parse(ApiHttpClient.SendPacket(message)));
        }
コード例 #2
0
        new public static CustomerAddResponse Parse(XElement message)
        {
            CustomerAddResponse result = new CustomerAddResponse();

            result.Status    = message.Descendants("status").FirstOrDefault().Value.ToLower().Equals("ok") ? PleskApiResponseStatus.Ok : PleskApiResponseStatus.Error;
            result.ErrorCode = message.Descendants("errcode").FirstOrDefault()?.Value;
            result.ErrorText = message.Descendants("errtext").FirstOrDefault()?.Value;
            try
            {
                result.CustomerId = Convert.ToInt32(message.Descendants("id").FirstOrDefault()?.Value);
            }
            catch { }
            result.CustomerGuid = message.Descendants("guid").FirstOrDefault()?.Value;

            return(result);
        }
コード例 #3
0
        public CustomerAddResponse CustomerAdd(string email, string password)//, string domain = null, string plan = null)
        {
            XElement message = new XElement("packet",
                                            new XAttribute("version", "1.6.7.0"),
                                            new XElement("customer",
                                                         new XElement("add",
                                                                      new XElement("gen_info",
                                                                                   new XElement("pname", email),
                                                                                   new XElement("login", email),
                                                                                   new XElement("passwd", password),
                                                                                   new XElement("email", email)
                                                                                   )
                                                                      )
                                                         )
                                            );
            HttpWebRequest request = ApiHttpClient.Request(message);
            XElement       resp    = ApiHttpClient.GetResponse(request);

            return(CustomerAddResponse.Parse(resp));
        }