github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/buildplanner/request/evaluate.go (about)

     1  package request
     2  
     3  func Evaluate(owner, project, commitId, target string) *evaluate {
     4  	return &evaluate{map[string]interface{}{
     5  		"organization": owner,
     6  		"project":      project,
     7  		"commitId":     commitId,
     8  		"target":       target,
     9  	}}
    10  }
    11  
    12  type evaluate struct {
    13  	vars map[string]interface{}
    14  }
    15  
    16  func (b *evaluate) Query() string {
    17  	return `
    18  query ($organization: String!, $project: String!, $commitId: String!, $target: String!) {
    19    project(organization: $organization, project: $project) {
    20      ... on Project {
    21        __typename
    22        commit(vcsRef: $commitId) {
    23          ... on Commit {
    24            __typename
    25            build(target: $target) {
    26              ... on Build {
    27                __typename
    28                status
    29              }
    30              ... on PlanningError {
    31                __typename
    32                message
    33                subErrors {
    34                  __typename
    35                  ... on GenericSolveError {
    36                    path
    37                    message
    38                    isTransient
    39                    validationErrors {
    40                      error
    41                      jsonPath
    42                    }
    43                  }
    44                  ... on RemediableSolveError {
    45                    path
    46                    message
    47                    isTransient
    48                    errorType
    49                    validationErrors {
    50                      error
    51                      jsonPath
    52                    }
    53                    suggestedRemediations {
    54                      remediationType
    55                      command
    56                      parameters
    57                    }
    58                  }
    59                }
    60              }
    61            }
    62          }
    63          ... on NotFound {
    64            type
    65            message
    66            resource
    67            mayNeedAuthentication
    68          }
    69        }
    70      }
    71      ... on NotFound {
    72        type
    73        message
    74        resource
    75        mayNeedAuthentication
    76      }
    77    }
    78  }`
    79  }
    80  
    81  func (b *evaluate) Vars() (map[string]interface{}, error) {
    82  	return b.vars, nil
    83  }