Project Operations
This chapter describes the methods for creating, listing, querying, updating, and deleting projects on
makers.projects. Environment variable methods are also provided by makers.projects. For more information, see Environment Variables.Data Model
projects.list, projects.listAll, and projects.get return project objects. projects.create returns only the project ID. projects.update and projects.delete have no return value.Field | Type | Required | Description |
projectId/project_id | string/str | Yes | Project ID |
name | string/str | Yes | Unique project name under the same account |
status | string/str | Yes | Project status |
area | "mainland" | "overseas" | "global" | No | Acceleration region, corresponding to the Chinese mainland AZ, global AZ (excluding the Chinese mainland), and global AZ |
presetDomain/preset_domain | string/str | No | Project domain, returned only by projects.get |
createdOn/created_on | string/str | Yes | Creation time in ISO 8601 format |
modifiedOn/modified_on | string/str | Yes | Modification time in ISO 8601 format |
projects.create
Project names must be unique within the same account. If a duplicate name is used, a
ConflictError is thrown.
Parameter
Parameter | Type | Required | Description |
name | string/str | Yes | A unique project name under the same account. A ConflictError is thrown when the name is duplicated. |
area | "mainland" | "overseas" | "global" | No | Acceleration region |
initialEnvVars/initial_env_vars | EnvVar[]/list[dict] | No | Environment variables written when a project is created. |
Return Value
Promise<CreateProjectResult>/dict contains only projectId/project_id. Information such as project status and project domain must be queried through projects.get.
Examples
const { projectId } = await makers.projects.create({name: "docs-site",area: "overseas",initialEnvVars: [{ key: "API_URL", value: "https://example.com" }],});
created = makers.projects.create(name="docs-site",area="overseas",initial_env_vars=[{"key": "API_URL", "value": "https://example.com"}],)project_id = created["project_id"]
projects.list
List projects with pagination.
Parameter
Parameter | Type | Required | Description |
projectIds/project_ids | string[]/list[str] | No | Filter by project ID |
name | string/str | No | Filter by project name |
status | string/str | No | Filter by project status |
provider | string/str | No | Filter by Provider |
page | number/int | No | Page number, starting from 0, default 0 |
pageSize/page_size | number/int | No | Number of items per page, ranging from 1 to 100, default 20 |
order.field | string/str | No | Values differ between the two languages. For TypeScript, the value is "createdOn" or "modifiedOn"; for Python, the value is "created_on" or "modified_on". |
order.direction | "asc" | "desc" | No | Sort direction |
Return Value
Promise<Page<Project>>/dict contains five fields: items, page, pageSize/page_size, total, and hasNext/has_next. Page numbers start from 0.
Examples
const page = await makers.projects.list({name: "docs",page: 0,pageSize: 20,order: { field: "createdOn", direction: "desc" },});console.log(page.total, page.hasNext);for (const project of page.items) {console.log(project.projectId, project.name);}
page = makers.projects.list(name="docs",page=0,page_size=20,order={"field": "created_on", "direction": "desc"},)print(page["total"], page["has_next"])for project in page["items"]:print(project["project_id"], project["name"])
projects.listAll / projects.list_all
The filtering and sorting parameters are the same as those of
projects.list, but the page parameter is not accepted.
Parameter
Parameter | Type | Required | Description |
projectIds/project_ids | string[]/list[str] | No | Filter by project ID |
name | string/str | No | Filter by project name |
status | string/str | No | Filter by project status |
provider | string/str | No | Filter by Provider |
pageSize/page_size | number/int | No | Number of items per page, ranging from 1 to 100, default 20 |
order.field | string/str | No | Values differ between the two languages. For TypeScript, the value is "createdOn" or "modifiedOn"; for Python, the value is "created_on" or "modified_on". |
order.direction | "asc" | "desc" | No | Sort direction |
Return Value
AsyncIterable<Project>/Iterator[dict] is paginated automatically by the SDK. In TypeScript, use for await to retrieve items one by one, and in Python, use for to retrieve items one by one.
Examples
for await (const project of makers.projects.listAll()) {console.log(project.projectId, project.name);}
for project in makers.projects.list_all():print(project["project_id"], project["name"])
projects.get
Queries a single project by project ID. If the project does not exist, a
NotFoundError is thrown.
Parameter
Parameter | Type | Required | Description |
projectId/project_id | string/str | Yes | Project ID |
Return Value
Promise<Project>/dict
Examples
const project = await makers.projects.get({ projectId: "your-project-id" });console.log(project.name, project.presetDomain);
project = makers.projects.get(project_id="your-project-id")print(project["name"], project.get("preset_domain"))
projects.update
Pass in only the fields that need to be modified. Fields that are not passed in retain their original values.
Updatable content includes the project name, as well as the root directory, output directory, build command, install command, framework preset, and Node version in the build and deployment configuration.
Parameter
Parameter | Type | Required | Description |
projectId/project_id | string/str | Yes | Project ID |
name | string/str | No | Project Name |
rootDir/root_dir | string/str | No | Root directory. |
outputDir/output_dir | string/str | No | Output directory. |
buildCmd/build_cmd | string/str | No | Build Command |
installCmd/install_cmd | string/str | No | Installation Command |
framework | string/str | No | Framework Preset |
nodejsVersion/nodejs_version | string/str | No | Node.js Version |
Return Value
Promise<void>/None
Examples
await makers.projects.update({projectId: "your-project-id",name: "new-name",rootDir: ".",outputDir: "dist",buildCmd: "npm run build",installCmd: "npm install",framework: "other",nodejsVersion: "20",});
makers.projects.update(project_id="your-project-id",name="new-name",root_dir=".",output_dir="dist",build_cmd="npm run build",install_cmd="npm install",framework="other",nodejs_version="20",)
projects.delete
Deletes a project by project ID. If the project does not exist, a
NotFoundError is thrown.
Parameter
Parameter | Type | Required | Description |
projectId/project_id | string/str | Yes | Project ID |
Return Value
Promise<void>/None
Examples
await makers.projects.delete({ projectId: "your-project-id" });
makers.projects.delete(project_id="your-project-id")
