# Branches ## Create a new project branch `client.projects.branches.create(BranchCreateParamsparams, RequestOptionsoptions?): 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 - `params: BranchCreateParams` - `project?: string` Path param - `branch: string` Body param: Branch name - `branch_from: string` Body param: Branch or commit SHA to branch from - `force?: boolean` Body param: Whether to throw an error if the branch already exists. Defaults to false. ### Returns - `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: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: Repo` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: Stats | null` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string | null` - `latest_build: Build | null` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: UnionMember0 | UnionMember1 | null` - `UnionMember0` - `content: string` - `type: "content"` - `"content"` - `UnionMember1` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: Targets` - `cli?: BuildTarget` - `commit: NotStarted | Queued | InProgress | Completed` - `NotStarted` - `status: "not_started"` - `"not_started"` - `Queued` - `status: "queued"` - `"queued"` - `InProgress` - `status: "in_progress"` - `"in_progress"` - `Completed` - `commit: Commit | null` - `repo: Repo` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: Stats | null` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string | null` - `completed: Completed` deprecated - `commit: Commit | null` - `completed_at: string` - `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: MergeConflictPr | null` - `number: number` - `repo: Repo` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `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: MergeConflictPr | null` - `number: number` - `repo: Repo` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string | null` - `object: "build_target"` - `"build_target"` - `status: "not_started" | "codegen" | "postgen" | "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build?: CheckStep` - `NotStarted` - `status: "not_started"` - `"not_started"` - `Queued` - `status: "queued"` - `"queued"` - `url: string | null` - `InProgress` - `status: "in_progress"` - `"in_progress"` - `url: string | null` - `Completed` - `completed: Completed` deprecated - `conclusion: "success" | "failure" | "skipped" | 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string | null` - `conclusion: "success" | "failure" | "skipped" | 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string | null` - `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: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```typescript import Stainless from '@stainless-api/sdk'; const client = new Stainless({ apiKey: process.env['STAINLESS_API_KEY'], // This is the default and can be omitted }); const projectBranch = await client.projects.branches.create({ project: 'project', branch: 'branch', branch_from: 'branch_from', }); console.log(projectBranch.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 `client.projects.branches.retrieve(stringbranch, BranchRetrieveParamsparams?, RequestOptionsoptions?): ProjectBranch` **get** `/v0/projects/{project}/branches/{branch}` Retrieve a project branch by name. ### Parameters - `branch: string` - `params: BranchRetrieveParams` - `project?: string` ### Returns - `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: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: Repo` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: Stats | null` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string | null` - `latest_build: Build | null` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: UnionMember0 | UnionMember1 | null` - `UnionMember0` - `content: string` - `type: "content"` - `"content"` - `UnionMember1` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: Targets` - `cli?: BuildTarget` - `commit: NotStarted | Queued | InProgress | Completed` - `NotStarted` - `status: "not_started"` - `"not_started"` - `Queued` - `status: "queued"` - `"queued"` - `InProgress` - `status: "in_progress"` - `"in_progress"` - `Completed` - `commit: Commit | null` - `repo: Repo` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: Stats | null` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string | null` - `completed: Completed` deprecated - `commit: Commit | null` - `completed_at: string` - `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: MergeConflictPr | null` - `number: number` - `repo: Repo` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `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: MergeConflictPr | null` - `number: number` - `repo: Repo` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string | null` - `object: "build_target"` - `"build_target"` - `status: "not_started" | "codegen" | "postgen" | "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build?: CheckStep` - `NotStarted` - `status: "not_started"` - `"not_started"` - `Queued` - `status: "queued"` - `"queued"` - `url: string | null` - `InProgress` - `status: "in_progress"` - `"in_progress"` - `url: string | null` - `Completed` - `completed: Completed` deprecated - `conclusion: "success" | "failure" | "skipped" | 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string | null` - `conclusion: "success" | "failure" | "skipped" | 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string | null` - `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: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```typescript import Stainless from '@stainless-api/sdk'; const client = new Stainless({ apiKey: process.env['STAINLESS_API_KEY'], // This is the default and can be omitted }); const projectBranch = await client.projects.branches.retrieve('branch', { project: 'project' }); console.log(projectBranch.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 `client.projects.branches.list(BranchListParamsparams?, RequestOptionsoptions?): Page` **get** `/v0/projects/{project}/branches` Retrieve a project branch by name. ### Parameters - `params: BranchListParams` - `project?: string` Path param - `cursor?: string` Query param: Pagination cursor from a previous response - `limit?: number` Query param: Maximum number of items to return, defaults to 10 (maximum: 100). ### Returns - `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: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: Repo` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: Stats | null` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string | null` - `latest_build_id: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```typescript import Stainless from '@stainless-api/sdk'; const client = new Stainless({ apiKey: process.env['STAINLESS_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const branchListResponse of client.projects.branches.list({ project: 'project' })) { console.log(branchListResponse.latest_build_id); } ``` #### 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 `client.projects.branches.delete(stringbranch, BranchDeleteParamsparams?, RequestOptionsoptions?): BranchDeleteResponse` **delete** `/v0/projects/{project}/branches/{branch}` Delete a project branch by name. ### Parameters - `branch: string` - `params: BranchDeleteParams` - `project?: string` ### Returns - `BranchDeleteResponse = unknown` ### Example ```typescript import Stainless from '@stainless-api/sdk'; const client = new Stainless({ apiKey: process.env['STAINLESS_API_KEY'], // This is the default and can be omitted }); const branch = await client.projects.branches.delete('branch', { project: 'project' }); console.log(branch); ``` #### Response ```json {} ``` ## Rebase a project branch `client.projects.branches.rebase(stringbranch, BranchRebaseParamsparams?, RequestOptionsoptions?): 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 - `branch: string` - `params: BranchRebaseParams` - `project?: string` Path param - `base?: string` Query param: The branch or commit SHA to rebase onto. Defaults to "main". ### Returns - `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: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: Repo` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: Stats | null` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string | null` - `latest_build: Build | null` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: UnionMember0 | UnionMember1 | null` - `UnionMember0` - `content: string` - `type: "content"` - `"content"` - `UnionMember1` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: Targets` - `cli?: BuildTarget` - `commit: NotStarted | Queued | InProgress | Completed` - `NotStarted` - `status: "not_started"` - `"not_started"` - `Queued` - `status: "queued"` - `"queued"` - `InProgress` - `status: "in_progress"` - `"in_progress"` - `Completed` - `commit: Commit | null` - `repo: Repo` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: Stats | null` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string | null` - `completed: Completed` deprecated - `commit: Commit | null` - `completed_at: string` - `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: MergeConflictPr | null` - `number: number` - `repo: Repo` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `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: MergeConflictPr | null` - `number: number` - `repo: Repo` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string | null` - `object: "build_target"` - `"build_target"` - `status: "not_started" | "codegen" | "postgen" | "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build?: CheckStep` - `NotStarted` - `status: "not_started"` - `"not_started"` - `Queued` - `status: "queued"` - `"queued"` - `url: string | null` - `InProgress` - `status: "in_progress"` - `"in_progress"` - `url: string | null` - `Completed` - `completed: Completed` deprecated - `conclusion: "success" | "failure" | "skipped" | 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string | null` - `conclusion: "success" | "failure" | "skipped" | 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string | null` - `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: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```typescript import Stainless from '@stainless-api/sdk'; const client = new Stainless({ apiKey: process.env['STAINLESS_API_KEY'], // This is the default and can be omitted }); const projectBranch = await client.projects.branches.rebase('branch', { project: 'project' }); console.log(projectBranch.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 `client.projects.branches.reset(stringbranch, BranchResetParamsparams?, RequestOptionsoptions?): 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 - `branch: string` - `params: BranchResetParams` - `project?: string` Path param - `target_config_sha?: string` Query param: The commit SHA to reset the main branch to. Required if resetting the main branch; disallowed otherwise. ### Returns - `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: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: Repo` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: Stats | null` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string | null` - `latest_build: Build | null` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: UnionMember0 | UnionMember1 | null` - `UnionMember0` - `content: string` - `type: "content"` - `"content"` - `UnionMember1` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: Targets` - `cli?: BuildTarget` - `commit: NotStarted | Queued | InProgress | Completed` - `NotStarted` - `status: "not_started"` - `"not_started"` - `Queued` - `status: "queued"` - `"queued"` - `InProgress` - `status: "in_progress"` - `"in_progress"` - `Completed` - `commit: Commit | null` - `repo: Repo` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: Stats | null` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string | null` - `completed: Completed` deprecated - `commit: Commit | null` - `completed_at: string` - `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: MergeConflictPr | null` - `number: number` - `repo: Repo` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `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: MergeConflictPr | null` - `number: number` - `repo: Repo` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string | null` - `object: "build_target"` - `"build_target"` - `status: "not_started" | "codegen" | "postgen" | "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build?: CheckStep` - `NotStarted` - `status: "not_started"` - `"not_started"` - `Queued` - `status: "queued"` - `"queued"` - `url: string | null` - `InProgress` - `status: "in_progress"` - `"in_progress"` - `url: string | null` - `Completed` - `completed: Completed` deprecated - `conclusion: "success" | "failure" | "skipped" | 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string | null` - `conclusion: "success" | "failure" | "skipped" | 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string | null` - `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: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```typescript import Stainless from '@stainless-api/sdk'; const client = new Stainless({ apiKey: process.env['STAINLESS_API_KEY'], // This is the default and can be omitted }); const projectBranch = await client.projects.branches.reset('branch', { project: 'project' }); console.log(projectBranch.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 - `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: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: Repo` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: Stats | null` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string | null` - `latest_build: Build | null` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: UnionMember0 | UnionMember1 | null` - `UnionMember0` - `content: string` - `type: "content"` - `"content"` - `UnionMember1` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: Targets` - `cli?: BuildTarget` - `commit: NotStarted | Queued | InProgress | Completed` - `NotStarted` - `status: "not_started"` - `"not_started"` - `Queued` - `status: "queued"` - `"queued"` - `InProgress` - `status: "in_progress"` - `"in_progress"` - `Completed` - `commit: Commit | null` - `repo: Repo` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: Stats | null` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string | null` - `completed: Completed` deprecated - `commit: Commit | null` - `completed_at: string` - `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: MergeConflictPr | null` - `number: number` - `repo: Repo` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `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: MergeConflictPr | null` - `number: number` - `repo: Repo` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string | null` - `object: "build_target"` - `"build_target"` - `status: "not_started" | "codegen" | "postgen" | "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build?: CheckStep` - `NotStarted` - `status: "not_started"` - `"not_started"` - `Queued` - `status: "queued"` - `"queued"` - `url: string | null` - `InProgress` - `status: "in_progress"` - `"in_progress"` - `url: string | null` - `Completed` - `completed: Completed` deprecated - `conclusion: "success" | "failure" | "skipped" | 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string | null` - `conclusion: "success" | "failure" | "skipped" | 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string | null` - `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: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Branch List Response - `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: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: Repo` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: Stats | null` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string | null` - `latest_build_id: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Branch Delete Response - `BranchDeleteResponse = unknown`