/// <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); }
/// <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); }
public static UserConfiguration Set(string token, string path) { UserConfiguration result = null; if (!string.IsNullOrEmpty(token)) { string url = "https://www.feenux.com/trakhound/api/profile_image/set/index.php"; string senderId = SenderId.Get(); var postDatas = new NameValueCollection(); postDatas["token"] = token; postDatas["sender_id"] = SenderId.Get(); } return(result); }
/// <summary> /// Used to Logout a currently logged in user /// </summary> public static bool Logout(string token = null) { bool result = false; string url = new Uri(ApiConfiguration.AuthenticationApiHost, "users/logout/index.php").ToString(); string senderId = SenderId.Get(); url += "?sender_id=" + SenderId.Get(); if (token != null) { url += "&token=" + token; } string response = HTTP.GET(url); if (!string.IsNullOrEmpty(response)) { result = ApiError.ProcessResponse(response, "User Logout"); } return(result); }
/// <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 + "¬e=" + 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); }