Skip to content
  • Auto
  • Light
  • Dark
Get Started
View as Markdown
Copy Markdown

Open in Claude
Open in ChatGPT

List

client.vals.branches.list(stringvalID, BranchListParams { limit, offset } query, RequestOptionsoptions?): PageCursorURL<BranchListResponse { id, createdAt, forkedBranchId, 4 more } >
get/v2/vals/{val_id}/branches

List all branches for a val

ParametersExpand Collapse
valID: string
query: BranchListParams { limit, offset }
limit: number

Maximum items to return in each paginated response

minimum1
maximum100
offset: number

Number of items to skip in order to deliver paginated results

minimum0
ReturnsExpand Collapse
BranchListResponse { id, createdAt, forkedBranchId, 4 more }

A Branch

id: string

The id of the branch

formatuuid
createdAt: string
forkedBranchId: string | null

The id of the branch this branch was forked from

The URL of this resource on Val Town

formaturi

The URL of this resource on this API

formaturi
name: string
updatedAt: string
version: number
import ValTown from "npm:@valtown/sdk";

const client = new ValTown();

// Automatically fetches more pages as needed.
for await (const branchListResponse of client.vals.branches.list('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
  limit: 1,
  offset: 0,
})) {
  console.log(branchListResponse.id);
}
{
  "data": [
    {
      "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
    }
  ],
  "links": {
    "self": "https://example.com",
    "next": "https://example.com",
    "prev": "https://example.com"
  }
}
Returns Examples
{
  "data": [
    {
      "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
    }
  ],
  "links": {
    "self": "https://example.com",
    "next": "https://example.com",
    "prev": "https://example.com"
  }
}