protected void CreateClient() { string username = Credential.UserName; string password = Credential.GetNetworkCredential().Password; try { string message = $"Connecting to Jira Endpoint [{Uri}] with Username [{Credential.UserName}]"; WriteVerbose(message); JSession.Open(Uri, username, password); WriteDebug("Issuing basic request to verify connectivity [Get Priorities]"); new AsyncResult( message, JSession.Api.Priorities.GetPrioritiesAsync() ).Wait(); } catch (Exception ex) { // clear invalid session JSession.Close(); throw new JiraConnectionException(ex.Message, ex); } }
protected override void EndProcessing() { var session = new JSession(); if (session.IsConnected) { WriteObject(session); } else { WriteVerbose("No Jira session is available."); } }
protected override void EndProcessing() { JSession.Close(); }