Method Signature
func (c *Client) Profile(ctx context.Context, runID string) (types.Profile, error)
Retrieves a specific profile by its run ID.
Parameters
The context for the request, used for cancellation and timeouts.
The unique identifier of the run to retrieve the profile for.
Returns
The profile object containing all profile data.
The unique identifier for the run.
The ID of the agent associated with this profile.
The complete profile data containing:
- Scenario information (GitHub run details)
- Performance metrics
- Execution traces
- Other profile-specific data
The timestamp when the profile was originally created.
The timestamp when the profile was last updated.
An error if the operation failed or the profile was not found, nil otherwise.
Example
package main
import (
"context"
"fmt"
"log"
"github.com/garnet-org/api/client"
)
func main() {
// Initialize the client
c := client.New("your-api-token")
// Get a specific profile
runID := "run_789012"
profile, err := c.Profile(context.Background(), runID)
if err != nil {
log.Fatalf("Failed to get profile: %v", err)
}
fmt.Printf("Run ID: %s\n", profile.RunID)
fmt.Printf("Agent ID: %s\n", profile.AgentID)
fmt.Printf("Created at: %v\n", profile.CreatedAt)
fmt.Printf("Updated at: %v\n", profile.UpdatedAt)
fmt.Printf("Profile data: %+v\n", profile.Data)
}
Error Handling
Common errors:
404 Not Found: The profile with the specified run ID does not exist
401 Unauthorized: Invalid or missing authentication token
403 Forbidden: Insufficient permissions to access the profile
profile, err := c.Profile(ctx, runID)
if err != nil {
switch {
case errors.Is(err, types.ErrProfileNotFound):
fmt.Println("Profile not found")
case errors.Is(err, types.ErrUnauthorized):
fmt.Println("Authentication failed")
default:
fmt.Printf("Unexpected error: %v\n", err)
}
return
}
API Endpoint
GET /api/v1/profiles/{run_id}