Get() public static method

public static Get ( string json ) : UserConfiguration
json string
return UserConfiguration
Esempio n. 1
0
        /// <summary>
        /// Used to Edit an existing user account
        /// </summary>
        public static UserConfiguration EditUser(EditUserInfo info, string note = "")
        {
            string json = JSON.FromObject(info);

            if (!string.IsNullOrEmpty(json))
            {
                UserConfiguration result = null;

                string url = new Uri(ApiConfiguration.AuthenticationApiHost, "users/edit/index.php").ToString();

                var postDatas = new NameValueCollection();
                postDatas["user"]      = json;
                postDatas["token"]     = info.SessionToken;
                postDatas["sender_id"] = SenderId.Get();
                postDatas["note"]      = note;

                string response = HTTP.POST(url, postDatas);
                if (response != null)
                {
                    var success = ApiError.ProcessResponse(response, "Edit User");
                    if (success)
                    {
                        result = UserConfiguration.Get(response);

                        return(result);
                    }
                }
            }

            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Basic User login using (Username or Email Address) and Plain Text Password
        /// </summary>
        public static UserConfiguration BasicLogin(string id, string password, string note = "")
        {
            UserConfiguration result = null;

            if (id != null && id.Length > 0)
            {
                string url = new Uri(ApiConfiguration.AuthenticationApiHost, "users/login/index.php").ToString();

                var postDatas = new NameValueCollection();
                postDatas["id"]        = id;
                postDatas["password"]  = password;
                postDatas["sender_id"] = SenderId.Get();
                postDatas["note"]      = note;

                string response = HTTP.POST(url, postDatas);
                if (response != null)
                {
                    var success = ApiError.ProcessResponse(response, "User Basic Login");
                    if (success)
                    {
                        result = UserConfiguration.Get(response);
                    }
                }
            }

            return(result);
        }
Esempio n. 3
0
        /// <summary>
        /// User Login using Remember Token
        /// </summary>
        public static UserConfiguration TokenLogin(string token, string note = "")
        {
            UserConfiguration result = null;

            if (token != null && token.Length > 0)
            {
                string senderId = SenderId.Get();

                string url = new Uri(ApiConfiguration.AuthenticationApiHost, "users/login/?token=" + token + "&sender_id=" + senderId + "&note=" + note).ToString();

                string response = HTTP.GET(url);
                if (response != null)
                {
                    var success = ApiError.ProcessResponse(response, "User Token Login");
                    if (success)
                    {
                        result = UserConfiguration.Get(response);
                    }
                }
            }

            return(result);
        }