//TODO: Check if is async /// <summary> /// Logs the in as. /// </summary> /// <param name="user">The user.</param> /// <param name="secret">The secret.</param> /// <returns></returns> public async Task<RestRequestAsyncHandle> LogInAs(UserCredentials user, string secret) { //Secret could be: System.Guid.NewGuid().ToString() //TODO: get method name Debug.WriteLine(DebugInfo.Format(DateTime.Now, this, "async Task<RestRequestAsyncHandle> LogInAs(UserCredentials user, string secret)", "Launching request as: \\" + user.username + "\\ pswd: \\" + user.password + "\\ secret: \\" + secret + "\\")); request.AddParameter("username", user.username); request.AddParameter("password", user.password); request.AddParameter("client_secret", secret); username = user.username; return await requestHandler.ExecuteAsync<LoginJsonResponse>(request, RequestCallbackOnSuccess, RequestCallbackOnFail); }
public async Task<RestRequestAsyncHandle> Register(UserCredentials user) { request.AddBody(new { username = user.username, password = user.password }); return await requestHandler.ExecuteAsync<ServerJsonResponse>(request, RequestCallbackOnSuccess, RequestCallbackOnFail); }