OpenMetaverse.RegistrationApi.CreateUser C# (CSharp) Method

CreateUser() public method

Returns the new user ID or throws an exception containing the error code The error codes can be found here: https://wiki.secondlife.com/wiki/RegAPIError
public CreateUser ( CreateUserParam user ) : UUID
user CreateUserParam New user account to create
return UUID
        public UUID CreateUser(CreateUserParam user)
        {
            if (Initializing)
                throw new InvalidOperationException("still initializing");

            if (_caps.CreateUser == null)
                throw new InvalidOperationException("access denied; only approved developers have access to the registration api");

            // Create the POST data
            OSDMap query = new OSDMap();
            query.Add("username", OSD.FromString(user.FirstName));
            query.Add("last_name_id", OSD.FromInteger(user.LastName.ID));
            query.Add("email", OSD.FromString(user.Email));
            query.Add("password", OSD.FromString(user.Password));
            query.Add("dob", OSD.FromString(user.Birthdate.ToString("yyyy-MM-dd")));

            if (user.LimitedToEstate != null)
                query.Add("limited_to_estate", OSD.FromInteger(user.LimitedToEstate.Value));

            if (!string.IsNullOrEmpty(user.StartRegionName))
                query.Add("start_region_name", OSD.FromInteger(user.LimitedToEstate.Value));

            if (user.StartLocation != null)
            {
                query.Add("start_local_x", OSD.FromReal(user.StartLocation.Value.X));
                query.Add("start_local_y", OSD.FromReal(user.StartLocation.Value.Y));
                query.Add("start_local_z", OSD.FromReal(user.StartLocation.Value.Z));
            }

            if (user.StartLookAt != null)
            {
                query.Add("start_look_at_x", OSD.FromReal(user.StartLookAt.Value.X));
                query.Add("start_look_at_y", OSD.FromReal(user.StartLookAt.Value.Y));
                query.Add("start_look_at_z", OSD.FromReal(user.StartLookAt.Value.Z));
            }

            //byte[] postData = OSDParser.SerializeXmlBytes(query);

            // Make the request
            CapsClient request = new CapsClient(_caps.CreateUser);
            request.OnComplete += new CapsClient.CompleteCallback(CreateUserResponse);
            request.StartRequest();

            // FIXME: Block
            return UUID.Zero;
        }