public JiraCreateIssueResult(JiraResultWithData source)
 {
     ErrorMessage = source.ErrorMessage;
     Status       = source.Status;
     HttpStatus   = source.HttpStatus;
     Data         = (JiraBaseResponseModel)source.Data;
 }
 public JiraProjectTypeResult(JiraResultWithData source)
 {
     ErrorMessage = source.ErrorMessage;
     Status       = source.Status;
     HttpStatus   = source.HttpStatus;
     Data         = (JiraProjectTypeResponseModel)source.Data;
 }
Beispiel #3
0
        private static JiraResultWithData ParseResponse <T>(HttpResponseMessage response, HttpStatusCode expectedStatus) where T : class, new()
        {
            try
            {
                var responseString = response.Content.ReadAsStringAsync().Result;
                var result         = new JiraResultWithData()
                {
                    Status       = response.StatusCode == expectedStatus ? JiraResultStatus.Success : JiraResultStatus.Fail,
                    HttpStatus   = (int)response.StatusCode,
                    ErrorMessage = response.StatusCode != expectedStatus ? responseString : string.Empty,
                    Data         = response.StatusCode == expectedStatus?JsonConvert.DeserializeObject <T>(responseString) : null
                };

                if (result.Status == JiraResultStatus.Fail && result.ErrorMessage.Length == 0)
                {
                    result.ErrorMessage = $"{{ \"error\":{response.StatusCode} }}";
                }

                return(result);
            }
            catch (Exception ex)
            {
                throw new LoggedException("Error parsing result", ex);
            }
        }
Beispiel #4
0
        public JiraProjectRolesResult(JiraResultWithData source)
        {
            ErrorMessage = source.ErrorMessage;
            Status       = source.Status;
            HttpStatus   = source.HttpStatus;

            var list = (List <JiraProjectRolesResponseModel>)source.Data;

            Data = list.ToArray();
        }
        public JiraProjectMetadataResult(JiraResultWithData source)
        {
            ErrorMessage = source.ErrorMessage;
            Status       = source.Status;
            HttpStatus   = source.HttpStatus;

            JiraProjectMetadataResponseModel projects = (JiraProjectMetadataResponseModel)source.Data;

            if (projects != null && projects.Projects != null && projects.Projects.Length > 0)
            {
                Data = projects.Projects[0];
            }
        }
Beispiel #6
0
 public JiraAssignProjectResult(JiraResultWithData source)
 {
     ErrorMessage = source.ErrorMessage;
     Status       = source.Status;
     Data         = (JiraProjectRolesResponseModel)source.Data;
 }
Beispiel #7
0
 public JiraCreateUserResult(JiraResultWithData source)
 {
     ErrorMessage = source.ErrorMessage;
     Status       = source.Status;
     Data         = (JiraCreateUserResponseModel)source.Data;
 }