Skip to content
  • Auto
  • Light
  • Dark

Compare

Creates two builds whose outputs can be compared directly
client.Builds.Compare(ctx, body) (*BaseBuildObjectHeadBuildObjectBuildCompareResponse, error)
post/v0/builds/compare

Creates two builds whose outputs can be compared directly

Parameters
bodyBasefieldHeadfieldProjectfieldTargetsfieldBuildCompareParams
Hide ParametersShow Parameters
Basefield

Parameters for the base build

Hide ParametersShow Parameters
RevisionBuildCompareParamsBaseRevisionMapmapBuildCompareParamsBaseRevisionUnion

Specifies what to build: a branch name, a commit SHA, or file contents

Hide ParametersShow Parameters
string
BuildCompareParamsBaseRevisionMaptype
map[string, FileInputUnion]

File contents to commit directly

Hide ParametersShow Parameters
Branchstring
optional

Optional branch to use. If not specified, defaults to "main". When using a branch name as revision, this must match or be omitted.

CommitMessagestring
optional

Optional commit message to use when creating a new commit.

Headfield

Parameters for the head build

Hide ParametersShow Parameters
RevisionBuildCompareParamsHeadRevisionMapmapBuildCompareParamsHeadRevisionUnion

Specifies what to build: a branch name, a commit SHA, or file contents

Hide ParametersShow Parameters
string
BuildCompareParamsHeadRevisionMaptype
map[string, FileInputUnion]

File contents to commit directly

Hide ParametersShow Parameters
Branchstring
optional

Optional branch to use. If not specified, defaults to "main". When using a branch name as revision, this must match or be omitted.

CommitMessagestring
optional

Optional commit message to use when creating a new commit.

Projectfield
optional
param.Field[string]

Project name

Targetsfield
optional
param.Field[[]TargetNodeTargetTargetTypescriptTargetTargetPythonTargetTargetGoTargetTargetJavaTargetTargetKotlinTargetTargetRubyTargetTargetTerraformTargetTargetCliTargetTargetPhpTargetTargetCsharpTargetTarget]

Optional list of SDK targets to build. If not specified, all configured targets will be built.

Hide ParametersShow Parameters
TargetNodeconst
TargetNodeTargetTargetTypescriptTargetTargetPythonTargetTargetGoTargetTargetJavaTargetTargetKotlinTargetTargetRubyTargetTargetTerraformTargetTargetCliTargetTargetPhpTargetTargetCsharpTargetTarget
"node"
TargetTypescriptconst
TargetNodeTargetTargetTypescriptTargetTargetPythonTargetTargetGoTargetTargetJavaTargetTargetKotlinTargetTargetRubyTargetTargetTerraformTargetTargetCliTargetTargetPhpTargetTargetCsharpTargetTarget
"typescript"
TargetPythonconst
TargetNodeTargetTargetTypescriptTargetTargetPythonTargetTargetGoTargetTargetJavaTargetTargetKotlinTargetTargetRubyTargetTargetTerraformTargetTargetCliTargetTargetPhpTargetTargetCsharpTargetTarget
"python"
TargetGoconst
TargetNodeTargetTargetTypescriptTargetTargetPythonTargetTargetGoTargetTargetJavaTargetTargetKotlinTargetTargetRubyTargetTargetTerraformTargetTargetCliTargetTargetPhpTargetTargetCsharpTargetTarget
"go"
TargetJavaconst
TargetNodeTargetTargetTypescriptTargetTargetPythonTargetTargetGoTargetTargetJavaTargetTargetKotlinTargetTargetRubyTargetTargetTerraformTargetTargetCliTargetTargetPhpTargetTargetCsharpTargetTarget
"java"
TargetKotlinconst
TargetNodeTargetTargetTypescriptTargetTargetPythonTargetTargetGoTargetTargetJavaTargetTargetKotlinTargetTargetRubyTargetTargetTerraformTargetTargetCliTargetTargetPhpTargetTargetCsharpTargetTarget
"kotlin"
TargetRubyconst
TargetNodeTargetTargetTypescriptTargetTargetPythonTargetTargetGoTargetTargetJavaTargetTargetKotlinTargetTargetRubyTargetTargetTerraformTargetTargetCliTargetTargetPhpTargetTargetCsharpTargetTarget
"ruby"
TargetTerraformconst
TargetNodeTargetTargetTypescriptTargetTargetPythonTargetTargetGoTargetTargetJavaTargetTargetKotlinTargetTargetRubyTargetTargetTerraformTargetTargetCliTargetTargetPhpTargetTargetCsharpTargetTarget
"terraform"
TargetCliconst
TargetNodeTargetTargetTypescriptTargetTargetPythonTargetTargetGoTargetTargetJavaTargetTargetKotlinTargetTargetRubyTargetTargetTerraformTargetTargetCliTargetTargetPhpTargetTargetCsharpTargetTarget
"cli"
TargetPhpconst
TargetNodeTargetTargetTypescriptTargetTargetPythonTargetTargetGoTargetTargetJavaTargetTargetKotlinTargetTargetRubyTargetTargetTerraformTargetTargetCliTargetTargetPhpTargetTargetCsharpTargetTarget
"php"
TargetCsharpconst
TargetNodeTargetTargetTypescriptTargetTargetPythonTargetTargetGoTargetTargetJavaTargetTargetKotlinTargetTargetRubyTargetTargetTerraformTargetTargetCliTargetTargetPhpTargetTargetCsharpTargetTarget
"csharp"
Returns
BuildCompareResponsestruct
Hide ParametersShow Parameters
BaseIDstringConfigCommitstringCreatedAtTimeDocumentedSpecBuildObjectDocumentedSpecUnionObjectBuildObjectObjectOrgstringProjectstringTargetsBuildObjectTargetsUpdatedAtTimeBuildObject
HeadIDstringConfigCommitstringCreatedAtTimeDocumentedSpecBuildObjectDocumentedSpecUnionObjectBuildObjectObjectOrgstringProjectstringTargetsBuildObjectTargetsUpdatedAtTimeBuildObject
package main

import (
  "context"
  "fmt"

  "github.com/stainless-api/stainless-api-go"
  "github.com/stainless-api/stainless-api-go/option"
)

func main() {
  client := stainless.NewClient(
    option.WithAPIKey("My API Key"),
  )
  response, err := client.Builds.Compare(context.TODO(), stainless.BuildCompareParams{
    Base: stainless.BuildCompareParamsBase{
      Revision: stainless.BuildCompareParamsBaseRevisionUnion{
        OfString: stainless.String("string"),
      },
    },
    Head: stainless.BuildCompareParamsHead{
      Revision: stainless.BuildCompareParamsHeadRevisionUnion{
        OfString: stainless.String("string"),
      },
    },
    Project: stainless.String("project"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.Base)
}
200 Example
{
  "base": {
    "id": "id",
    "config_commit": "config_commit",
    "created_at": "2019-12-27T18:11:19.117Z",
    "documented_spec": {
      "content": "content",
      "type": "content"
    },
    "object": "build",
    "org": "org",
    "project": "project",
    "targets": {
      "cli": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "csharp": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "go": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "java": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "kotlin": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "node": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "php": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "python": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "ruby": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "terraform": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "typescript": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      }
    },
    "updated_at": "2019-12-27T18:11:19.117Z"
  },
  "head": {
    "id": "id",
    "config_commit": "config_commit",
    "created_at": "2019-12-27T18:11:19.117Z",
    "documented_spec": {
      "content": "content",
      "type": "content"
    },
    "object": "build",
    "org": "org",
    "project": "project",
    "targets": {
      "cli": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "csharp": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "go": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "java": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "kotlin": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "node": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "php": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "python": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "ruby": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "terraform": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      },
      "typescript": {
        "commit": {
          "status": "not_started"
        },
        "lint": {
          "status": "not_started"
        },
        "object": "build_target",
        "status": "not_started",
        "test": {
          "status": "not_started"
        },
        "build": {
          "status": "not_started"
        },
        "upload": {
          "status": "not_started"
        }
      }
    },
    "updated_at": "2019-12-27T18:11:19.117Z"
  }
}