# Projects ## Retrieve project `client.projects.retrieve(ProjectRetrieveParamsparams?, RequestOptionsoptions?): Project` **get** `/v0/projects/{project}` Retrieve a project by name. ### Parameters - `params: ProjectRetrieveParams` - `project?: string` ### Returns - `Project` A project is a collection of SDKs generated from the same set of config files. - `config_repo: string` - `display_name: string | null` - `object: "project"` - `"project"` - `org: string` - `slug: string` - `targets: Array` - `"node"` - `"typescript"` - `"python"` - `"go"` - `"java"` - `"kotlin"` - `"ruby"` - `"terraform"` - `"cli"` - `"php"` - `"csharp"` - `"sql"` - `"openapi"` ### 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 project = await client.projects.retrieve({ project: 'project' }); console.log(project.config_repo); ``` #### Response ```json { "config_repo": "config_repo", "display_name": "display_name", "object": "project", "org": "org", "slug": "slug", "targets": [ "node" ] } ``` ## Update project `client.projects.update(ProjectUpdateParamsparams?, RequestOptionsoptions?): Project` **patch** `/v0/projects/{project}` Update a project's properties. ### Parameters - `params: ProjectUpdateParams` - `project?: string` Path param - `display_name?: string | null` Body param ### Returns - `Project` A project is a collection of SDKs generated from the same set of config files. - `config_repo: string` - `display_name: string | null` - `object: "project"` - `"project"` - `org: string` - `slug: string` - `targets: Array` - `"node"` - `"typescript"` - `"python"` - `"go"` - `"java"` - `"kotlin"` - `"ruby"` - `"terraform"` - `"cli"` - `"php"` - `"csharp"` - `"sql"` - `"openapi"` ### 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 project = await client.projects.update({ project: 'project' }); console.log(project.config_repo); ``` #### Response ```json { "config_repo": "config_repo", "display_name": "display_name", "object": "project", "org": "org", "slug": "slug", "targets": [ "node" ] } ``` ## List projects `client.projects.list(ProjectListParamsquery?, RequestOptionsoptions?): Page` **get** `/v0/projects` List projects in an organization, from oldest to newest. ### Parameters - `query: ProjectListParams` - `cursor?: string` Pagination cursor from a previous response - `limit?: number` Maximum number of projects to return, defaults to 10 (maximum: 100). - `org?: string` ### Returns - `Project` A project is a collection of SDKs generated from the same set of config files. - `config_repo: string` - `display_name: string | null` - `object: "project"` - `"project"` - `org: string` - `slug: string` - `targets: Array` - `"node"` - `"typescript"` - `"python"` - `"go"` - `"java"` - `"kotlin"` - `"ruby"` - `"terraform"` - `"cli"` - `"php"` - `"csharp"` - `"sql"` - `"openapi"` ### 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 project of client.projects.list()) { console.log(project.config_repo); } ``` #### Response ```json { "data": [ { "config_repo": "config_repo", "display_name": "display_name", "object": "project", "org": "org", "slug": "slug", "targets": [ "node" ] } ], "has_more": true, "next_cursor": "next_cursor" } ``` ## Create project `client.projects.create(ProjectCreateParamsbody, RequestOptionsoptions?): Project` **post** `/v0/projects` Create a new project. ### Parameters - `body: ProjectCreateParams` - `display_name: string` Human-readable project name - `org: string` Organization name - `revision: Record` File contents to commit - `Content` - `content: string` File content - `URL` - `url: string` URL to fetch file content from - `slug: string` Project name/slug - `targets: Array` Targets to generate for - `"node"` - `"typescript"` - `"python"` - `"go"` - `"java"` - `"kotlin"` - `"ruby"` - `"terraform"` - `"cli"` - `"php"` - `"csharp"` - `"sql"` - `"openapi"` ### Returns - `Project` A project is a collection of SDKs generated from the same set of config files. - `config_repo: string` - `display_name: string | null` - `object: "project"` - `"project"` - `org: string` - `slug: string` - `targets: Array` - `"node"` - `"typescript"` - `"python"` - `"go"` - `"java"` - `"kotlin"` - `"ruby"` - `"terraform"` - `"cli"` - `"php"` - `"csharp"` - `"sql"` - `"openapi"` ### 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 project = await client.projects.create({ display_name: 'display_name', org: 'org', revision: { foo: { content: 'content' } }, slug: 'slug', targets: ['node'], }); console.log(project.config_repo); ``` #### Response ```json { "config_repo": "config_repo", "display_name": "display_name", "object": "project", "org": "org", "slug": "slug", "targets": [ "node" ] } ``` ## Generate an AI commit message for a specific SDK `client.projects.generateCommitMessage(ProjectGenerateCommitMessageParamsparams, RequestOptionsoptions?): ProjectGenerateCommitMessageResponse` **post** `/v0/projects/{project}/generate_commit_message` Generates an AI commit message by comparing two git refs in the SDK repository. ### Parameters - `params: ProjectGenerateCommitMessageParams` - `project?: string` Path param - `target: "python" | "node" | "typescript" | 10 more` Query param: Language target - `"python"` - `"node"` - `"typescript"` - `"java"` - `"kotlin"` - `"go"` - `"ruby"` - `"terraform"` - `"cli"` - `"csharp"` - `"php"` - `"openapi"` - `"sql"` - `base_ref: string` Body param: Base ref for comparison - `head_ref: string` Body param: Head ref for comparison ### Returns - `ProjectGenerateCommitMessageResponse` - `ai_commit_message: string` ### 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 response = await client.projects.generateCommitMessage({ project: 'project', target: 'python', base_ref: 'base_ref', head_ref: 'head_ref', }); console.log(response.ai_commit_message); ``` #### Response ```json { "ai_commit_message": "ai_commit_message" } ``` ## Domain Types ### Project - `Project` A project is a collection of SDKs generated from the same set of config files. - `config_repo: string` - `display_name: string | null` - `object: "project"` - `"project"` - `org: string` - `slug: string` - `targets: Array` - `"node"` - `"typescript"` - `"python"` - `"go"` - `"java"` - `"kotlin"` - `"ruby"` - `"terraform"` - `"cli"` - `"php"` - `"csharp"` - `"sql"` - `"openapi"` ### Project Generate Commit Message Response - `ProjectGenerateCommitMessageResponse` - `ai_commit_message: string` # 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` # Configs ## Retrieve configuration files `client.projects.configs.retrieve(ConfigRetrieveParamsparams?, RequestOptionsoptions?): ConfigRetrieveResponse` **get** `/v0/projects/{project}/configs` Retrieve the configuration files for a given project. ### Parameters - `params: ConfigRetrieveParams` - `project?: string` Path param - `branch?: string` Query param: Branch name, defaults to "main". - `include?: string` Query param ### Returns - `ConfigRetrieveResponse = Record` Config files contents - `content: string` The file content ### 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 config = await client.projects.configs.retrieve({ project: 'project' }); console.log(config); ``` #### Response ```json { "foo": { "content": "content" } } ``` ## Generate config suggestions `client.projects.configs.guess(ConfigGuessParamsparams, RequestOptionsoptions?): ConfigGuessResponse` **post** `/v0/projects/{project}/configs/guess` Generate suggestions for changes to config files based on an OpenAPI spec. ### Parameters - `params: ConfigGuessParams` - `project?: string` Path param - `spec: string` Body param: OpenAPI spec - `branch?: string` Body param: Branch name ### Returns - `ConfigGuessResponse = Record` Config files contents - `content: string` The file content ### 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 response = await client.projects.configs.guess({ project: 'project', spec: 'spec' }); console.log(response); ``` #### Response ```json { "foo": { "content": "content" } } ``` ## Domain Types ### Config Retrieve Response - `ConfigRetrieveResponse = Record` Config files contents - `content: string` The file content ### Config Guess Response - `ConfigGuessResponse = Record` Config files contents - `content: string` The file content