# Projects ## Retrieve project `$client->projects->retrieve(string project): Project` **get** `/v0/projects/{project}` Retrieve a project by name. ### Parameters - `project: string` ### Returns - `Project` - `string configRepo` - `?string displayName` - `Object_ object` - `string org` - `string slug` - `list targets` ### Example ```php projects->retrieve(project: 'project'); var_dump($project); ``` #### Response ```json { "config_repo": "config_repo", "display_name": "display_name", "object": "project", "org": "org", "slug": "slug", "targets": [ "node" ] } ``` ## Update project `$client->projects->update(string project, ?string displayName): Project` **patch** `/v0/projects/{project}` Update a project's properties. ### Parameters - `project: string` - `displayName?:optional string` ### Returns - `Project` - `string configRepo` - `?string displayName` - `Object_ object` - `string org` - `string slug` - `list targets` ### Example ```php projects->update( project: 'project', displayName: 'display_name' ); var_dump($project); ``` #### Response ```json { "config_repo": "config_repo", "display_name": "display_name", "object": "project", "org": "org", "slug": "slug", "targets": [ "node" ] } ``` ## List projects `$client->projects->list(?string cursor, ?float limit, ?string org): Page` **get** `/v0/projects` List projects in an organization, from oldest to newest. ### Parameters - `cursor?:optional string` Pagination cursor from a previous response - `limit?:optional float` Maximum number of projects to return, defaults to 10 (maximum: 100). - `org?:optional string` ### Returns - `Project` - `string configRepo` - `?string displayName` - `Object_ object` - `string org` - `string slug` - `list targets` ### Example ```php projects->list(cursor: 'cursor', limit: 1, org: 'org'); var_dump($page); ``` #### 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(string displayName, string org, array revision, string slug, list targets): Project` **post** `/v0/projects` Create a new project. ### Parameters - `displayName: string` Human-readable project name - `org: string` Organization name - `revision: array` File contents to commit - `slug: string` Project name/slug - `targets: list` Targets to generate for ### Returns - `Project` - `string configRepo` - `?string displayName` - `Object_ object` - `string org` - `string slug` - `list targets` ### Example ```php projects->create( displayName: 'display_name', org: 'org', revision: ['foo' => ['content' => 'content']], slug: 'slug', targets: [Target::NODE], ); var_dump($project); ``` #### 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(string project, Target target, string baseRef, string headRef): ProjectGenerateCommitMessageResponse` **post** `/v0/projects/{project}/generate_commit_message` Generates an AI commit message by comparing two git refs in the SDK repository. ### Parameters - `project: string` - `target: Target` Language target - `baseRef: string` Base ref for comparison - `headRef: string` Head ref for comparison ### Returns - `ProjectGenerateCommitMessageResponse` - `string aiCommitMessage` ### Example ```php projects->generateCommitMessage( project: 'project', target: 'python', baseRef: 'base_ref', headRef: 'head_ref' ); var_dump($response); ``` #### Response ```json { "ai_commit_message": "ai_commit_message" } ``` ## Domain Types ### Project - `Project` - `string configRepo` - `?string displayName` - `Object_ object` - `string org` - `string slug` - `list targets` # Branches ## Create a new project branch `$client->projects->branches->create(string project, string branch, string branchFrom, ?bool force): ProjectBranch` **post** `/v0/projects/{project}/branches` Create a new branch for a project. The branch inherits the config files from the revision pointed to by the `branch_from` parameter. In addition, if the revision is a branch name, the branch will also inherit custom code changes from that branch. ### Parameters - `project: string` - `branch: string` Branch name - `branchFrom: string` Branch or commit SHA to branch from - `force?:optional bool` Whether to throw an error if the branch already exists. Defaults to false. ### Returns - `ProjectBranch` - `string branch` Branch name - `ConfigCommit configCommit` A Git commit that points to the latest set of config files on a given branch. - `?Build latestBuild` - `Object_ object` - `string org` - `string project` Project name ### Example ```php projects->branches->create( project: 'project', branch: 'branch', branchFrom: 'branch_from', force: true ); var_dump($projectBranch); ``` #### 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(string branch, string project): ProjectBranch` **get** `/v0/projects/{project}/branches/{branch}` Retrieve a project branch by name. ### Parameters - `project: string` - `branch: string` ### Returns - `ProjectBranch` - `string branch` Branch name - `ConfigCommit configCommit` A Git commit that points to the latest set of config files on a given branch. - `?Build latestBuild` - `Object_ object` - `string org` - `string project` Project name ### Example ```php projects->branches->retrieve( 'branch', project: 'project' ); var_dump($projectBranch); ``` #### 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(string project, ?string cursor, ?float limit): Page` **get** `/v0/projects/{project}/branches` Retrieve a project branch by name. ### Parameters - `project: string` - `cursor?:optional string` Pagination cursor from a previous response - `limit?:optional float` Maximum number of items to return, defaults to 10 (maximum: 100). ### Returns - `BranchListResponse` - `string branch` Branch name - `ConfigCommit configCommit` A Git commit that points to the latest set of config files on a given branch. - `string latestBuildID` - `Object_ object` - `string org` - `string project` Project name ### Example ```php projects->branches->list( project: 'project', cursor: 'cursor', limit: 1 ); var_dump($page); ``` #### 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(string branch, string project): BranchDeleteResponse` **delete** `/v0/projects/{project}/branches/{branch}` Delete a project branch by name. ### Parameters - `project: string` - `branch: string` ### Returns - `mixed` ### Example ```php projects->branches->delete('branch', project: 'project'); var_dump($branch); ``` #### Response ```json {} ``` ## Rebase a project branch `$client->projects->branches->rebase(string branch, string project, ?string base): ProjectBranch` **put** `/v0/projects/{project}/branches/{branch}/rebase` Rebase a project branch. The branch is rebased onto the `base` branch or commit SHA, inheriting any config and custom code changes. ### Parameters - `project: string` - `branch: string` - `base?:optional string` The branch or commit SHA to rebase onto. Defaults to "main". ### Returns - `ProjectBranch` - `string branch` Branch name - `ConfigCommit configCommit` A Git commit that points to the latest set of config files on a given branch. - `?Build latestBuild` - `Object_ object` - `string org` - `string project` Project name ### Example ```php projects->branches->rebase( 'branch', project: 'project', base: 'base' ); var_dump($projectBranch); ``` #### 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(string branch, string project, ?string targetConfigSha): ProjectBranch` **put** `/v0/projects/{project}/branches/{branch}/reset` Reset a project branch. If `branch` === `main`, the branch is reset to `target_config_sha`. Otherwise, the branch is reset to `main`. ### Parameters - `project: string` - `branch: string` - `targetConfigSha?:optional string` The commit SHA to reset the main branch to. Required if resetting the main branch; disallowed otherwise. ### Returns - `ProjectBranch` - `string branch` Branch name - `ConfigCommit configCommit` A Git commit that points to the latest set of config files on a given branch. - `?Build latestBuild` - `Object_ object` - `string org` - `string project` Project name ### Example ```php projects->branches->reset( 'branch', project: 'project', targetConfigSha: 'target_config_sha' ); var_dump($projectBranch); ``` #### 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` - `string branch` Branch name - `ConfigCommit configCommit` A Git commit that points to the latest set of config files on a given branch. - `?Build latestBuild` - `Object_ object` - `string org` - `string project` Project name # Configs ## Retrieve configuration files `$client->projects->configs->retrieve(string project, ?string branch, ?string include): ConfigGetResponse` **get** `/v0/projects/{project}/configs` Retrieve the configuration files for a given project. ### Parameters - `project: string` - `branch?:optional string` Branch name, defaults to "main". - `include?:optional string` ### Returns - `array` - `string content` The file content ### Example ```php projects->configs->retrieve( project: 'project', branch: 'branch', include: 'include' ); var_dump($config); ``` #### Response ```json { "foo": { "content": "content" } } ``` ## Generate config suggestions `$client->projects->configs->guess(string project, string spec, ?string branch): ConfigGuessResponse` **post** `/v0/projects/{project}/configs/guess` Generate suggestions for changes to config files based on an OpenAPI spec. ### Parameters - `project: string` - `spec: string` OpenAPI spec - `branch?:optional string` Branch name ### Returns - `array` - `string content` The file content ### Example ```php projects->configs->guess( project: 'project', spec: 'spec', branch: 'branch' ); var_dump($response); ``` #### Response ```json { "foo": { "content": "content" } } ```