ALMRestClient.ALMClient.ManageServerSessions C# (CSharp) Method

ManageServerSessions() private method

Manages the session credentials
private ManageServerSessions ( Func getMethod ) : bool
getMethod Func Need to know what type of action should occur
return bool
        private bool ManageServerSessions(Func<RestSharp.Method> getMethod)
        {
            if (clientConfig.IsSessionRequired == false)
            {
                return true;
            }

            IRestRequest updateSession = new RestSharp.RestRequest(clientConfig.SessionAddress);

            if (getMethod != null)
            {
                updateSession.Method = getMethod();
            }
            else
            {
                throw new InvalidOperationException("Unable to manage server sessions without knowing which method to use");
            }

            AddAuthTokensAsNecessary(updateSession);
            CleanRequest(ref updateSession);

            RestSharp.IRestResponse response = client.Execute(updateSession);

            SetTokenFromCookies(client);

            return response.StatusCode == HttpStatusCode.Created || response.StatusCode == HttpStatusCode.OK;
        }