Create
client.vals.branches.create(stringvalID, BranchCreateParams { name, branchId } body, RequestOptionsoptions?): BranchCreateResponse { id, createdAt, forkedBranchId, 4 more }
/v2/vals/{val_id}/branches
Create a new branch
Parameters
valID: string
Returns
import ValTown from "npm:@valtown/sdk";
const client = new ValTown();
const branch = await client.vals.branches.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
name: 'my-branch',
branchId: '00000000-0000-0000-0000-000000000000',
});
console.log(branch.id);
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"createdAt": "2019-12-27T18:11:19.117Z",
"forkedBranchId": "forkedBranchId",
"links": {
"html": "https://example.com",
"self": "https://example.com"
},
"name": "name",
"updatedAt": "2019-12-27T18:11:19.117Z",
"version": 0
}Returns Examples
{
"id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
"createdAt": "2019-12-27T18:11:19.117Z",
"forkedBranchId": "forkedBranchId",
"links": {
"html": "https://example.com",
"self": "https://example.com"
},
"name": "name",
"updatedAt": "2019-12-27T18:11:19.117Z",
"version": 0
}