Help us shape the future of Go! Take the 2026 Go Developer Survey

projects

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2025 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Overview

Package projects provides operations for managing Braintrust projects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API provides operations for managing Braintrust projects.

func New

func New(client *https.Client) *API

New creates a new projects API client.

func (*API) Create

func (a *API) Create(ctx context.Context, params CreateParams) (*Project, error)

Create creates a new project or returns an existing one if a project with the same name already exists. This operation is idempotent.

Example:

project, err := client.Projects().Create(ctx, projects.CreateParams{
    Name: "my-project",
})

func (*API) Delete

func (a *API) Delete(ctx context.Context, id string) error

Delete deletes a project by ID.

Example:

err := client.Projects().Delete(ctx, "proj_123")

func (*API) Get

func (a *API) Get(ctx context.Context, id string) (*Project, error)

Get retrieves a project by ID.

Example:

project, err := client.Projects().Get(ctx, "proj_123")

func (*API) List

func (a *API) List(ctx context.Context, params ListParams) (*ListResponse, error)

List retrieves a list of projects with optional filtering.

Example:

projects, err := client.Projects().List(ctx, projects.ListParams{
    Limit: 10,
})

type CreateParams

type CreateParams struct {
	// Name is the name of the project (required).
	Name string `json:"name"`

	// OrgID optionally specifies which organization to create the project under.
	// If empty, uses the default organization for the API key.
	OrgID string `json:"org_id,omitempty"`
}

CreateParams contains parameters for creating a project.

type ListParams

type ListParams struct {
	// OrgID filters projects by organization ID.
	OrgID string

	// Limit is the maximum number of projects to return.
	Limit int
}

ListParams contains parameters for listing projects.

type ListResponse

type ListResponse struct {
	// Objects is the list of projects returned.
	Objects []Project `json:"objects"`
}

ListResponse represents the response from listing projects.

type Project

type Project struct {
	// ID is the unique identifier for the project.
	ID string `json:"id"`

	// Name is the human-readable name of the project.
	Name string `json:"name"`

	// OrgID is the organization ID that owns this project.
	OrgID string `json:"org_id,omitempty"`
}

Project represents a project in Braintrust.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL