Class GraphQLResponseDto<T>

java.lang.Object
de.qytera.qtaf.xray.dto.response.graphql.GraphQLResponseDto<T>
Type Parameters:
T - the type of the returned data
Direct Known Subclasses:
XrayCloudTestStepResponseDto

public abstract class GraphQLResponseDto<T> extends Object
Represents a generic GraphQL response. These always consist of a data property and an optional array of errors.

A successful response could look like this:
 
   {
     "data": {
       "getTests": {
         "total": 10,
         "start": 0,
         "results": [
           {
             "issueId": "12345"
           },
           {
             "issueId": "45678"
           }
         ]
       }
     }
   }
 
 


An erroneous response could look like this:
 
   {
     "errors": [
       {
         "message": "Invalid JQL query",
         "locations": [
           {
             "line": 2,
             "column": 3
           }
         ],
         "path": [
           "getTests"
         ]
       }
     ],
     "data": {
       "getTests": null
     }
   }
 
 
  • Constructor Details

    • GraphQLResponseDto

      public GraphQLResponseDto()
  • Method Details

    • hasErrors

      public boolean hasErrors()
      Whether the response contains any errors.
      Returns:
      true if it contains an error, false otherwise
    • errorReason

      public String errorReason()
      Returns a summary of all errors that occurred during request handling.
      Returns:
      the error summary
      Throws:
      IllegalStateException - if the response does not contain any errors
    • getData

      public T getData()
      Response payload.
    • getErrors

      public GraphQLResponseErrorDto[] getErrors()
      Error DTO.
    • setData

      public void setData(T data)
      Response payload.
    • setErrors

      public void setErrors(GraphQLResponseErrorDto[] errors)
      Error DTO.