# Branches ## Create a new project branch `projects.branches.create(**kwargs) -> ProjectBranch` **post** `/v0/projects/{project}/branches` Create a new branch for a project. The branch inherits the config files from the revision pointed to by the `branch_from` parameter. In addition, if the revision is a branch name, the branch will also inherit custom code changes from that branch. ### Parameters - `project: String` - `branch: String` Branch name - `branch_from: String` Branch or commit SHA to branch from - `force: bool` Whether to throw an error if the branch already exists. Defaults to false. ### Returns - `class ProjectBranch` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: String` Branch name - `config_commit: { repo, sha, stats, tree_oid}` A Git commit that points to the latest set of config files on a given branch. - `repo: { branch, host, name, owner}` - `branch: String` - `host: String` - `name: String` - `owner: String` - `sha: String` - `stats: { additions, deletions, total}` - `additions: Integer` - `deletions: Integer` - `total: Integer` - `tree_oid: String` - `latest_build: Build` - `id: String` Build ID - `config_commit: String` - `created_at: Time` - `documented_spec: { content, type} | { expires, type, url}` - `class UnionMember0` - `content: String` - `type: :content` - `:content` - `class UnionMember1` - `expires: Time` - `type: :url` - `:url` - `url: String` - `object: :build` - `:build` - `org: String` - `project: String` - `targets: { cli, csharp, go, 10 more}` - `cli: BuildTarget` - `commit: { status} | { status} | { status} | { commit, completed, completed_at, 3 more}` - `class NotStarted` - `status: :not_started` - `:not_started` - `class Queued` - `status: :queued` - `:queued` - `class InProgress` - `status: :in_progress` - `:in_progress` - `class Completed` - `commit: Commit` - `repo: { branch, host, name, owner}` - `branch: String` - `host: String` - `name: String` - `owner: String` - `sha: String` - `stats: { additions, deletions, total}` - `additions: Integer` - `deletions: Integer` - `total: Integer` - `tree_oid: String` - `completed: { commit, completed_at, conclusion, merge_conflict_pr}` deprecated - `commit: Commit` - `completed_at: Time` - `conclusion: :error | :warning | :note | 9 more` - `:error` - `:warning` - `:note` - `:success` - `:merge_conflict` - `:upstream_merge_conflict` - `:fatal` - `:payment_required` - `:cancelled` - `:timed_out` - `:noop` - `:version_bump` - `merge_conflict_pr: { number, repo}` - `number: Float` - `repo: { host, name, owner}` - `host: String` - `name: String` - `owner: String` - `completed_at: Time` - `conclusion: :error | :warning | :note | 9 more` - `:error` - `:warning` - `:note` - `:success` - `:merge_conflict` - `:upstream_merge_conflict` - `:fatal` - `:payment_required` - `:cancelled` - `:timed_out` - `:noop` - `:version_bump` - `merge_conflict_pr: { number, repo}` - `number: Float` - `repo: { host, name, owner}` - `host: String` - `name: String` - `owner: String` - `status: :completed` - `:completed` - `install_url: String` - `object: :build_target` - `:build_target` - `status: :not_started | :codegen | :postgen | :completed` - `:not_started` - `:codegen` - `:postgen` - `:completed` - `build: CheckStep` - `class NotStarted` - `status: :not_started` - `:not_started` - `class Queued` - `status: :queued` - `:queued` - `url: String` - `class InProgress` - `status: :in_progress` - `:in_progress` - `url: String` - `class Completed` - `completed: { conclusion, url}` deprecated - `conclusion: :success | :failure | :skipped | 4 more` - `:success` - `:failure` - `:skipped` - `:cancelled` - `:action_required` - `:neutral` - `:timed_out` - `url: String` - `conclusion: :success | :failure | :skipped | 4 more` - `:success` - `:failure` - `:skipped` - `:cancelled` - `:action_required` - `:neutral` - `:timed_out` - `status: :completed` - `:completed` - `url: String` - `lint: CheckStep` - `test_: CheckStep` - `csharp: BuildTarget` - `go: BuildTarget` - `java: BuildTarget` - `kotlin: BuildTarget` - `node: BuildTarget` - `openapi: BuildTarget` - `php: BuildTarget` - `python: BuildTarget` - `ruby: BuildTarget` - `sql: BuildTarget` - `terraform: BuildTarget` - `typescript: BuildTarget` - `updated_at: Time` - `object: :project_branch` - `:project_branch` - `org: String` - `project: String` Project name ### Example ```ruby require "stainless_v0" stainless = StainlessV0::Client.new( api_key: "My API Key", environment: "staging" # defaults to "production" ) project_branch = stainless.projects.branches.create(project: "project", branch: "branch", branch_from: "branch_from") puts(project_branch) ``` #### Response ```json { "branch": "branch", "config_commit": { "repo": { "branch": "branch", "host": "host", "name": "name", "owner": "owner" }, "sha": "sha", "stats": { "additions": 0, "deletions": 0, "total": 0 }, "tree_oid": "tree_oid" }, "latest_build": { "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" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "csharp": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "go": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "java": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "kotlin": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "node": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "openapi": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "php": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "python": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "ruby": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "sql": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "terraform": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "typescript": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } } }, "updated_at": "2019-12-27T18:11:19.117Z" }, "object": "project_branch", "org": "org", "project": "project" } ``` ## Retrieve a project branch `projects.branches.retrieve(branch, **kwargs) -> ProjectBranch` **get** `/v0/projects/{project}/branches/{branch}` Retrieve a project branch by name. ### Parameters - `project: String` - `branch: String` ### Returns - `class ProjectBranch` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: String` Branch name - `config_commit: { repo, sha, stats, tree_oid}` A Git commit that points to the latest set of config files on a given branch. - `repo: { branch, host, name, owner}` - `branch: String` - `host: String` - `name: String` - `owner: String` - `sha: String` - `stats: { additions, deletions, total}` - `additions: Integer` - `deletions: Integer` - `total: Integer` - `tree_oid: String` - `latest_build: Build` - `id: String` Build ID - `config_commit: String` - `created_at: Time` - `documented_spec: { content, type} | { expires, type, url}` - `class UnionMember0` - `content: String` - `type: :content` - `:content` - `class UnionMember1` - `expires: Time` - `type: :url` - `:url` - `url: String` - `object: :build` - `:build` - `org: String` - `project: String` - `targets: { cli, csharp, go, 10 more}` - `cli: BuildTarget` - `commit: { status} | { status} | { status} | { commit, completed, completed_at, 3 more}` - `class NotStarted` - `status: :not_started` - `:not_started` - `class Queued` - `status: :queued` - `:queued` - `class InProgress` - `status: :in_progress` - `:in_progress` - `class Completed` - `commit: Commit` - `repo: { branch, host, name, owner}` - `branch: String` - `host: String` - `name: String` - `owner: String` - `sha: String` - `stats: { additions, deletions, total}` - `additions: Integer` - `deletions: Integer` - `total: Integer` - `tree_oid: String` - `completed: { commit, completed_at, conclusion, merge_conflict_pr}` deprecated - `commit: Commit` - `completed_at: Time` - `conclusion: :error | :warning | :note | 9 more` - `:error` - `:warning` - `:note` - `:success` - `:merge_conflict` - `:upstream_merge_conflict` - `:fatal` - `:payment_required` - `:cancelled` - `:timed_out` - `:noop` - `:version_bump` - `merge_conflict_pr: { number, repo}` - `number: Float` - `repo: { host, name, owner}` - `host: String` - `name: String` - `owner: String` - `completed_at: Time` - `conclusion: :error | :warning | :note | 9 more` - `:error` - `:warning` - `:note` - `:success` - `:merge_conflict` - `:upstream_merge_conflict` - `:fatal` - `:payment_required` - `:cancelled` - `:timed_out` - `:noop` - `:version_bump` - `merge_conflict_pr: { number, repo}` - `number: Float` - `repo: { host, name, owner}` - `host: String` - `name: String` - `owner: String` - `status: :completed` - `:completed` - `install_url: String` - `object: :build_target` - `:build_target` - `status: :not_started | :codegen | :postgen | :completed` - `:not_started` - `:codegen` - `:postgen` - `:completed` - `build: CheckStep` - `class NotStarted` - `status: :not_started` - `:not_started` - `class Queued` - `status: :queued` - `:queued` - `url: String` - `class InProgress` - `status: :in_progress` - `:in_progress` - `url: String` - `class Completed` - `completed: { conclusion, url}` deprecated - `conclusion: :success | :failure | :skipped | 4 more` - `:success` - `:failure` - `:skipped` - `:cancelled` - `:action_required` - `:neutral` - `:timed_out` - `url: String` - `conclusion: :success | :failure | :skipped | 4 more` - `:success` - `:failure` - `:skipped` - `:cancelled` - `:action_required` - `:neutral` - `:timed_out` - `status: :completed` - `:completed` - `url: String` - `lint: CheckStep` - `test_: CheckStep` - `csharp: BuildTarget` - `go: BuildTarget` - `java: BuildTarget` - `kotlin: BuildTarget` - `node: BuildTarget` - `openapi: BuildTarget` - `php: BuildTarget` - `python: BuildTarget` - `ruby: BuildTarget` - `sql: BuildTarget` - `terraform: BuildTarget` - `typescript: BuildTarget` - `updated_at: Time` - `object: :project_branch` - `:project_branch` - `org: String` - `project: String` Project name ### Example ```ruby require "stainless_v0" stainless = StainlessV0::Client.new( api_key: "My API Key", environment: "staging" # defaults to "production" ) project_branch = stainless.projects.branches.retrieve("branch", project: "project") puts(project_branch) ``` #### Response ```json { "branch": "branch", "config_commit": { "repo": { "branch": "branch", "host": "host", "name": "name", "owner": "owner" }, "sha": "sha", "stats": { "additions": 0, "deletions": 0, "total": 0 }, "tree_oid": "tree_oid" }, "latest_build": { "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" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "csharp": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "go": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "java": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "kotlin": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "node": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "openapi": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "php": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "python": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "ruby": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "sql": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "terraform": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "typescript": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } } }, "updated_at": "2019-12-27T18:11:19.117Z" }, "object": "project_branch", "org": "org", "project": "project" } ``` ## List project branches `projects.branches.list(**kwargs) -> Page` **get** `/v0/projects/{project}/branches` Retrieve a project branch by name. ### Parameters - `project: String` - `cursor: String` Pagination cursor from a previous response - `limit: Float` Maximum number of items to return, defaults to 10 (maximum: 100). ### Returns - `class BranchListResponse` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: String` Branch name - `config_commit: { repo, sha, stats, tree_oid}` A Git commit that points to the latest set of config files on a given branch. - `repo: { branch, host, name, owner}` - `branch: String` - `host: String` - `name: String` - `owner: String` - `sha: String` - `stats: { additions, deletions, total}` - `additions: Integer` - `deletions: Integer` - `total: Integer` - `tree_oid: String` - `latest_build_id: String` - `object: :project_branch` - `:project_branch` - `org: String` - `project: String` Project name ### Example ```ruby require "stainless_v0" stainless = StainlessV0::Client.new( api_key: "My API Key", environment: "staging" # defaults to "production" ) page = stainless.projects.branches.list(project: "project") puts(page) ``` #### Response ```json { "data": [ { "branch": "branch", "config_commit": { "repo": { "branch": "branch", "host": "host", "name": "name", "owner": "owner" }, "sha": "sha", "stats": { "additions": 0, "deletions": 0, "total": 0 }, "tree_oid": "tree_oid" }, "latest_build_id": "latest_build_id", "object": "project_branch", "org": "org", "project": "project" } ], "has_more": true, "next_cursor": "next_cursor" } ``` ## Delete a project branch `projects.branches.delete(branch, **kwargs) -> BranchDeleteResponse` **delete** `/v0/projects/{project}/branches/{branch}` Delete a project branch by name. ### Parameters - `project: String` - `branch: String` ### Returns - `untyped` ### Example ```ruby require "stainless_v0" stainless = StainlessV0::Client.new( api_key: "My API Key", environment: "staging" # defaults to "production" ) branch = stainless.projects.branches.delete("branch", project: "project") puts(branch) ``` #### Response ```json {} ``` ## Rebase a project branch `projects.branches.rebase(branch, **kwargs) -> ProjectBranch` **put** `/v0/projects/{project}/branches/{branch}/rebase` Rebase a project branch. The branch is rebased onto the `base` branch or commit SHA, inheriting any config and custom code changes. ### Parameters - `project: String` - `branch: String` - `base: String` The branch or commit SHA to rebase onto. Defaults to "main". ### Returns - `class ProjectBranch` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: String` Branch name - `config_commit: { repo, sha, stats, tree_oid}` A Git commit that points to the latest set of config files on a given branch. - `repo: { branch, host, name, owner}` - `branch: String` - `host: String` - `name: String` - `owner: String` - `sha: String` - `stats: { additions, deletions, total}` - `additions: Integer` - `deletions: Integer` - `total: Integer` - `tree_oid: String` - `latest_build: Build` - `id: String` Build ID - `config_commit: String` - `created_at: Time` - `documented_spec: { content, type} | { expires, type, url}` - `class UnionMember0` - `content: String` - `type: :content` - `:content` - `class UnionMember1` - `expires: Time` - `type: :url` - `:url` - `url: String` - `object: :build` - `:build` - `org: String` - `project: String` - `targets: { cli, csharp, go, 10 more}` - `cli: BuildTarget` - `commit: { status} | { status} | { status} | { commit, completed, completed_at, 3 more}` - `class NotStarted` - `status: :not_started` - `:not_started` - `class Queued` - `status: :queued` - `:queued` - `class InProgress` - `status: :in_progress` - `:in_progress` - `class Completed` - `commit: Commit` - `repo: { branch, host, name, owner}` - `branch: String` - `host: String` - `name: String` - `owner: String` - `sha: String` - `stats: { additions, deletions, total}` - `additions: Integer` - `deletions: Integer` - `total: Integer` - `tree_oid: String` - `completed: { commit, completed_at, conclusion, merge_conflict_pr}` deprecated - `commit: Commit` - `completed_at: Time` - `conclusion: :error | :warning | :note | 9 more` - `:error` - `:warning` - `:note` - `:success` - `:merge_conflict` - `:upstream_merge_conflict` - `:fatal` - `:payment_required` - `:cancelled` - `:timed_out` - `:noop` - `:version_bump` - `merge_conflict_pr: { number, repo}` - `number: Float` - `repo: { host, name, owner}` - `host: String` - `name: String` - `owner: String` - `completed_at: Time` - `conclusion: :error | :warning | :note | 9 more` - `:error` - `:warning` - `:note` - `:success` - `:merge_conflict` - `:upstream_merge_conflict` - `:fatal` - `:payment_required` - `:cancelled` - `:timed_out` - `:noop` - `:version_bump` - `merge_conflict_pr: { number, repo}` - `number: Float` - `repo: { host, name, owner}` - `host: String` - `name: String` - `owner: String` - `status: :completed` - `:completed` - `install_url: String` - `object: :build_target` - `:build_target` - `status: :not_started | :codegen | :postgen | :completed` - `:not_started` - `:codegen` - `:postgen` - `:completed` - `build: CheckStep` - `class NotStarted` - `status: :not_started` - `:not_started` - `class Queued` - `status: :queued` - `:queued` - `url: String` - `class InProgress` - `status: :in_progress` - `:in_progress` - `url: String` - `class Completed` - `completed: { conclusion, url}` deprecated - `conclusion: :success | :failure | :skipped | 4 more` - `:success` - `:failure` - `:skipped` - `:cancelled` - `:action_required` - `:neutral` - `:timed_out` - `url: String` - `conclusion: :success | :failure | :skipped | 4 more` - `:success` - `:failure` - `:skipped` - `:cancelled` - `:action_required` - `:neutral` - `:timed_out` - `status: :completed` - `:completed` - `url: String` - `lint: CheckStep` - `test_: CheckStep` - `csharp: BuildTarget` - `go: BuildTarget` - `java: BuildTarget` - `kotlin: BuildTarget` - `node: BuildTarget` - `openapi: BuildTarget` - `php: BuildTarget` - `python: BuildTarget` - `ruby: BuildTarget` - `sql: BuildTarget` - `terraform: BuildTarget` - `typescript: BuildTarget` - `updated_at: Time` - `object: :project_branch` - `:project_branch` - `org: String` - `project: String` Project name ### Example ```ruby require "stainless_v0" stainless = StainlessV0::Client.new( api_key: "My API Key", environment: "staging" # defaults to "production" ) project_branch = stainless.projects.branches.rebase("branch", project: "project") puts(project_branch) ``` #### Response ```json { "branch": "branch", "config_commit": { "repo": { "branch": "branch", "host": "host", "name": "name", "owner": "owner" }, "sha": "sha", "stats": { "additions": 0, "deletions": 0, "total": 0 }, "tree_oid": "tree_oid" }, "latest_build": { "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" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "csharp": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "go": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "java": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "kotlin": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "node": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "openapi": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "php": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "python": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "ruby": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "sql": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "terraform": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "typescript": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } } }, "updated_at": "2019-12-27T18:11:19.117Z" }, "object": "project_branch", "org": "org", "project": "project" } ``` ## Reset `projects.branches.reset(branch, **kwargs) -> ProjectBranch` **put** `/v0/projects/{project}/branches/{branch}/reset` Reset a project branch. If `branch` === `main`, the branch is reset to `target_config_sha`. Otherwise, the branch is reset to `main`. ### Parameters - `project: String` - `branch: String` - `target_config_sha: String` The commit SHA to reset the main branch to. Required if resetting the main branch; disallowed otherwise. ### Returns - `class ProjectBranch` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: String` Branch name - `config_commit: { repo, sha, stats, tree_oid}` A Git commit that points to the latest set of config files on a given branch. - `repo: { branch, host, name, owner}` - `branch: String` - `host: String` - `name: String` - `owner: String` - `sha: String` - `stats: { additions, deletions, total}` - `additions: Integer` - `deletions: Integer` - `total: Integer` - `tree_oid: String` - `latest_build: Build` - `id: String` Build ID - `config_commit: String` - `created_at: Time` - `documented_spec: { content, type} | { expires, type, url}` - `class UnionMember0` - `content: String` - `type: :content` - `:content` - `class UnionMember1` - `expires: Time` - `type: :url` - `:url` - `url: String` - `object: :build` - `:build` - `org: String` - `project: String` - `targets: { cli, csharp, go, 10 more}` - `cli: BuildTarget` - `commit: { status} | { status} | { status} | { commit, completed, completed_at, 3 more}` - `class NotStarted` - `status: :not_started` - `:not_started` - `class Queued` - `status: :queued` - `:queued` - `class InProgress` - `status: :in_progress` - `:in_progress` - `class Completed` - `commit: Commit` - `repo: { branch, host, name, owner}` - `branch: String` - `host: String` - `name: String` - `owner: String` - `sha: String` - `stats: { additions, deletions, total}` - `additions: Integer` - `deletions: Integer` - `total: Integer` - `tree_oid: String` - `completed: { commit, completed_at, conclusion, merge_conflict_pr}` deprecated - `commit: Commit` - `completed_at: Time` - `conclusion: :error | :warning | :note | 9 more` - `:error` - `:warning` - `:note` - `:success` - `:merge_conflict` - `:upstream_merge_conflict` - `:fatal` - `:payment_required` - `:cancelled` - `:timed_out` - `:noop` - `:version_bump` - `merge_conflict_pr: { number, repo}` - `number: Float` - `repo: { host, name, owner}` - `host: String` - `name: String` - `owner: String` - `completed_at: Time` - `conclusion: :error | :warning | :note | 9 more` - `:error` - `:warning` - `:note` - `:success` - `:merge_conflict` - `:upstream_merge_conflict` - `:fatal` - `:payment_required` - `:cancelled` - `:timed_out` - `:noop` - `:version_bump` - `merge_conflict_pr: { number, repo}` - `number: Float` - `repo: { host, name, owner}` - `host: String` - `name: String` - `owner: String` - `status: :completed` - `:completed` - `install_url: String` - `object: :build_target` - `:build_target` - `status: :not_started | :codegen | :postgen | :completed` - `:not_started` - `:codegen` - `:postgen` - `:completed` - `build: CheckStep` - `class NotStarted` - `status: :not_started` - `:not_started` - `class Queued` - `status: :queued` - `:queued` - `url: String` - `class InProgress` - `status: :in_progress` - `:in_progress` - `url: String` - `class Completed` - `completed: { conclusion, url}` deprecated - `conclusion: :success | :failure | :skipped | 4 more` - `:success` - `:failure` - `:skipped` - `:cancelled` - `:action_required` - `:neutral` - `:timed_out` - `url: String` - `conclusion: :success | :failure | :skipped | 4 more` - `:success` - `:failure` - `:skipped` - `:cancelled` - `:action_required` - `:neutral` - `:timed_out` - `status: :completed` - `:completed` - `url: String` - `lint: CheckStep` - `test_: CheckStep` - `csharp: BuildTarget` - `go: BuildTarget` - `java: BuildTarget` - `kotlin: BuildTarget` - `node: BuildTarget` - `openapi: BuildTarget` - `php: BuildTarget` - `python: BuildTarget` - `ruby: BuildTarget` - `sql: BuildTarget` - `terraform: BuildTarget` - `typescript: BuildTarget` - `updated_at: Time` - `object: :project_branch` - `:project_branch` - `org: String` - `project: String` Project name ### Example ```ruby require "stainless_v0" stainless = StainlessV0::Client.new( api_key: "My API Key", environment: "staging" # defaults to "production" ) project_branch = stainless.projects.branches.reset("branch", project: "project") puts(project_branch) ``` #### Response ```json { "branch": "branch", "config_commit": { "repo": { "branch": "branch", "host": "host", "name": "name", "owner": "owner" }, "sha": "sha", "stats": { "additions": 0, "deletions": 0, "total": 0 }, "tree_oid": "tree_oid" }, "latest_build": { "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" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "csharp": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "go": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "java": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "kotlin": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "node": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "openapi": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "php": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "python": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "ruby": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "sql": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "terraform": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "typescript": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } } }, "updated_at": "2019-12-27T18:11:19.117Z" }, "object": "project_branch", "org": "org", "project": "project" } ``` ## Domain Types ### Project Branch - `class ProjectBranch` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: String` Branch name - `config_commit: { repo, sha, stats, tree_oid}` A Git commit that points to the latest set of config files on a given branch. - `repo: { branch, host, name, owner}` - `branch: String` - `host: String` - `name: String` - `owner: String` - `sha: String` - `stats: { additions, deletions, total}` - `additions: Integer` - `deletions: Integer` - `total: Integer` - `tree_oid: String` - `latest_build: Build` - `id: String` Build ID - `config_commit: String` - `created_at: Time` - `documented_spec: { content, type} | { expires, type, url}` - `class UnionMember0` - `content: String` - `type: :content` - `:content` - `class UnionMember1` - `expires: Time` - `type: :url` - `:url` - `url: String` - `object: :build` - `:build` - `org: String` - `project: String` - `targets: { cli, csharp, go, 10 more}` - `cli: BuildTarget` - `commit: { status} | { status} | { status} | { commit, completed, completed_at, 3 more}` - `class NotStarted` - `status: :not_started` - `:not_started` - `class Queued` - `status: :queued` - `:queued` - `class InProgress` - `status: :in_progress` - `:in_progress` - `class Completed` - `commit: Commit` - `repo: { branch, host, name, owner}` - `branch: String` - `host: String` - `name: String` - `owner: String` - `sha: String` - `stats: { additions, deletions, total}` - `additions: Integer` - `deletions: Integer` - `total: Integer` - `tree_oid: String` - `completed: { commit, completed_at, conclusion, merge_conflict_pr}` deprecated - `commit: Commit` - `completed_at: Time` - `conclusion: :error | :warning | :note | 9 more` - `:error` - `:warning` - `:note` - `:success` - `:merge_conflict` - `:upstream_merge_conflict` - `:fatal` - `:payment_required` - `:cancelled` - `:timed_out` - `:noop` - `:version_bump` - `merge_conflict_pr: { number, repo}` - `number: Float` - `repo: { host, name, owner}` - `host: String` - `name: String` - `owner: String` - `completed_at: Time` - `conclusion: :error | :warning | :note | 9 more` - `:error` - `:warning` - `:note` - `:success` - `:merge_conflict` - `:upstream_merge_conflict` - `:fatal` - `:payment_required` - `:cancelled` - `:timed_out` - `:noop` - `:version_bump` - `merge_conflict_pr: { number, repo}` - `number: Float` - `repo: { host, name, owner}` - `host: String` - `name: String` - `owner: String` - `status: :completed` - `:completed` - `install_url: String` - `object: :build_target` - `:build_target` - `status: :not_started | :codegen | :postgen | :completed` - `:not_started` - `:codegen` - `:postgen` - `:completed` - `build: CheckStep` - `class NotStarted` - `status: :not_started` - `:not_started` - `class Queued` - `status: :queued` - `:queued` - `url: String` - `class InProgress` - `status: :in_progress` - `:in_progress` - `url: String` - `class Completed` - `completed: { conclusion, url}` deprecated - `conclusion: :success | :failure | :skipped | 4 more` - `:success` - `:failure` - `:skipped` - `:cancelled` - `:action_required` - `:neutral` - `:timed_out` - `url: String` - `conclusion: :success | :failure | :skipped | 4 more` - `:success` - `:failure` - `:skipped` - `:cancelled` - `:action_required` - `:neutral` - `:timed_out` - `status: :completed` - `:completed` - `url: String` - `lint: CheckStep` - `test_: CheckStep` - `csharp: BuildTarget` - `go: BuildTarget` - `java: BuildTarget` - `kotlin: BuildTarget` - `node: BuildTarget` - `openapi: BuildTarget` - `php: BuildTarget` - `python: BuildTarget` - `ruby: BuildTarget` - `sql: BuildTarget` - `terraform: BuildTarget` - `typescript: BuildTarget` - `updated_at: Time` - `object: :project_branch` - `:project_branch` - `org: String` - `project: String` Project name ### Branch List Response - `class BranchListResponse` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: String` Branch name - `config_commit: { repo, sha, stats, tree_oid}` A Git commit that points to the latest set of config files on a given branch. - `repo: { branch, host, name, owner}` - `branch: String` - `host: String` - `name: String` - `owner: String` - `sha: String` - `stats: { additions, deletions, total}` - `additions: Integer` - `deletions: Integer` - `total: Integer` - `tree_oid: String` - `latest_build_id: String` - `object: :project_branch` - `:project_branch` - `org: String` - `project: String` Project name ### Branch Delete Response - `untyped`