Documentation
¶
Overview ¶
Package projects provides functionality for managing projects and API keys in Langfuse.
This package allows you to create, update, and manage projects, as well as manage API keys within projects. Most operations require organization-scoped API keys. Projects contain traces, datasets, and other Langfuse resources.
Index ¶
- type APIKeyDeletionResponse
- type APIKeyList
- type APIKeyResponse
- type APIKeySummary
- type Client
- func (c *Client) Create(ctx context.Context, createReq *CreateProjectRequest) (*Project, error)
- func (c *Client) CreateAPIKey(ctx context.Context, projectID string, createReq *CreateAPIKeyRequest) (*APIKeyResponse, error)
- func (c *Client) Delete(ctx context.Context, projectID string) (*ProjectDeletionResponse, error)
- func (c *Client) DeleteAPIKey(ctx context.Context, projectID, apiKeyID string) (*APIKeyDeletionResponse, error)
- func (c *Client) GetAPIKeys(ctx context.Context, projectID string) (*APIKeyList, error)
- func (c *Client) List(ctx context.Context) (*ProjectsResponse, error)
- func (c *Client) Update(ctx context.Context, projectID string, updateReq *UpdateProjectRequest) (*Project, error)
- type CreateAPIKeyRequest
- type CreateProjectRequest
- type Project
- type ProjectDeletionResponse
- type ProjectsResponse
- type UpdateProjectRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKeyDeletionResponse ¶
type APIKeyDeletionResponse struct {
Success bool `json:"success"`
}
APIKeyDeletionResponse represents the response from deleting an API key.
type APIKeyList ¶
type APIKeyList struct {
ApiKeys []APIKeySummary `json:"apiKeys"`
}
APIKeyList represents a list of API keys for a project.
type APIKeyResponse ¶
type APIKeyResponse struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
PublicKey string `json:"publicKey"`
SecretKey string `json:"secretKey"`
DisplaySecretKey string `json:"displaySecretKey"`
Note string `json:"note,omitempty"`
}
APIKeyResponse represents the response from creating an API key.
type APIKeySummary ¶
type APIKeySummary struct {
ID string `json:"id"`
CreatedAt time.Time `json:"createdAt"`
ExpiresAt time.Time `json:"expiresAt,omitempty"`
LastUsedAt time.Time `json:"lastUsedAt,omitempty"`
Note string `json:"note,omitempty"`
PublicKey string `json:"publicKey"`
DisplaySecretKey string `json:"displaySecretKey"`
}
APIKeySummary represents summary information about an API key.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides methods for interacting with the Langfuse projects API.
The client handles HTTP communication for project management operations including creating, updating, deleting projects, and managing API keys.
func NewClient ¶
NewClient creates a new projects client with the provided HTTP client.
The resty client should be pre-configured with authentication and base URL.
func (*Client) CreateAPIKey ¶
func (c *Client) CreateAPIKey(ctx context.Context, projectID string, createReq *CreateAPIKeyRequest) (*APIKeyResponse, error)
CreateAPIKey creates a new API key for a project (requires organization-scoped API key).
func (*Client) Delete ¶
Delete deletes a project by ID (requires organization-scoped API key). Project deletion is processed asynchronously.
func (*Client) DeleteAPIKey ¶
func (c *Client) DeleteAPIKey(ctx context.Context, projectID, apiKeyID string) (*APIKeyDeletionResponse, error)
DeleteAPIKey deletes an API key for a project (requires organization-scoped API key).
func (*Client) GetAPIKeys ¶
GetAPIKeys retrieves all API keys for a project (requires organization-scoped API key).
type CreateAPIKeyRequest ¶
type CreateAPIKeyRequest struct {
Note string `json:"note,omitempty"`
}
CreateAPIKeyRequest represents the request payload for creating an API key.
type CreateProjectRequest ¶
type CreateProjectRequest struct {
Name string `json:"name"`
Metadata map[string]any `json:"metadata,omitempty"`
Retention int `json:"retention"`
}
CreateProjectRequest represents the parameters for creating a new project.
Name is required. Metadata can contain custom key-value pairs. Retention specifies the data retention period in days.
type Project ¶
type Project struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Metadata map[string]any `json:"metadata,omitempty"`
RetentionDays int `json:"retentionDays,omitempty"`
}
Project represents a Langfuse project with its configuration and metadata.
Projects are containers for traces, datasets, prompts, and other Langfuse resources. They can have custom metadata and data retention policies.
type ProjectDeletionResponse ¶
type ProjectDeletionResponse struct {
Success bool `json:"success"`
Message string `json:"message"`
}
ProjectDeletionResponse represents the response from deleting a project.
type ProjectsResponse ¶
type ProjectsResponse struct {
Data []Project `json:"data"`
}
ProjectsResponse represents the response from listing projects.
type UpdateProjectRequest ¶
type UpdateProjectRequest struct {
Name string `json:"name"`
Metadata map[string]any `json:"metadata,omitempty"`
Retention int `json:"retention"`
}
UpdateProjectRequest represents the parameters for updating an existing project.
All fields are optional and only provided fields will be updated.