# Branches ## Create a new project branch **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. ### Path Parameters - `project: optional string` ### Body Parameters - `branch: string` Branch name - `branch_from: string` Branch or commit SHA to branch from - `force: optional boolean` Whether to throw an error if the branch already exists. Defaults to false. ### Returns - `ProjectBranch = object { branch, config_commit, latest_build, 3 more }` 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: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build: Build` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: object { content, type } or object { expires, type, url }` - `object { content, type }` - `content: string` - `type: "content"` - `"content"` - `object { expires, type, url }` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: object { cli, csharp, go, 10 more }` - `cli: optional BuildTarget` - `commit: object { status } or object { status } or object { status } or object { commit, completed, completed_at, 3 more }` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status }` - `status: "queued"` - `"queued"` - `InProgress = object { status }` - `status: "in_progress"` - `"in_progress"` - `Completed = object { commit, completed, completed_at, 3 more }` - `commit: Commit` - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `completed: object { commit, completed_at, conclusion, merge_conflict_pr }` deprecated - `commit: Commit` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string` - `object: "build_target"` - `"build_target"` - `status: "not_started" or "codegen" or "postgen" or "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: optional CheckStep` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status, url }` - `status: "queued"` - `"queued"` - `url: string` - `InProgress = object { status, url }` - `status: "in_progress"` - `"in_progress"` - `url: string` - `Completed = object { completed, conclusion, status, url }` - `completed: object { conclusion, url }` deprecated - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string` - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string` - `lint: optional CheckStep` - `test: optional CheckStep` - `csharp: optional BuildTarget` - `go: optional BuildTarget` - `java: optional BuildTarget` - `kotlin: optional BuildTarget` - `node: optional BuildTarget` - `openapi: optional BuildTarget` - `php: optional BuildTarget` - `python: optional BuildTarget` - `ruby: optional BuildTarget` - `sql: optional BuildTarget` - `terraform: optional BuildTarget` - `typescript: optional BuildTarget` - `updated_at: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/branches \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $STAINLESS_API_KEY" \ -d '{ "branch": "branch", "branch_from": "branch_from" }' ``` #### 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 **get** `/v0/projects/{project}/branches/{branch}` Retrieve a project branch by name. ### Path Parameters - `project: optional string` - `branch: string` ### Returns - `ProjectBranch = object { branch, config_commit, latest_build, 3 more }` 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: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build: Build` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: object { content, type } or object { expires, type, url }` - `object { content, type }` - `content: string` - `type: "content"` - `"content"` - `object { expires, type, url }` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: object { cli, csharp, go, 10 more }` - `cli: optional BuildTarget` - `commit: object { status } or object { status } or object { status } or object { commit, completed, completed_at, 3 more }` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status }` - `status: "queued"` - `"queued"` - `InProgress = object { status }` - `status: "in_progress"` - `"in_progress"` - `Completed = object { commit, completed, completed_at, 3 more }` - `commit: Commit` - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `completed: object { commit, completed_at, conclusion, merge_conflict_pr }` deprecated - `commit: Commit` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string` - `object: "build_target"` - `"build_target"` - `status: "not_started" or "codegen" or "postgen" or "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: optional CheckStep` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status, url }` - `status: "queued"` - `"queued"` - `url: string` - `InProgress = object { status, url }` - `status: "in_progress"` - `"in_progress"` - `url: string` - `Completed = object { completed, conclusion, status, url }` - `completed: object { conclusion, url }` deprecated - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string` - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string` - `lint: optional CheckStep` - `test: optional CheckStep` - `csharp: optional BuildTarget` - `go: optional BuildTarget` - `java: optional BuildTarget` - `kotlin: optional BuildTarget` - `node: optional BuildTarget` - `openapi: optional BuildTarget` - `php: optional BuildTarget` - `python: optional BuildTarget` - `ruby: optional BuildTarget` - `sql: optional BuildTarget` - `terraform: optional BuildTarget` - `typescript: optional BuildTarget` - `updated_at: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/branches/$BRANCH \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### 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 **get** `/v0/projects/{project}/branches` Retrieve a project branch by name. ### Path Parameters - `project: optional string` ### Query Parameters - `cursor: optional string` Pagination cursor from a previous response - `limit: optional number` Maximum number of items to return, defaults to 10 (maximum: 100). ### Returns - `data: array of object { branch, config_commit, latest_build_id, 3 more }` - `branch: string` Branch name - `config_commit: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build_id: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name - `has_more: boolean` - `next_cursor: optional string` ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/branches \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### 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 **delete** `/v0/projects/{project}/branches/{branch}` Delete a project branch by name. ### Path Parameters - `project: optional string` - `branch: string` ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/branches/$BRANCH \ -X DELETE \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### Response ```json {} ``` ## Rebase a project branch **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. ### Path Parameters - `project: optional string` - `branch: string` ### Query Parameters - `base: optional string` The branch or commit SHA to rebase onto. Defaults to "main". ### Returns - `ProjectBranch = object { branch, config_commit, latest_build, 3 more }` 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: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build: Build` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: object { content, type } or object { expires, type, url }` - `object { content, type }` - `content: string` - `type: "content"` - `"content"` - `object { expires, type, url }` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: object { cli, csharp, go, 10 more }` - `cli: optional BuildTarget` - `commit: object { status } or object { status } or object { status } or object { commit, completed, completed_at, 3 more }` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status }` - `status: "queued"` - `"queued"` - `InProgress = object { status }` - `status: "in_progress"` - `"in_progress"` - `Completed = object { commit, completed, completed_at, 3 more }` - `commit: Commit` - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `completed: object { commit, completed_at, conclusion, merge_conflict_pr }` deprecated - `commit: Commit` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string` - `object: "build_target"` - `"build_target"` - `status: "not_started" or "codegen" or "postgen" or "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: optional CheckStep` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status, url }` - `status: "queued"` - `"queued"` - `url: string` - `InProgress = object { status, url }` - `status: "in_progress"` - `"in_progress"` - `url: string` - `Completed = object { completed, conclusion, status, url }` - `completed: object { conclusion, url }` deprecated - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string` - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string` - `lint: optional CheckStep` - `test: optional CheckStep` - `csharp: optional BuildTarget` - `go: optional BuildTarget` - `java: optional BuildTarget` - `kotlin: optional BuildTarget` - `node: optional BuildTarget` - `openapi: optional BuildTarget` - `php: optional BuildTarget` - `python: optional BuildTarget` - `ruby: optional BuildTarget` - `sql: optional BuildTarget` - `terraform: optional BuildTarget` - `typescript: optional BuildTarget` - `updated_at: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/branches/$BRANCH/rebase \ -X PUT \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### 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 **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`. ### Path Parameters - `project: optional string` - `branch: string` ### Query Parameters - `target_config_sha: optional string` The commit SHA to reset the main branch to. Required if resetting the main branch; disallowed otherwise. ### Returns - `ProjectBranch = object { branch, config_commit, latest_build, 3 more }` 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: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build: Build` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: object { content, type } or object { expires, type, url }` - `object { content, type }` - `content: string` - `type: "content"` - `"content"` - `object { expires, type, url }` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: object { cli, csharp, go, 10 more }` - `cli: optional BuildTarget` - `commit: object { status } or object { status } or object { status } or object { commit, completed, completed_at, 3 more }` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status }` - `status: "queued"` - `"queued"` - `InProgress = object { status }` - `status: "in_progress"` - `"in_progress"` - `Completed = object { commit, completed, completed_at, 3 more }` - `commit: Commit` - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `completed: object { commit, completed_at, conclusion, merge_conflict_pr }` deprecated - `commit: Commit` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string` - `object: "build_target"` - `"build_target"` - `status: "not_started" or "codegen" or "postgen" or "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: optional CheckStep` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status, url }` - `status: "queued"` - `"queued"` - `url: string` - `InProgress = object { status, url }` - `status: "in_progress"` - `"in_progress"` - `url: string` - `Completed = object { completed, conclusion, status, url }` - `completed: object { conclusion, url }` deprecated - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string` - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string` - `lint: optional CheckStep` - `test: optional CheckStep` - `csharp: optional BuildTarget` - `go: optional BuildTarget` - `java: optional BuildTarget` - `kotlin: optional BuildTarget` - `node: optional BuildTarget` - `openapi: optional BuildTarget` - `php: optional BuildTarget` - `python: optional BuildTarget` - `ruby: optional BuildTarget` - `sql: optional BuildTarget` - `terraform: optional BuildTarget` - `typescript: optional BuildTarget` - `updated_at: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/branches/$BRANCH/reset \ -X PUT \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### 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 - `ProjectBranch = object { branch, config_commit, latest_build, 3 more }` 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: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build: Build` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: object { content, type } or object { expires, type, url }` - `object { content, type }` - `content: string` - `type: "content"` - `"content"` - `object { expires, type, url }` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: object { cli, csharp, go, 10 more }` - `cli: optional BuildTarget` - `commit: object { status } or object { status } or object { status } or object { commit, completed, completed_at, 3 more }` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status }` - `status: "queued"` - `"queued"` - `InProgress = object { status }` - `status: "in_progress"` - `"in_progress"` - `Completed = object { commit, completed, completed_at, 3 more }` - `commit: Commit` - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `completed: object { commit, completed_at, conclusion, merge_conflict_pr }` deprecated - `commit: Commit` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string` - `object: "build_target"` - `"build_target"` - `status: "not_started" or "codegen" or "postgen" or "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: optional CheckStep` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status, url }` - `status: "queued"` - `"queued"` - `url: string` - `InProgress = object { status, url }` - `status: "in_progress"` - `"in_progress"` - `url: string` - `Completed = object { completed, conclusion, status, url }` - `completed: object { conclusion, url }` deprecated - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string` - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string` - `lint: optional CheckStep` - `test: optional CheckStep` - `csharp: optional BuildTarget` - `go: optional BuildTarget` - `java: optional BuildTarget` - `kotlin: optional BuildTarget` - `node: optional BuildTarget` - `openapi: optional BuildTarget` - `php: optional BuildTarget` - `python: optional BuildTarget` - `ruby: optional BuildTarget` - `sql: optional BuildTarget` - `terraform: optional BuildTarget` - `typescript: optional BuildTarget` - `updated_at: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Branch List Response - `BranchListResponse = object { branch, config_commit, latest_build_id, 3 more }` 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: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build_id: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Branch Delete Response - `BranchDeleteResponse = unknown`