# Branches ## Create a new project branch `projects.branches.create(BranchCreateParams**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: Optional[str]` - `branch: str` Branch name - `branch_from: str` Branch or commit SHA to branch from - `force: Optional[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: str` Branch name - `config_commit: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: ConfigCommitRepo` - `branch: str` - `host: str` - `name: str` - `owner: str` - `sha: str` - `stats: Optional[ConfigCommitStats]` - `additions: int` - `deletions: int` - `total: int` - `tree_oid: Optional[str]` - `latest_build: Optional[Build]` - `id: str` Build ID - `config_commit: str` - `created_at: datetime` - `documented_spec: Optional[DocumentedSpec]` - `class DocumentedSpecUnionMember0: …` - `content: str` - `type: Literal["content"]` - `"content"` - `class DocumentedSpecUnionMember1: …` - `expires: datetime` - `type: Literal["url"]` - `"url"` - `url: str` - `object: Literal["build"]` - `"build"` - `org: str` - `project: str` - `targets: Targets` - `cli: Optional[BuildTarget]` - `commit: Commit` - `class CommitNotStarted: …` - `status: Literal["not_started"]` - `"not_started"` - `class CommitQueued: …` - `status: Literal["queued"]` - `"queued"` - `class CommitInProgress: …` - `status: Literal["in_progress"]` - `"in_progress"` - `class CommitCompleted: …` - `commit: Optional[Commit]` - `repo: Repo` - `branch: str` - `host: str` - `name: str` - `owner: str` - `sha: str` - `stats: Optional[Stats]` - `additions: int` - `deletions: int` - `total: int` - `tree_oid: Optional[str]` - `completed: CommitCompletedCompleted` deprecated - `commit: Optional[Commit]` - `completed_at: datetime` - `conclusion: Literal["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: Optional[CommitCompletedCompletedMergeConflictPr]` - `number: float` - `repo: CommitCompletedCompletedMergeConflictPrRepo` - `host: str` - `name: str` - `owner: str` - `completed_at: datetime` - `conclusion: Literal["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: Optional[CommitCompletedMergeConflictPr]` - `number: float` - `repo: CommitCompletedMergeConflictPrRepo` - `host: str` - `name: str` - `owner: str` - `status: Literal["completed"]` - `"completed"` - `install_url: Optional[str]` - `object: Literal["build_target"]` - `"build_target"` - `status: Literal["not_started", "codegen", "postgen", "completed"]` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: Optional[CheckStep]` - `class NotStarted: …` - `status: Literal["not_started"]` - `"not_started"` - `class Queued: …` - `status: Literal["queued"]` - `"queued"` - `url: Optional[str]` - `class InProgress: …` - `status: Literal["in_progress"]` - `"in_progress"` - `url: Optional[str]` - `class Completed: …` - `completed: CompletedCompleted` deprecated - `conclusion: Literal["success", "failure", "skipped", 4 more]` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: Optional[str]` - `conclusion: Literal["success", "failure", "skipped", 4 more]` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: Literal["completed"]` - `"completed"` - `url: Optional[str]` - `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: datetime` - `object: Literal["project_branch"]` - `"project_branch"` - `org: str` - `project: str` Project name ### Example ```python import os from stainless_v0 import Stainless client = Stainless( api_key=os.environ.get("STAINLESS_API_KEY"), # This is the default and can be omitted ) project_branch = client.projects.branches.create( project="project", branch="branch", branch_from="branch_from", ) print(project_branch.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(strbranch, BranchRetrieveParams**kwargs) -> ProjectBranch` **get** `/v0/projects/{project}/branches/{branch}` Retrieve a project branch by name. ### Parameters - `project: Optional[str]` - `branch: str` ### 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: str` Branch name - `config_commit: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: ConfigCommitRepo` - `branch: str` - `host: str` - `name: str` - `owner: str` - `sha: str` - `stats: Optional[ConfigCommitStats]` - `additions: int` - `deletions: int` - `total: int` - `tree_oid: Optional[str]` - `latest_build: Optional[Build]` - `id: str` Build ID - `config_commit: str` - `created_at: datetime` - `documented_spec: Optional[DocumentedSpec]` - `class DocumentedSpecUnionMember0: …` - `content: str` - `type: Literal["content"]` - `"content"` - `class DocumentedSpecUnionMember1: …` - `expires: datetime` - `type: Literal["url"]` - `"url"` - `url: str` - `object: Literal["build"]` - `"build"` - `org: str` - `project: str` - `targets: Targets` - `cli: Optional[BuildTarget]` - `commit: Commit` - `class CommitNotStarted: …` - `status: Literal["not_started"]` - `"not_started"` - `class CommitQueued: …` - `status: Literal["queued"]` - `"queued"` - `class CommitInProgress: …` - `status: Literal["in_progress"]` - `"in_progress"` - `class CommitCompleted: …` - `commit: Optional[Commit]` - `repo: Repo` - `branch: str` - `host: str` - `name: str` - `owner: str` - `sha: str` - `stats: Optional[Stats]` - `additions: int` - `deletions: int` - `total: int` - `tree_oid: Optional[str]` - `completed: CommitCompletedCompleted` deprecated - `commit: Optional[Commit]` - `completed_at: datetime` - `conclusion: Literal["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: Optional[CommitCompletedCompletedMergeConflictPr]` - `number: float` - `repo: CommitCompletedCompletedMergeConflictPrRepo` - `host: str` - `name: str` - `owner: str` - `completed_at: datetime` - `conclusion: Literal["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: Optional[CommitCompletedMergeConflictPr]` - `number: float` - `repo: CommitCompletedMergeConflictPrRepo` - `host: str` - `name: str` - `owner: str` - `status: Literal["completed"]` - `"completed"` - `install_url: Optional[str]` - `object: Literal["build_target"]` - `"build_target"` - `status: Literal["not_started", "codegen", "postgen", "completed"]` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: Optional[CheckStep]` - `class NotStarted: …` - `status: Literal["not_started"]` - `"not_started"` - `class Queued: …` - `status: Literal["queued"]` - `"queued"` - `url: Optional[str]` - `class InProgress: …` - `status: Literal["in_progress"]` - `"in_progress"` - `url: Optional[str]` - `class Completed: …` - `completed: CompletedCompleted` deprecated - `conclusion: Literal["success", "failure", "skipped", 4 more]` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: Optional[str]` - `conclusion: Literal["success", "failure", "skipped", 4 more]` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: Literal["completed"]` - `"completed"` - `url: Optional[str]` - `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: datetime` - `object: Literal["project_branch"]` - `"project_branch"` - `org: str` - `project: str` Project name ### Example ```python import os from stainless_v0 import Stainless client = Stainless( api_key=os.environ.get("STAINLESS_API_KEY"), # This is the default and can be omitted ) project_branch = client.projects.branches.retrieve( branch="branch", project="project", ) print(project_branch.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(BranchListParams**kwargs) -> SyncPage[BranchListResponse]` **get** `/v0/projects/{project}/branches` Retrieve a project branch by name. ### Parameters - `project: Optional[str]` - `cursor: Optional[str]` Pagination cursor from a previous response - `limit: Optional[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: str` Branch name - `config_commit: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: ConfigCommitRepo` - `branch: str` - `host: str` - `name: str` - `owner: str` - `sha: str` - `stats: Optional[ConfigCommitStats]` - `additions: int` - `deletions: int` - `total: int` - `tree_oid: Optional[str]` - `latest_build_id: str` - `object: Literal["project_branch"]` - `"project_branch"` - `org: str` - `project: str` Project name ### Example ```python import os from stainless_v0 import Stainless client = Stainless( api_key=os.environ.get("STAINLESS_API_KEY"), # This is the default and can be omitted ) page = client.projects.branches.list( project="project", ) page = page.data[0] print(page.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 `projects.branches.delete(strbranch, BranchDeleteParams**kwargs) -> object` **delete** `/v0/projects/{project}/branches/{branch}` Delete a project branch by name. ### Parameters - `project: Optional[str]` - `branch: str` ### Returns - `object` ### Example ```python import os from stainless_v0 import Stainless client = Stainless( api_key=os.environ.get("STAINLESS_API_KEY"), # This is the default and can be omitted ) branch = client.projects.branches.delete( branch="branch", project="project", ) print(branch) ``` #### Response ```json {} ``` ## Rebase a project branch `projects.branches.rebase(strbranch, BranchRebaseParams**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: Optional[str]` - `branch: str` - `base: Optional[str]` 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: str` Branch name - `config_commit: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: ConfigCommitRepo` - `branch: str` - `host: str` - `name: str` - `owner: str` - `sha: str` - `stats: Optional[ConfigCommitStats]` - `additions: int` - `deletions: int` - `total: int` - `tree_oid: Optional[str]` - `latest_build: Optional[Build]` - `id: str` Build ID - `config_commit: str` - `created_at: datetime` - `documented_spec: Optional[DocumentedSpec]` - `class DocumentedSpecUnionMember0: …` - `content: str` - `type: Literal["content"]` - `"content"` - `class DocumentedSpecUnionMember1: …` - `expires: datetime` - `type: Literal["url"]` - `"url"` - `url: str` - `object: Literal["build"]` - `"build"` - `org: str` - `project: str` - `targets: Targets` - `cli: Optional[BuildTarget]` - `commit: Commit` - `class CommitNotStarted: …` - `status: Literal["not_started"]` - `"not_started"` - `class CommitQueued: …` - `status: Literal["queued"]` - `"queued"` - `class CommitInProgress: …` - `status: Literal["in_progress"]` - `"in_progress"` - `class CommitCompleted: …` - `commit: Optional[Commit]` - `repo: Repo` - `branch: str` - `host: str` - `name: str` - `owner: str` - `sha: str` - `stats: Optional[Stats]` - `additions: int` - `deletions: int` - `total: int` - `tree_oid: Optional[str]` - `completed: CommitCompletedCompleted` deprecated - `commit: Optional[Commit]` - `completed_at: datetime` - `conclusion: Literal["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: Optional[CommitCompletedCompletedMergeConflictPr]` - `number: float` - `repo: CommitCompletedCompletedMergeConflictPrRepo` - `host: str` - `name: str` - `owner: str` - `completed_at: datetime` - `conclusion: Literal["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: Optional[CommitCompletedMergeConflictPr]` - `number: float` - `repo: CommitCompletedMergeConflictPrRepo` - `host: str` - `name: str` - `owner: str` - `status: Literal["completed"]` - `"completed"` - `install_url: Optional[str]` - `object: Literal["build_target"]` - `"build_target"` - `status: Literal["not_started", "codegen", "postgen", "completed"]` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: Optional[CheckStep]` - `class NotStarted: …` - `status: Literal["not_started"]` - `"not_started"` - `class Queued: …` - `status: Literal["queued"]` - `"queued"` - `url: Optional[str]` - `class InProgress: …` - `status: Literal["in_progress"]` - `"in_progress"` - `url: Optional[str]` - `class Completed: …` - `completed: CompletedCompleted` deprecated - `conclusion: Literal["success", "failure", "skipped", 4 more]` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: Optional[str]` - `conclusion: Literal["success", "failure", "skipped", 4 more]` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: Literal["completed"]` - `"completed"` - `url: Optional[str]` - `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: datetime` - `object: Literal["project_branch"]` - `"project_branch"` - `org: str` - `project: str` Project name ### Example ```python import os from stainless_v0 import Stainless client = Stainless( api_key=os.environ.get("STAINLESS_API_KEY"), # This is the default and can be omitted ) project_branch = client.projects.branches.rebase( branch="branch", project="project", ) print(project_branch.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(strbranch, BranchResetParams**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: Optional[str]` - `branch: str` - `target_config_sha: Optional[str]` 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: str` Branch name - `config_commit: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: ConfigCommitRepo` - `branch: str` - `host: str` - `name: str` - `owner: str` - `sha: str` - `stats: Optional[ConfigCommitStats]` - `additions: int` - `deletions: int` - `total: int` - `tree_oid: Optional[str]` - `latest_build: Optional[Build]` - `id: str` Build ID - `config_commit: str` - `created_at: datetime` - `documented_spec: Optional[DocumentedSpec]` - `class DocumentedSpecUnionMember0: …` - `content: str` - `type: Literal["content"]` - `"content"` - `class DocumentedSpecUnionMember1: …` - `expires: datetime` - `type: Literal["url"]` - `"url"` - `url: str` - `object: Literal["build"]` - `"build"` - `org: str` - `project: str` - `targets: Targets` - `cli: Optional[BuildTarget]` - `commit: Commit` - `class CommitNotStarted: …` - `status: Literal["not_started"]` - `"not_started"` - `class CommitQueued: …` - `status: Literal["queued"]` - `"queued"` - `class CommitInProgress: …` - `status: Literal["in_progress"]` - `"in_progress"` - `class CommitCompleted: …` - `commit: Optional[Commit]` - `repo: Repo` - `branch: str` - `host: str` - `name: str` - `owner: str` - `sha: str` - `stats: Optional[Stats]` - `additions: int` - `deletions: int` - `total: int` - `tree_oid: Optional[str]` - `completed: CommitCompletedCompleted` deprecated - `commit: Optional[Commit]` - `completed_at: datetime` - `conclusion: Literal["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: Optional[CommitCompletedCompletedMergeConflictPr]` - `number: float` - `repo: CommitCompletedCompletedMergeConflictPrRepo` - `host: str` - `name: str` - `owner: str` - `completed_at: datetime` - `conclusion: Literal["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: Optional[CommitCompletedMergeConflictPr]` - `number: float` - `repo: CommitCompletedMergeConflictPrRepo` - `host: str` - `name: str` - `owner: str` - `status: Literal["completed"]` - `"completed"` - `install_url: Optional[str]` - `object: Literal["build_target"]` - `"build_target"` - `status: Literal["not_started", "codegen", "postgen", "completed"]` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: Optional[CheckStep]` - `class NotStarted: …` - `status: Literal["not_started"]` - `"not_started"` - `class Queued: …` - `status: Literal["queued"]` - `"queued"` - `url: Optional[str]` - `class InProgress: …` - `status: Literal["in_progress"]` - `"in_progress"` - `url: Optional[str]` - `class Completed: …` - `completed: CompletedCompleted` deprecated - `conclusion: Literal["success", "failure", "skipped", 4 more]` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: Optional[str]` - `conclusion: Literal["success", "failure", "skipped", 4 more]` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: Literal["completed"]` - `"completed"` - `url: Optional[str]` - `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: datetime` - `object: Literal["project_branch"]` - `"project_branch"` - `org: str` - `project: str` Project name ### Example ```python import os from stainless_v0 import Stainless client = Stainless( api_key=os.environ.get("STAINLESS_API_KEY"), # This is the default and can be omitted ) project_branch = client.projects.branches.reset( branch="branch", project="project", ) print(project_branch.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: str` Branch name - `config_commit: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: ConfigCommitRepo` - `branch: str` - `host: str` - `name: str` - `owner: str` - `sha: str` - `stats: Optional[ConfigCommitStats]` - `additions: int` - `deletions: int` - `total: int` - `tree_oid: Optional[str]` - `latest_build: Optional[Build]` - `id: str` Build ID - `config_commit: str` - `created_at: datetime` - `documented_spec: Optional[DocumentedSpec]` - `class DocumentedSpecUnionMember0: …` - `content: str` - `type: Literal["content"]` - `"content"` - `class DocumentedSpecUnionMember1: …` - `expires: datetime` - `type: Literal["url"]` - `"url"` - `url: str` - `object: Literal["build"]` - `"build"` - `org: str` - `project: str` - `targets: Targets` - `cli: Optional[BuildTarget]` - `commit: Commit` - `class CommitNotStarted: …` - `status: Literal["not_started"]` - `"not_started"` - `class CommitQueued: …` - `status: Literal["queued"]` - `"queued"` - `class CommitInProgress: …` - `status: Literal["in_progress"]` - `"in_progress"` - `class CommitCompleted: …` - `commit: Optional[Commit]` - `repo: Repo` - `branch: str` - `host: str` - `name: str` - `owner: str` - `sha: str` - `stats: Optional[Stats]` - `additions: int` - `deletions: int` - `total: int` - `tree_oid: Optional[str]` - `completed: CommitCompletedCompleted` deprecated - `commit: Optional[Commit]` - `completed_at: datetime` - `conclusion: Literal["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: Optional[CommitCompletedCompletedMergeConflictPr]` - `number: float` - `repo: CommitCompletedCompletedMergeConflictPrRepo` - `host: str` - `name: str` - `owner: str` - `completed_at: datetime` - `conclusion: Literal["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: Optional[CommitCompletedMergeConflictPr]` - `number: float` - `repo: CommitCompletedMergeConflictPrRepo` - `host: str` - `name: str` - `owner: str` - `status: Literal["completed"]` - `"completed"` - `install_url: Optional[str]` - `object: Literal["build_target"]` - `"build_target"` - `status: Literal["not_started", "codegen", "postgen", "completed"]` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: Optional[CheckStep]` - `class NotStarted: …` - `status: Literal["not_started"]` - `"not_started"` - `class Queued: …` - `status: Literal["queued"]` - `"queued"` - `url: Optional[str]` - `class InProgress: …` - `status: Literal["in_progress"]` - `"in_progress"` - `url: Optional[str]` - `class Completed: …` - `completed: CompletedCompleted` deprecated - `conclusion: Literal["success", "failure", "skipped", 4 more]` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: Optional[str]` - `conclusion: Literal["success", "failure", "skipped", 4 more]` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: Literal["completed"]` - `"completed"` - `url: Optional[str]` - `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: datetime` - `object: Literal["project_branch"]` - `"project_branch"` - `org: str` - `project: str` 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: str` Branch name - `config_commit: ConfigCommit` A Git commit that points to the latest set of config files on a given branch. - `repo: ConfigCommitRepo` - `branch: str` - `host: str` - `name: str` - `owner: str` - `sha: str` - `stats: Optional[ConfigCommitStats]` - `additions: int` - `deletions: int` - `total: int` - `tree_oid: Optional[str]` - `latest_build_id: str` - `object: Literal["project_branch"]` - `"project_branch"` - `org: str` - `project: str` Project name