Skip to content
FeedbackDashboard

List project branches

client.Projects.Branches.List(ctx, params) (*Page[ProjectBranchListResponse], error)
get/v0/projects/{project}/branches

Retrieve a project branch by name.

ParametersExpand Collapse
params ProjectBranchListParams
Project param.Field[string]optional

Path param:

Cursor param.Field[string]optional

Query param: Pagination cursor from a previous response

Limit param.Field[float64]optional

Query param: Maximum number of items to return, defaults to 10 (maximum: 100).

exclusiveMinimum0
maximum100
ReturnsExpand Collapse
type ProjectBranchListResponse struct{…}

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

ConfigCommit ProjectBranchListResponseConfigCommit

A Git commit that points to the latest set of config files on a given branch.

Repo ProjectBranchListResponseConfigCommitRepo
Branch string
Name string
Owner string
Sha string
LatestBuildID string
Object ProjectBranchListResponseObject
Org string
Project string

Project name

List project branches
package main

import (
  "context"
  "fmt"

  "github.com/stainless-api/stainless-api-go"
  "github.com/stainless-api/stainless-api-go/option"
)

func main() {
  client := stainless.NewClient(
    option.WithAPIKey("My API Key"),
  )
  page, err := client.Projects.Branches.List(context.TODO(), stainless.ProjectBranchListParams{
    Project: stainless.String("project"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", page)
}
{
  "data": [
    {
      "branch": "branch",
      "config_commit": {
        "repo": {
          "branch": "branch",
          "name": "name",
          "owner": "owner"
        },
        "sha": "sha"
      },
      "latest_build_id": "latest_build_id",
      "object": "project_branch",
      "org": "org",
      "project": "project"
    }
  ],
  "has_more": true,
  "next_cursor": "next_cursor"
}
Returns Examples
{
  "data": [
    {
      "branch": "branch",
      "config_commit": {
        "repo": {
          "branch": "branch",
          "name": "name",
          "owner": "owner"
        },
        "sha": "sha"
      },
      "latest_build_id": "latest_build_id",
      "object": "project_branch",
      "org": "org",
      "project": "project"
    }
  ],
  "has_more": true,
  "next_cursor": "next_cursor"
}