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;
 }
示例#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);
            }
        }
示例#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];
            }
        }
示例#6
0
 public JiraAssignProjectResult(JiraResultWithData source)
 {
     ErrorMessage = source.ErrorMessage;
     Status       = source.Status;
     Data         = (JiraProjectRolesResponseModel)source.Data;
 }
示例#7
0
 public JiraCreateUserResult(JiraResultWithData source)
 {
     ErrorMessage = source.ErrorMessage;
     Status       = source.Status;
     Data         = (JiraCreateUserResponseModel)source.Data;
 }