# Projects ## Retrieve project **get** `/v0/projects/{project}` Retrieve a project by name. ### Path Parameters - `project: optional string` ### Returns - `Project = object { config_repo, display_name, object, 3 more }` A project is a collection of SDKs generated from the same set of config files. - `config_repo: string` - `display_name: string` - `object: "project"` - `"project"` - `org: string` - `slug: string` - `targets: array of Target` - `"node"` - `"typescript"` - `"python"` - `"go"` - `"java"` - `"kotlin"` - `"ruby"` - `"terraform"` - `"cli"` - `"php"` - `"csharp"` - `"sql"` - `"openapi"` ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### Response ```json { "config_repo": "config_repo", "display_name": "display_name", "object": "project", "org": "org", "slug": "slug", "targets": [ "node" ] } ``` ## Update project **patch** `/v0/projects/{project}` Update a project's properties. ### Path Parameters - `project: optional string` ### Body Parameters - `display_name: optional string` ### Returns - `Project = object { config_repo, display_name, object, 3 more }` A project is a collection of SDKs generated from the same set of config files. - `config_repo: string` - `display_name: string` - `object: "project"` - `"project"` - `org: string` - `slug: string` - `targets: array of Target` - `"node"` - `"typescript"` - `"python"` - `"go"` - `"java"` - `"kotlin"` - `"ruby"` - `"terraform"` - `"cli"` - `"php"` - `"csharp"` - `"sql"` - `"openapi"` ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT \ -X PATCH \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### Response ```json { "config_repo": "config_repo", "display_name": "display_name", "object": "project", "org": "org", "slug": "slug", "targets": [ "node" ] } ``` ## List projects **get** `/v0/projects` List projects in an organization, from oldest to newest. ### Query Parameters - `cursor: optional string` Pagination cursor from a previous response - `limit: optional number` Maximum number of projects to return, defaults to 10 (maximum: 100). - `org: optional string` ### Returns - `data: array of Project` - `config_repo: string` - `display_name: string` - `object: "project"` - `"project"` - `org: string` - `slug: string` - `targets: array of Target` - `"node"` - `"typescript"` - `"python"` - `"go"` - `"java"` - `"kotlin"` - `"ruby"` - `"terraform"` - `"cli"` - `"php"` - `"csharp"` - `"sql"` - `"openapi"` - `has_more: boolean` - `next_cursor: optional string` ### Example ```http curl https://api.stainless.com/v0/projects \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### 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 **post** `/v0/projects` Create a new project. ### Body Parameters - `display_name: string` Human-readable project name - `org: string` Organization name - `revision: map[FileInput]` File contents to commit - `Content = object { content }` - `content: string` File content - `URL = object { url }` - `url: string` URL to fetch file content from - `slug: string` Project name/slug - `targets: array of Target` Targets to generate for - `"node"` - `"typescript"` - `"python"` - `"go"` - `"java"` - `"kotlin"` - `"ruby"` - `"terraform"` - `"cli"` - `"php"` - `"csharp"` - `"sql"` - `"openapi"` ### Returns - `Project = object { config_repo, display_name, object, 3 more }` A project is a collection of SDKs generated from the same set of config files. - `config_repo: string` - `display_name: string` - `object: "project"` - `"project"` - `org: string` - `slug: string` - `targets: array of Target` - `"node"` - `"typescript"` - `"python"` - `"go"` - `"java"` - `"kotlin"` - `"ruby"` - `"terraform"` - `"cli"` - `"php"` - `"csharp"` - `"sql"` - `"openapi"` ### Example ```http curl https://api.stainless.com/v0/projects \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $STAINLESS_API_KEY" \ -d '{ "display_name": "display_name", "org": "org", "revision": { "foo": { "content": "content" } }, "slug": "slug", "targets": [ "node" ] }' ``` #### 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 **post** `/v0/projects/{project}/generate_commit_message` Generates an AI commit message by comparing two git refs in the SDK repository. ### Path Parameters - `project: optional string` ### Query Parameters - `target: "python" or "node" or "typescript" or 10 more` Language target - `"python"` - `"node"` - `"typescript"` - `"java"` - `"kotlin"` - `"go"` - `"ruby"` - `"terraform"` - `"cli"` - `"csharp"` - `"php"` - `"openapi"` - `"sql"` ### Body Parameters - `base_ref: string` Base ref for comparison - `head_ref: string` Head ref for comparison ### Returns - `ai_commit_message: string` ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/generate_commit_message \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $STAINLESS_API_KEY" \ -d '{ "base_ref": "base_ref", "head_ref": "head_ref" }' ``` #### Response ```json { "ai_commit_message": "ai_commit_message" } ``` ## Domain Types ### Project - `Project = object { config_repo, display_name, object, 3 more }` A project is a collection of SDKs generated from the same set of config files. - `config_repo: string` - `display_name: string` - `object: "project"` - `"project"` - `org: string` - `slug: string` - `targets: array of Target` - `"node"` - `"typescript"` - `"python"` - `"go"` - `"java"` - `"kotlin"` - `"ruby"` - `"terraform"` - `"cli"` - `"php"` - `"csharp"` - `"sql"` - `"openapi"` ### Project Generate Commit Message Response - `ProjectGenerateCommitMessageResponse = object { ai_commit_message }` - `ai_commit_message: string` # Branches ## Create a new project branch **post** `/v0/projects/{project}/branches` Create a new branch for a project. The branch inherits the config files from the revision pointed to by the `branch_from` parameter. In addition, if the revision is a branch name, the branch will also inherit custom code changes from that branch. ### Path Parameters - `project: optional string` ### Body Parameters - `branch: string` Branch name - `branch_from: string` Branch or commit SHA to branch from - `force: optional boolean` Whether to throw an error if the branch already exists. Defaults to false. ### Returns - `ProjectBranch = object { branch, config_commit, latest_build, 3 more }` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: string` Branch name - `config_commit: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build: Build` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: object { content, type } or object { expires, type, url }` - `object { content, type }` - `content: string` - `type: "content"` - `"content"` - `object { expires, type, url }` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: object { cli, csharp, go, 10 more }` - `cli: optional BuildTarget` - `commit: object { status } or object { status } or object { status } or object { commit, completed, completed_at, 3 more }` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status }` - `status: "queued"` - `"queued"` - `InProgress = object { status }` - `status: "in_progress"` - `"in_progress"` - `Completed = object { commit, completed, completed_at, 3 more }` - `commit: Commit` - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `completed: object { commit, completed_at, conclusion, merge_conflict_pr }` deprecated - `commit: Commit` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string` - `object: "build_target"` - `"build_target"` - `status: "not_started" or "codegen" or "postgen" or "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: optional CheckStep` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status, url }` - `status: "queued"` - `"queued"` - `url: string` - `InProgress = object { status, url }` - `status: "in_progress"` - `"in_progress"` - `url: string` - `Completed = object { completed, conclusion, status, url }` - `completed: object { conclusion, url }` deprecated - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string` - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string` - `lint: optional CheckStep` - `test: optional CheckStep` - `csharp: optional BuildTarget` - `go: optional BuildTarget` - `java: optional BuildTarget` - `kotlin: optional BuildTarget` - `node: optional BuildTarget` - `openapi: optional BuildTarget` - `php: optional BuildTarget` - `python: optional BuildTarget` - `ruby: optional BuildTarget` - `sql: optional BuildTarget` - `terraform: optional BuildTarget` - `typescript: optional BuildTarget` - `updated_at: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/branches \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $STAINLESS_API_KEY" \ -d '{ "branch": "branch", "branch_from": "branch_from" }' ``` #### Response ```json { "branch": "branch", "config_commit": { "repo": { "branch": "branch", "host": "host", "name": "name", "owner": "owner" }, "sha": "sha", "stats": { "additions": 0, "deletions": 0, "total": 0 }, "tree_oid": "tree_oid" }, "latest_build": { "id": "id", "config_commit": "config_commit", "created_at": "2019-12-27T18:11:19.117Z", "documented_spec": { "content": "content", "type": "content" }, "object": "build", "org": "org", "project": "project", "targets": { "cli": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "csharp": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "go": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "java": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "kotlin": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "node": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "openapi": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "php": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "python": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "ruby": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "sql": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "terraform": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "typescript": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } } }, "updated_at": "2019-12-27T18:11:19.117Z" }, "object": "project_branch", "org": "org", "project": "project" } ``` ## Retrieve a project branch **get** `/v0/projects/{project}/branches/{branch}` Retrieve a project branch by name. ### Path Parameters - `project: optional string` - `branch: string` ### Returns - `ProjectBranch = object { branch, config_commit, latest_build, 3 more }` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: string` Branch name - `config_commit: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build: Build` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: object { content, type } or object { expires, type, url }` - `object { content, type }` - `content: string` - `type: "content"` - `"content"` - `object { expires, type, url }` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: object { cli, csharp, go, 10 more }` - `cli: optional BuildTarget` - `commit: object { status } or object { status } or object { status } or object { commit, completed, completed_at, 3 more }` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status }` - `status: "queued"` - `"queued"` - `InProgress = object { status }` - `status: "in_progress"` - `"in_progress"` - `Completed = object { commit, completed, completed_at, 3 more }` - `commit: Commit` - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `completed: object { commit, completed_at, conclusion, merge_conflict_pr }` deprecated - `commit: Commit` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string` - `object: "build_target"` - `"build_target"` - `status: "not_started" or "codegen" or "postgen" or "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: optional CheckStep` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status, url }` - `status: "queued"` - `"queued"` - `url: string` - `InProgress = object { status, url }` - `status: "in_progress"` - `"in_progress"` - `url: string` - `Completed = object { completed, conclusion, status, url }` - `completed: object { conclusion, url }` deprecated - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string` - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string` - `lint: optional CheckStep` - `test: optional CheckStep` - `csharp: optional BuildTarget` - `go: optional BuildTarget` - `java: optional BuildTarget` - `kotlin: optional BuildTarget` - `node: optional BuildTarget` - `openapi: optional BuildTarget` - `php: optional BuildTarget` - `python: optional BuildTarget` - `ruby: optional BuildTarget` - `sql: optional BuildTarget` - `terraform: optional BuildTarget` - `typescript: optional BuildTarget` - `updated_at: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/branches/$BRANCH \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### Response ```json { "branch": "branch", "config_commit": { "repo": { "branch": "branch", "host": "host", "name": "name", "owner": "owner" }, "sha": "sha", "stats": { "additions": 0, "deletions": 0, "total": 0 }, "tree_oid": "tree_oid" }, "latest_build": { "id": "id", "config_commit": "config_commit", "created_at": "2019-12-27T18:11:19.117Z", "documented_spec": { "content": "content", "type": "content" }, "object": "build", "org": "org", "project": "project", "targets": { "cli": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "csharp": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "go": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "java": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "kotlin": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "node": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "openapi": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "php": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "python": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "ruby": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "sql": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "terraform": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "typescript": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } } }, "updated_at": "2019-12-27T18:11:19.117Z" }, "object": "project_branch", "org": "org", "project": "project" } ``` ## List project branches **get** `/v0/projects/{project}/branches` Retrieve a project branch by name. ### Path Parameters - `project: optional string` ### Query Parameters - `cursor: optional string` Pagination cursor from a previous response - `limit: optional number` Maximum number of items to return, defaults to 10 (maximum: 100). ### Returns - `data: array of object { branch, config_commit, latest_build_id, 3 more }` - `branch: string` Branch name - `config_commit: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build_id: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name - `has_more: boolean` - `next_cursor: optional string` ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/branches \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### Response ```json { "data": [ { "branch": "branch", "config_commit": { "repo": { "branch": "branch", "host": "host", "name": "name", "owner": "owner" }, "sha": "sha", "stats": { "additions": 0, "deletions": 0, "total": 0 }, "tree_oid": "tree_oid" }, "latest_build_id": "latest_build_id", "object": "project_branch", "org": "org", "project": "project" } ], "has_more": true, "next_cursor": "next_cursor" } ``` ## Delete a project branch **delete** `/v0/projects/{project}/branches/{branch}` Delete a project branch by name. ### Path Parameters - `project: optional string` - `branch: string` ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/branches/$BRANCH \ -X DELETE \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### Response ```json {} ``` ## Rebase a project branch **put** `/v0/projects/{project}/branches/{branch}/rebase` Rebase a project branch. The branch is rebased onto the `base` branch or commit SHA, inheriting any config and custom code changes. ### Path Parameters - `project: optional string` - `branch: string` ### Query Parameters - `base: optional string` The branch or commit SHA to rebase onto. Defaults to "main". ### Returns - `ProjectBranch = object { branch, config_commit, latest_build, 3 more }` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: string` Branch name - `config_commit: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build: Build` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: object { content, type } or object { expires, type, url }` - `object { content, type }` - `content: string` - `type: "content"` - `"content"` - `object { expires, type, url }` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: object { cli, csharp, go, 10 more }` - `cli: optional BuildTarget` - `commit: object { status } or object { status } or object { status } or object { commit, completed, completed_at, 3 more }` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status }` - `status: "queued"` - `"queued"` - `InProgress = object { status }` - `status: "in_progress"` - `"in_progress"` - `Completed = object { commit, completed, completed_at, 3 more }` - `commit: Commit` - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `completed: object { commit, completed_at, conclusion, merge_conflict_pr }` deprecated - `commit: Commit` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string` - `object: "build_target"` - `"build_target"` - `status: "not_started" or "codegen" or "postgen" or "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: optional CheckStep` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status, url }` - `status: "queued"` - `"queued"` - `url: string` - `InProgress = object { status, url }` - `status: "in_progress"` - `"in_progress"` - `url: string` - `Completed = object { completed, conclusion, status, url }` - `completed: object { conclusion, url }` deprecated - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string` - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string` - `lint: optional CheckStep` - `test: optional CheckStep` - `csharp: optional BuildTarget` - `go: optional BuildTarget` - `java: optional BuildTarget` - `kotlin: optional BuildTarget` - `node: optional BuildTarget` - `openapi: optional BuildTarget` - `php: optional BuildTarget` - `python: optional BuildTarget` - `ruby: optional BuildTarget` - `sql: optional BuildTarget` - `terraform: optional BuildTarget` - `typescript: optional BuildTarget` - `updated_at: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/branches/$BRANCH/rebase \ -X PUT \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### Response ```json { "branch": "branch", "config_commit": { "repo": { "branch": "branch", "host": "host", "name": "name", "owner": "owner" }, "sha": "sha", "stats": { "additions": 0, "deletions": 0, "total": 0 }, "tree_oid": "tree_oid" }, "latest_build": { "id": "id", "config_commit": "config_commit", "created_at": "2019-12-27T18:11:19.117Z", "documented_spec": { "content": "content", "type": "content" }, "object": "build", "org": "org", "project": "project", "targets": { "cli": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "csharp": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "go": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "java": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "kotlin": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "node": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "openapi": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "php": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "python": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "ruby": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "sql": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "terraform": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "typescript": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } } }, "updated_at": "2019-12-27T18:11:19.117Z" }, "object": "project_branch", "org": "org", "project": "project" } ``` ## Reset **put** `/v0/projects/{project}/branches/{branch}/reset` Reset a project branch. If `branch` === `main`, the branch is reset to `target_config_sha`. Otherwise, the branch is reset to `main`. ### Path Parameters - `project: optional string` - `branch: string` ### Query Parameters - `target_config_sha: optional string` The commit SHA to reset the main branch to. Required if resetting the main branch; disallowed otherwise. ### Returns - `ProjectBranch = object { branch, config_commit, latest_build, 3 more }` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: string` Branch name - `config_commit: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build: Build` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: object { content, type } or object { expires, type, url }` - `object { content, type }` - `content: string` - `type: "content"` - `"content"` - `object { expires, type, url }` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: object { cli, csharp, go, 10 more }` - `cli: optional BuildTarget` - `commit: object { status } or object { status } or object { status } or object { commit, completed, completed_at, 3 more }` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status }` - `status: "queued"` - `"queued"` - `InProgress = object { status }` - `status: "in_progress"` - `"in_progress"` - `Completed = object { commit, completed, completed_at, 3 more }` - `commit: Commit` - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `completed: object { commit, completed_at, conclusion, merge_conflict_pr }` deprecated - `commit: Commit` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string` - `object: "build_target"` - `"build_target"` - `status: "not_started" or "codegen" or "postgen" or "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: optional CheckStep` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status, url }` - `status: "queued"` - `"queued"` - `url: string` - `InProgress = object { status, url }` - `status: "in_progress"` - `"in_progress"` - `url: string` - `Completed = object { completed, conclusion, status, url }` - `completed: object { conclusion, url }` deprecated - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string` - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string` - `lint: optional CheckStep` - `test: optional CheckStep` - `csharp: optional BuildTarget` - `go: optional BuildTarget` - `java: optional BuildTarget` - `kotlin: optional BuildTarget` - `node: optional BuildTarget` - `openapi: optional BuildTarget` - `php: optional BuildTarget` - `python: optional BuildTarget` - `ruby: optional BuildTarget` - `sql: optional BuildTarget` - `terraform: optional BuildTarget` - `typescript: optional BuildTarget` - `updated_at: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/branches/$BRANCH/reset \ -X PUT \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### Response ```json { "branch": "branch", "config_commit": { "repo": { "branch": "branch", "host": "host", "name": "name", "owner": "owner" }, "sha": "sha", "stats": { "additions": 0, "deletions": 0, "total": 0 }, "tree_oid": "tree_oid" }, "latest_build": { "id": "id", "config_commit": "config_commit", "created_at": "2019-12-27T18:11:19.117Z", "documented_spec": { "content": "content", "type": "content" }, "object": "build", "org": "org", "project": "project", "targets": { "cli": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "csharp": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "go": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "java": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "kotlin": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "node": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "openapi": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "php": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "python": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "ruby": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "sql": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "terraform": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } }, "typescript": { "commit": { "status": "not_started" }, "install_url": "install_url", "object": "build_target", "status": "not_started", "build": { "status": "not_started" }, "lint": { "status": "not_started" }, "test": { "status": "not_started" } } }, "updated_at": "2019-12-27T18:11:19.117Z" }, "object": "project_branch", "org": "org", "project": "project" } ``` ## Domain Types ### Project Branch - `ProjectBranch = object { branch, config_commit, latest_build, 3 more }` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: string` Branch name - `config_commit: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build: Build` - `id: string` Build ID - `config_commit: string` - `created_at: string` - `documented_spec: object { content, type } or object { expires, type, url }` - `object { content, type }` - `content: string` - `type: "content"` - `"content"` - `object { expires, type, url }` - `expires: string` - `type: "url"` - `"url"` - `url: string` - `object: "build"` - `"build"` - `org: string` - `project: string` - `targets: object { cli, csharp, go, 10 more }` - `cli: optional BuildTarget` - `commit: object { status } or object { status } or object { status } or object { commit, completed, completed_at, 3 more }` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status }` - `status: "queued"` - `"queued"` - `InProgress = object { status }` - `status: "in_progress"` - `"in_progress"` - `Completed = object { commit, completed, completed_at, 3 more }` - `commit: Commit` - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `completed: object { commit, completed_at, conclusion, merge_conflict_pr }` deprecated - `commit: Commit` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `completed_at: string` - `conclusion: "error" or "warning" or "note" or 9 more` - `"error"` - `"warning"` - `"note"` - `"success"` - `"merge_conflict"` - `"upstream_merge_conflict"` - `"fatal"` - `"payment_required"` - `"cancelled"` - `"timed_out"` - `"noop"` - `"version_bump"` - `merge_conflict_pr: object { number, repo }` - `number: number` - `repo: object { host, name, owner }` - `host: string` - `name: string` - `owner: string` - `status: "completed"` - `"completed"` - `install_url: string` - `object: "build_target"` - `"build_target"` - `status: "not_started" or "codegen" or "postgen" or "completed"` - `"not_started"` - `"codegen"` - `"postgen"` - `"completed"` - `build: optional CheckStep` - `NotStarted = object { status }` - `status: "not_started"` - `"not_started"` - `Queued = object { status, url }` - `status: "queued"` - `"queued"` - `url: string` - `InProgress = object { status, url }` - `status: "in_progress"` - `"in_progress"` - `url: string` - `Completed = object { completed, conclusion, status, url }` - `completed: object { conclusion, url }` deprecated - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `url: string` - `conclusion: "success" or "failure" or "skipped" or 4 more` - `"success"` - `"failure"` - `"skipped"` - `"cancelled"` - `"action_required"` - `"neutral"` - `"timed_out"` - `status: "completed"` - `"completed"` - `url: string` - `lint: optional CheckStep` - `test: optional CheckStep` - `csharp: optional BuildTarget` - `go: optional BuildTarget` - `java: optional BuildTarget` - `kotlin: optional BuildTarget` - `node: optional BuildTarget` - `openapi: optional BuildTarget` - `php: optional BuildTarget` - `python: optional BuildTarget` - `ruby: optional BuildTarget` - `sql: optional BuildTarget` - `terraform: optional BuildTarget` - `typescript: optional BuildTarget` - `updated_at: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Branch List Response - `BranchListResponse = object { branch, config_commit, latest_build_id, 3 more }` A project branch names a line of development for a project. Like a Git branch, it points to a Git commit with a set of config files. In addition, a project branch also points to a set of custom code changes, corresponding to Git branches in the staging repos. - `branch: string` Branch name - `config_commit: object { repo, sha, stats, tree_oid }` A Git commit that points to the latest set of config files on a given branch. - `repo: object { branch, host, name, owner }` - `branch: string` - `host: string` - `name: string` - `owner: string` - `sha: string` - `stats: object { additions, deletions, total }` - `additions: number` - `deletions: number` - `total: number` - `tree_oid: string` - `latest_build_id: string` - `object: "project_branch"` - `"project_branch"` - `org: string` - `project: string` Project name ### Branch Delete Response - `BranchDeleteResponse = unknown` # Configs ## Retrieve configuration files **get** `/v0/projects/{project}/configs` Retrieve the configuration files for a given project. ### Path Parameters - `project: optional string` ### Query Parameters - `branch: optional string` Branch name, defaults to "main". - `include: optional string` ### Returns - `content: string` The file content ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/configs \ -H "Authorization: Bearer $STAINLESS_API_KEY" ``` #### Response ```json { "foo": { "content": "content" } } ``` ## Generate config suggestions **post** `/v0/projects/{project}/configs/guess` Generate suggestions for changes to config files based on an OpenAPI spec. ### Path Parameters - `project: optional string` ### Body Parameters - `spec: string` OpenAPI spec - `branch: optional string` Branch name ### Returns - `content: string` The file content ### Example ```http curl https://api.stainless.com/v0/projects/$PROJECT/configs/guess \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $STAINLESS_API_KEY" \ -d '{ "spec": "spec" }' ``` #### Response ```json { "foo": { "content": "content" } } ``` ## Domain Types ### Config Retrieve Response - `ConfigRetrieveResponse = map[object { content } ]` Config files contents - `content: string` The file content ### Config Guess Response - `ConfigGuessResponse = map[object { content } ]` Config files contents - `content: string` The file content