anima

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 19 Imported by: 0

README

Anima Go SDK

Official Go client library for the Anima API.

Installation

go get github.com/anima-labs/anima-go

Requires Go 1.22 or later.

Quick Start

package main

import (
    "context"
    "fmt"
    "log"

    anima "github.com/anima-labs/anima-go"
)

func main() {
    client := anima.NewClient("ak_live_your_api_key")
    ctx := context.Background()

    // Create an agent.
    agent, err := client.Agents.Create(ctx, anima.CreateAgentParams{
        OrgID: "org_123",
        Name:  "My Agent",
        Slug:  "my-agent",
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("Created agent: %s\n", agent.ID)

    // Send an email.
    msg, err := client.Messages.SendEmail(ctx, anima.SendEmailParams{
        AgentID: agent.ID,
        To:      []string{"user@example.com"},
        Subject: "Hello from Anima",
        Body:    "Sent by an AI agent.",
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Printf("Sent message: %s (status: %s)\n", msg.ID, msg.Status)
}

Configuration

Use functional options to customize the client:

import "time"

client := anima.NewClient("ak_live_...",
    anima.WithBaseURL("https://api.staging.useanima.sh"),
    anima.WithTimeout(10 * time.Second),
    anima.WithMaxRetries(5),
)
Custom HTTP Client
import "net/http"

httpClient := &http.Client{
    Timeout: 15 * time.Second,
    Transport: &http.Transport{
        MaxIdleConns: 100,
    },
}

client := anima.NewClient("ak_live_...",
    anima.WithHTTPClient(httpClient),
)

Error Handling

The SDK uses sentinel errors with errors.Is and typed errors with errors.As:

import "errors"

// Check error category with errors.Is
_, err := doSomething()
if errors.Is(err, anima.ErrNotFound) {
    fmt.Println("Resource not found")
} else if errors.Is(err, anima.ErrRateLimit) {
    fmt.Println("Rate limited, try again later")
} else if errors.Is(err, anima.ErrAuthentication) {
    fmt.Println("Invalid API key")
} else if errors.Is(err, anima.ErrValidation) {
    fmt.Println("Invalid request parameters")
}

// Extract detailed error info with errors.As
var apiErr *anima.APIError
if errors.As(err, &apiErr) {
    fmt.Printf("Status: %d\n", apiErr.Status)
    fmt.Printf("Code: %s\n", apiErr.Code)
    fmt.Printf("Message: %s\n", apiErr.Message)

    if apiErr.RetryAfter > 0 {
        fmt.Printf("Retry after %d seconds\n", apiErr.RetryAfter)
    }
}
Available Sentinel Errors
Error Description
ErrAuthentication Invalid or missing API key (401/403)
ErrNotFound Resource not found (404)
ErrValidation Invalid request parameters (400/422)
ErrRateLimit Rate limit exceeded (429)
ErrConflict Resource conflict (409)
ErrInternalServer Server error (5xx)
ErrTimeout Request timed out
ErrNetwork Network-level error
ErrRetryExhausted All retry attempts failed

Resource Services

All resource services are available as fields on the Client:

Service Description
client.A2A Agent-to-agent task submission, listing, and cancellation
client.Addresses Physical/mailing addresses: CRUD, validation
client.Agents Create, list, update, delete agents; rotate API keys
client.Anomaly Anomaly alerts, detection rules, baselines, quarantine
client.Audit Immutable audit logs: list, get, export (CSV/JSON)
client.Cards Virtual cards, spending policies, transactions, approvals
client.Compliance Controls, reports, dashboard, DSARs (SOC2/GDPR/PCI)
client.Domains Add/verify domains, DNS records, deliverability stats
client.Emails List emails, manage attachments
client.Identity DID documents, key rotation, verifiable credentials, agent cards
client.Messages Send email/SMS, list and search messages
client.Organizations Manage organizations and master keys
client.Phones Provision/release phone numbers
client.Pods Compute pods: create, list, update, delete, usage stats
client.Registry Public agent registry: register, search, lookup, update, unlist
client.Security Content scanning, security events
client.Vault Credential vault: store, search, generate passwords, TOTP
client.Wallet Crypto wallets: create, pay, X-402 fetch, transactions, freeze
client.Webhooks Webhook CRUD, test delivery, list deliveries
Sending Email
msg, err := client.Messages.SendEmail(ctx, anima.SendEmailParams{
    AgentID: "agent_123",
    To:      []string{"user@example.com"},
    Subject: "Hello",
    Body:    "Plain text body",
    BodyHTML: "<h1>Hello</h1>",
})
Managing Cards
card, err := client.Cards.Create(ctx, anima.CreateCardParams{
    AgentID:         "agent_123",
    Label:           "Marketing Budget",
    SpendLimitDaily: anima.IntPtr(10000), // $100.00
})

// Freeze a card instantly.
card, err = client.Cards.Freeze(ctx, card.ID)

// Kill switch: freeze all cards for an agent.
result, err := client.Cards.KillSwitch(ctx, anima.KillSwitchParams{
    AgentID: "agent_123",
    Active:  true,
})
Agent Identity (DID)
// Get an agent's DID document.
did, err := client.Identity.GetDID(ctx, "agent_123")
fmt.Printf("DID: %s\n", did.ID)

// Verify a credential.
result, err := client.Identity.VerifyCredential(ctx, "eyJhbGciOi...")
fmt.Printf("Valid: %v\n", result.Valid)
Agent Registry
// Register an agent in the public registry.
entry, err := client.Registry.Register(ctx, anima.RegisterAgentParams{
    DID:  "did:anima:agent_123",
    Name: "My Agent",
})

// Search the registry.
results, err := client.Registry.Search(ctx, anima.RegistrySearchParams{
    Query: "email assistant",
})
Wallet
// Create a wallet for an agent.
wallet, err := client.Wallet.Create(ctx, "agent_123", nil)

// Make a payment.
payment, err := client.Wallet.Pay(ctx, "agent_123", anima.WalletPayParams{
    To:     "did:anima:recipient",
    Amount: "1.50",
})

// Freeze a wallet.
err = client.Wallet.Freeze(ctx, "agent_123")
Pods
// Create a compute pod.
pod, err := client.Pods.Create(ctx, anima.CreatePodParams{
    AgentID: "agent_123",
    Name:    "worker-1",
    Image:   "agent-runtime:latest",
})

// Check usage.
usage, err := client.Pods.Usage(ctx, pod.ID)
fmt.Printf("CPU: %.2f%%\n", usage.CPU)
A2A (Agent-to-Agent)
// Submit a task to another agent.
task, err := client.A2A.SubmitTask(ctx, "agent_456", anima.SubmitA2ATaskParams{
    Input: map[string]string{"query": "summarize this document"},
})

// Check task status.
task, err = client.A2A.GetTask(ctx, "agent_456", task.ID)
fmt.Printf("Status: %s\n", task.Status)
Addresses
// Create an address for an agent.
addr, err := client.Addresses.Create(ctx, anima.CreateAddressParams{
    AgentID:    "agent_123",
    Line1:      "123 Main St",
    City:       "San Francisco",
    State:      "CA",
    PostalCode: "94105",
    Country:    "US",
})

// Validate the address.
validation, err := client.Addresses.Validate(ctx, addr.ID, "agent_123")
fmt.Printf("Deliverable: %v\n", validation.Deliverable)
Vault Credentials
cred, err := client.Vault.CreateCredential(ctx, anima.CreateVaultCredentialParams{
    AgentID: "agent_123",
    Type:    anima.CredentialTypeLogin,
    Name:    "GitHub",
    Login: &anima.VaultLoginData{
        Username: "bot@company.com",
        Password: "s3cr3t",
    },
})
Audit Logs
// List audit logs with filters.
page, err := client.Audit.List(ctx, "org_123", &anima.AuditLogListParams{
    ActorType:    anima.AuditActorAgent,
    ResourceType: "message",
    From:         "2026-01-01T00:00:00Z",
    To:           "2026-03-01T00:00:00Z",
})

// Export audit logs as CSV.
export, err := client.Audit.Export(ctx, "org_123", &anima.AuditLogExportParams{
    Format: anima.AuditExportFormatCSV,
    From:   "2026-01-01T00:00:00Z",
})
fmt.Printf("Download: %s (%d records)\n", export.URL, export.RecordCount)
Compliance
// Seed SOC 2 controls for an organization.
seed, err := client.Compliance.SeedFramework(ctx, "org_123", anima.SeedFrameworkInput{
    Framework: anima.ComplianceFrameworkSOC2,
})
fmt.Printf("Created %d controls\n", seed.ControlsCreated)

// View compliance dashboard.
dashboard, err := client.Compliance.GetDashboard(ctx, "org_123")
fmt.Printf("Overall score: %.1f%%\n", dashboard.OverallScore)

// Create a GDPR data subject access request.
dsar, err := client.Compliance.CreateDSAR(ctx, "org_123", anima.CreateDSARInput{
    SubjectEmail: "user@example.com",
    RequestType:  anima.DSARRequestTypeDeletion,
})
Anomaly Detection
// Create an anomaly detection rule.
rule, err := client.Anomaly.CreateRule(ctx, "org_123", anima.CreateAnomalyRuleInput{
    Name:      "High email volume",
    Metric:    anima.AnomalyMetricEmailSendRate,
    Condition: anima.AnomalyConditionZScoreGT,
    Threshold: 3.0,
    Severity:  anima.AnomalySeverityCritical,
})

// List triggered alerts.
alerts, err := client.Anomaly.ListAlerts(ctx, "org_123", &anima.AnomalyAlertListParams{
    Status: anima.AnomalyAlertStatusTriggered,
})

// Quarantine a misbehaving agent.
q, err := client.Anomaly.Quarantine(ctx, "org_123", "agent_123", anima.QuarantineInput{
    Level:  anima.QuarantineLevelHard,
    Reason: "Unusual email send volume",
})

Pagination

List endpoints return paginated results. Use ListAutoPaging for automatic iteration:

iter := client.Agents.ListAutoPaging(&anima.AgentListParams{
    ListParams: anima.ListParams{Limit: 50},
    OrgID:      "org_123",
})

for iter.Next(ctx) {
    agent := iter.Current()
    fmt.Println(agent.Name)
}
if err := iter.Err(); err != nil {
    log.Fatal(err)
}

Or fetch a single page manually:

page, err := client.Agents.List(ctx, &anima.AgentListParams{
    ListParams: anima.ListParams{Limit: 10},
})
for _, agent := range page.Items {
    fmt.Println(agent.Name)
}

Webhook Verification

Verify incoming webhook signatures using HMAC-SHA256:

import "net/http"

func webhookHandler(w http.ResponseWriter, r *http.Request) {
    payload, _ := io.ReadAll(r.Body)
    signature := r.Header.Get("Anima-Signature")

    event, err := anima.ConstructWebhookEvent(payload, signature, "whsec_your_secret", nil)
    if err != nil {
        http.Error(w, "Invalid signature", http.StatusForbidden)
        return
    }

    switch event.Type {
    case "agent.created":
        fmt.Printf("New agent: %v\n", event.Data["name"])
    case "message.received":
        fmt.Printf("Message from: %v\n", event.Data["fromAddress"])
    }

    w.WriteHeader(http.StatusOK)
}

Automatic Retries

The SDK automatically retries failed requests with exponential backoff:

  • Retryable status codes: 429 (Rate Limited), 5xx (Server Errors)
  • Non-retryable: 400, 401, 403, 404, 409 (returned immediately)
  • Backoff: Exponential with jitter (1s, 2s, 4s base delays)
  • Retry-After: Honored when present in response headers
  • Default retries: 3 (configurable with WithMaxRetries)

Community

Join the Anima Discord to ask questions in #go-sdk, share what you're building in #showcase, and stay up to date with releases in #announcements.

License

See LICENSE for details.

Documentation

Overview

Package anima provides a Go client for the Anima API.

Create a client with your API key:

client := anima.NewClient("ak_live_...",
    anima.WithBaseURL("https://api.useanima.sh"),
)

Resource services are available as fields on the Client struct:

client.Agents.Create(ctx, params)
client.Messages.SendEmail(ctx, params)
client.Cards.Create(ctx, params)

Index

Constants

View Source
const (
	// DefaultBaseURL is the production Anima API endpoint.
	DefaultBaseURL = "https://api.useanima.sh"
	// DefaultTimeout is the default per-request timeout.
	DefaultTimeout = 30 * time.Second
	// DefaultMaxRetries is the default number of retries for failed requests.
	DefaultMaxRetries = 3
	// SDKVersion is the current version of this SDK.
	SDKVersion = "0.1.0"
)
View Source
const (
	// DefaultWebhookTolerance is the default maximum age of a webhook event (5 minutes).
	DefaultWebhookTolerance = 5 * time.Minute
)

Variables

View Source
var (
	ErrAuthentication = errors.New("authentication failed")
	ErrNotFound       = errors.New("resource not found")
	ErrValidation     = errors.New("validation failed")
	ErrRateLimit      = errors.New("rate limit exceeded")
	ErrConflict       = errors.New("resource conflict")
	ErrInternalServer = errors.New("internal server error")
	ErrTimeout        = errors.New("request timed out")
	ErrNetwork        = errors.New("network error")
	ErrRetryExhausted = errors.New("request failed after retries")
	ErrWebhookInvalid = errors.New("invalid webhook signature")
	ErrWebhookExpired = errors.New("webhook timestamp expired")
)

Sentinel errors for use with errors.Is.

Functions

func BoolPtr

func BoolPtr(v bool) *bool

BoolPtr returns a pointer to the given bool. Useful for optional fields.

func Do

func Do[T any](ctx context.Context, hc *httpClient, method, path string, body any, query url.Values) (T, error)

Do executes an HTTP request with retries and returns the parsed response body. T is the type to unmarshal the response body into.

func IntPtr

func IntPtr(v int) *int

IntPtr returns a pointer to the given int. Useful for optional fields.

func StringPtr

func StringPtr(v string) *string

StringPtr returns a pointer to the given string. Useful for optional fields.

func VerifyWebhookSignature

func VerifyWebhookSignature(payload []byte, signatureHeader, secret string, opts *WebhookVerifyOptions) (bool, error)

VerifyWebhookSignature verifies that a webhook payload was signed by Anima. The signatureHeader should be in the format "t=<unix_timestamp>,v1=<hex_signature>". Returns true if the signature is valid and the timestamp is within tolerance.

Types

type A2AService

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

A2AService provides methods for agent-to-agent (A2A) communication.

func (*A2AService) CancelTask

func (s *A2AService) CancelTask(ctx context.Context, agentID string, taskID string) (*A2ATask, error)

CancelTask cancels an in-progress A2A task.

func (*A2AService) GetTask

func (s *A2AService) GetTask(ctx context.Context, agentID string, taskID string) (*A2ATask, error)

GetTask retrieves an A2A task by ID.

func (*A2AService) ListTasks

func (s *A2AService) ListTasks(ctx context.Context, agentID string, params *A2ATaskListParams) (*Page[A2ATask], error)

ListTasks returns a paginated list of A2A tasks for an agent.

func (*A2AService) ListTasksAutoPaging

func (s *A2AService) ListTasksAutoPaging(agentID string, params *A2ATaskListParams) *ListIterator[A2ATask]

ListTasksAutoPaging returns an iterator that automatically paginates through all A2A tasks.

func (*A2AService) SubmitTask

func (s *A2AService) SubmitTask(ctx context.Context, agentID string, params SubmitA2ATaskParams) (*A2ATask, error)

SubmitTask submits a new task to an agent via the A2A protocol.

type A2ATask

type A2ATask struct {
	ID        string                 `json:"id"`
	AgentID   string                 `json:"agentId"`
	Status    A2ATaskStatus          `json:"status"`
	Input     any                    `json:"input,omitempty"`
	Output    any                    `json:"output,omitempty"`
	Error     *A2ATaskError          `json:"error,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
	CreatedAt string                 `json:"createdAt"`
	UpdatedAt string                 `json:"updatedAt"`
}

A2ATask represents an agent-to-agent task.

type A2ATaskError

type A2ATaskError struct {
	Code    string `json:"code,omitempty"`
	Message string `json:"message"`
}

A2ATaskError represents an error that occurred during task execution.

type A2ATaskListParams

type A2ATaskListParams struct {
	ListParams
	Status A2ATaskStatus
}

A2ATaskListParams contains parameters for listing A2A tasks.

func (A2ATaskListParams) ToQuery

func (p A2ATaskListParams) ToQuery() url.Values

ToQuery converts A2ATaskListParams to URL query values.

type A2ATaskStatus

type A2ATaskStatus string

A2ATaskStatus represents the status of an A2A task.

const (
	A2ATaskStatusPending   A2ATaskStatus = "pending"
	A2ATaskStatusRunning   A2ATaskStatus = "running"
	A2ATaskStatusCompleted A2ATaskStatus = "completed"
	A2ATaskStatusFailed    A2ATaskStatus = "failed"
	A2ATaskStatusCancelled A2ATaskStatus = "cancelled"
)

type APIError

type APIError struct {
	// Status is the HTTP status code (0 for network-level errors).
	Status int `json:"status"`
	// Code is a machine-readable error code from the API (e.g. "RATE_LIMIT").
	Code string `json:"code,omitempty"`
	// Message is a human-readable description.
	Message string `json:"message"`
	// Details contains optional structured error information.
	Details any `json:"details,omitempty"`
	// RetryAfter is set on 429 responses if the server provided a Retry-After header (seconds).
	RetryAfter int `json:"retry_after,omitempty"`
	// contains filtered or unexported fields
}

APIError represents an error returned by the Anima API. It wraps a sentinel error so that callers can use errors.Is to check the category, and errors.As to extract detailed information.

func (*APIError) Error

func (e *APIError) Error() string

Error implements the error interface.

func (*APIError) Unwrap

func (e *APIError) Unwrap() error

Unwrap returns the sentinel error so errors.Is works.

type AddDomainParams

type AddDomainParams struct {
	Domain string `json:"domain"`
}

AddDomainParams contains the parameters for adding a domain.

type Address

type Address struct {
	ID         string `json:"id"`
	AgentID    string `json:"agentId"`
	Type       string `json:"type"`
	Line1      string `json:"line1"`
	Line2      string `json:"line2,omitempty"`
	City       string `json:"city"`
	State      string `json:"state"`
	PostalCode string `json:"postalCode"`
	Country    string `json:"country"`
	Validated  bool   `json:"validated"`
	Primary    bool   `json:"primary"`
	CreatedAt  string `json:"createdAt"`
	UpdatedAt  string `json:"updatedAt"`
}

Address represents a physical or mailing address for an agent.

type AddressList

type AddressList struct {
	Items []Address `json:"items"`
}

AddressList wraps a list of addresses.

type AddressListParams

type AddressListParams struct {
	ListParams
	AgentID string
	Type    string
}

AddressListParams contains parameters for listing addresses.

func (AddressListParams) ToQuery

func (p AddressListParams) ToQuery() url.Values

ToQuery converts AddressListParams to URL query values.

type AddressesService

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

AddressesService provides methods for managing agent physical addresses.

func (*AddressesService) Create

func (s *AddressesService) Create(ctx context.Context, params CreateAddressParams) (*Address, error)

Create creates a new address.

func (*AddressesService) Delete

func (s *AddressesService) Delete(ctx context.Context, id string, agentID string) error

Delete deletes an address.

func (*AddressesService) Get

func (s *AddressesService) Get(ctx context.Context, id string, agentID string) (*Address, error)

Get retrieves an address by ID.

func (*AddressesService) List

List lists addresses, optionally filtered by agent or type.

func (*AddressesService) Update

func (s *AddressesService) Update(ctx context.Context, id string, params UpdateAddressParams) (*Address, error)

Update updates an existing address.

func (*AddressesService) Validate

func (s *AddressesService) Validate(ctx context.Context, id string, agentID string) (*ValidateAddressResult, error)

Validate validates an address for deliverability.

type Agent

type Agent struct {
	ID              string                 `json:"id"`
	OrgID           string                 `json:"orgId"`
	Name            string                 `json:"name"`
	Slug            string                 `json:"slug"`
	Status          AgentStatus            `json:"status"`
	APIKeyPrefix    *string                `json:"apiKeyPrefix"`
	Metadata        map[string]interface{} `json:"metadata"`
	EmailIdentities []EmailIdentity        `json:"emailIdentities"`
	PhoneIdentities []PhoneIdentity        `json:"phoneIdentities"`
	CreatedAt       string                 `json:"createdAt"`
	UpdatedAt       string                 `json:"updatedAt"`
}

Agent represents an Anima agent.

type AgentBaseline

type AgentBaseline struct {
	AgentID string           `json:"agentId"`
	OrgID   string           `json:"orgId"`
	Metrics []BaselineMetric `json:"metrics"`
}

AgentBaseline represents the behavioral baselines for an agent.

type AgentCardOutput

type AgentCardOutput struct {
	AgentID      string   `json:"agentId"`
	DID          string   `json:"did"`
	Name         string   `json:"name"`
	Description  string   `json:"description,omitempty"`
	Capabilities []string `json:"capabilities,omitempty"`
	Endpoints    any      `json:"endpoints,omitempty"`
	CreatedAt    string   `json:"createdAt,omitempty"`
	UpdatedAt    string   `json:"updatedAt,omitempty"`
}

AgentCardOutput represents an agent's public card (machine-readable profile).

type AgentListParams

type AgentListParams struct {
	ListParams
	OrgID  string
	Status AgentStatus
	Query  string
}

AgentListParams contains parameters for listing agents.

func (AgentListParams) ToQuery

func (p AgentListParams) ToQuery() url.Values

ToQuery converts AgentListParams to URL query values.

type AgentStatus

type AgentStatus string

AgentStatus represents the status of an agent.

const (
	AgentStatusActive    AgentStatus = "ACTIVE"
	AgentStatusSuspended AgentStatus = "SUSPENDED"
	AgentStatusDeleted   AgentStatus = "DELETED"
)

type AgentsService

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

AgentsService provides methods for managing agents.

func (*AgentsService) Create

func (s *AgentsService) Create(ctx context.Context, params CreateAgentParams) (*Agent, error)

Create creates a new agent.

func (*AgentsService) Delete

func (s *AgentsService) Delete(ctx context.Context, id string) error

Delete deletes an agent.

func (*AgentsService) Get

func (s *AgentsService) Get(ctx context.Context, id string) (*Agent, error)

Get retrieves an agent by ID.

func (*AgentsService) List

func (s *AgentsService) List(ctx context.Context, params *AgentListParams) (*Page[Agent], error)

List returns a paginated list of agents.

func (*AgentsService) ListAutoPaging

func (s *AgentsService) ListAutoPaging(params *AgentListParams) *ListIterator[Agent]

ListAutoPaging returns an iterator that automatically paginates through all agents.

func (*AgentsService) RotateKey

func (s *AgentsService) RotateKey(ctx context.Context, id string) (*RotateKeyResult, error)

RotateKey rotates an agent's API key and returns the new key.

func (*AgentsService) Update

func (s *AgentsService) Update(ctx context.Context, id string, params UpdateAgentParams) (*Agent, error)

Update updates an existing agent.

type AnomalyAlert

type AnomalyAlert struct {
	ID             string                 `json:"id"`
	OrgID          string                 `json:"orgId"`
	AgentID        string                 `json:"agentId"`
	Metric         AnomalyMetric          `json:"metric"`
	Severity       AnomalySeverity        `json:"severity"`
	Status         AnomalyAlertStatus     `json:"status"`
	BaselineValue  float64                `json:"baselineValue"`
	ActualValue    float64                `json:"actualValue"`
	ZScore         float64                `json:"zScore"`
	RuleID         *string                `json:"ruleId"`
	Details        map[string]interface{} `json:"details"`
	AcknowledgedBy *string                `json:"acknowledgedBy"`
	AcknowledgedAt *string                `json:"acknowledgedAt"`
	ResolvedBy     *string                `json:"resolvedBy"`
	ResolvedAt     *string                `json:"resolvedAt"`
	CreatedAt      string                 `json:"createdAt"`
}

AnomalyAlert represents an anomaly detection alert.

type AnomalyAlertListParams

type AnomalyAlertListParams struct {
	ListParams
	AgentID  string
	Metric   AnomalyMetric
	Severity AnomalySeverity
	Status   AnomalyAlertStatus
}

AnomalyAlertListParams contains parameters for listing anomaly alerts.

func (AnomalyAlertListParams) ToQuery

func (p AnomalyAlertListParams) ToQuery() url.Values

ToQuery converts AnomalyAlertListParams to URL query values.

type AnomalyAlertStatus

type AnomalyAlertStatus string

AnomalyAlertStatus represents the status of an anomaly alert.

const (
	AnomalyAlertStatusTriggered     AnomalyAlertStatus = "TRIGGERED"
	AnomalyAlertStatusAcknowledged  AnomalyAlertStatus = "ACKNOWLEDGED"
	AnomalyAlertStatusResolved      AnomalyAlertStatus = "RESOLVED"
	AnomalyAlertStatusFalsePositive AnomalyAlertStatus = "FALSE_POSITIVE"
)

type AnomalyCondition

type AnomalyCondition string

AnomalyCondition represents the condition type for an anomaly detection rule.

const (
	AnomalyConditionZScoreGT         AnomalyCondition = "zscore_gt"
	AnomalyConditionRateMultiplierGT AnomalyCondition = "rate_multiplier_gt"
	AnomalyConditionAbsoluteGT       AnomalyCondition = "absolute_gt"
	AnomalyConditionTimeViolation    AnomalyCondition = "time_violation"
)

type AnomalyMetric

type AnomalyMetric string

AnomalyMetric represents a behavioral metric tracked for anomaly detection.

const (
	AnomalyMetricEmailSendRate    AnomalyMetric = "email_send_rate"
	AnomalyMetricSMSSendRate      AnomalyMetric = "sms_send_rate"
	AnomalyMetricCardTxnCount     AnomalyMetric = "card_txn_count"
	AnomalyMetricVaultAccessRate  AnomalyMetric = "vault_access_rate"
	AnomalyMetricAPICallRate      AnomalyMetric = "api_call_rate"
	AnomalyMetricUniqueRecipients AnomalyMetric = "unique_recipients"
)

type AnomalyRule

type AnomalyRule struct {
	ID               string           `json:"id"`
	OrgID            string           `json:"orgId"`
	Name             string           `json:"name"`
	Metric           AnomalyMetric    `json:"metric"`
	Condition        AnomalyCondition `json:"condition"`
	Threshold        float64          `json:"threshold"`
	Severity         AnomalySeverity  `json:"severity"`
	QuarantineAction QuarantineAction `json:"quarantineAction"`
	CooldownMinutes  int              `json:"cooldownMinutes"`
	Enabled          bool             `json:"enabled"`
	CreatedAt        string           `json:"createdAt"`
	UpdatedAt        string           `json:"updatedAt"`
}

AnomalyRule represents a rule for anomaly detection.

type AnomalyRuleListParams

type AnomalyRuleListParams struct {
	ListParams
	Metric  AnomalyMetric
	Enabled *bool
}

AnomalyRuleListParams contains parameters for listing anomaly rules.

func (AnomalyRuleListParams) ToQuery

func (p AnomalyRuleListParams) ToQuery() url.Values

ToQuery converts AnomalyRuleListParams to URL query values.

type AnomalyService

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

AnomalyService provides methods for managing anomaly detection alerts, rules, baselines, and agent quarantine.

func (*AnomalyService) AcknowledgeAlert

func (s *AnomalyService) AcknowledgeAlert(ctx context.Context, orgID, alertID string) (*AnomalyAlert, error)

AcknowledgeAlert acknowledges an anomaly alert.

func (*AnomalyService) CreateRule

func (s *AnomalyService) CreateRule(ctx context.Context, orgID string, input CreateAnomalyRuleInput) (*AnomalyRule, error)

CreateRule creates a new anomaly detection rule.

func (*AnomalyService) DeleteRule

func (s *AnomalyService) DeleteRule(ctx context.Context, orgID, ruleID string) error

DeleteRule deletes an anomaly detection rule.

func (*AnomalyService) GetBaseline

func (s *AnomalyService) GetBaseline(ctx context.Context, orgID, agentID string) (*AgentBaseline, error)

GetBaseline retrieves the behavioral baselines for an agent.

func (*AnomalyService) ListAlerts

func (s *AnomalyService) ListAlerts(ctx context.Context, orgID string, params *AnomalyAlertListParams) (*Page[AnomalyAlert], error)

ListAlerts returns a paginated list of anomaly alerts for an organization.

func (*AnomalyService) ListAlertsAutoPaging

func (s *AnomalyService) ListAlertsAutoPaging(orgID string, params *AnomalyAlertListParams) *ListIterator[AnomalyAlert]

ListAlertsAutoPaging returns an iterator that automatically paginates through all anomaly alerts.

func (*AnomalyService) ListRules

func (s *AnomalyService) ListRules(ctx context.Context, orgID string, params *AnomalyRuleListParams) (*Page[AnomalyRule], error)

ListRules returns a paginated list of anomaly detection rules for an organization.

func (*AnomalyService) ListRulesAutoPaging

func (s *AnomalyService) ListRulesAutoPaging(orgID string, params *AnomalyRuleListParams) *ListIterator[AnomalyRule]

ListRulesAutoPaging returns an iterator that automatically paginates through all anomaly rules.

func (*AnomalyService) MarkFalsePositive

func (s *AnomalyService) MarkFalsePositive(ctx context.Context, orgID, alertID string) (*AnomalyAlert, error)

MarkFalsePositive marks an anomaly alert as a false positive.

func (*AnomalyService) Quarantine

func (s *AnomalyService) Quarantine(ctx context.Context, orgID, agentID string, input QuarantineInput) (*QuarantineOutput, error)

Quarantine sets the quarantine level for an agent.

func (*AnomalyService) ReleaseQuarantine

func (s *AnomalyService) ReleaseQuarantine(ctx context.Context, orgID, agentID string) (*QuarantineOutput, error)

ReleaseQuarantine releases an agent from quarantine.

func (*AnomalyService) ResolveAlert

func (s *AnomalyService) ResolveAlert(ctx context.Context, orgID, alertID string) (*AnomalyAlert, error)

ResolveAlert resolves an anomaly alert.

func (*AnomalyService) UpdateRule

func (s *AnomalyService) UpdateRule(ctx context.Context, orgID, ruleID string, input UpdateAnomalyRuleInput) (*AnomalyRule, error)

UpdateRule updates an existing anomaly detection rule.

type AnomalySeverity

type AnomalySeverity string

AnomalySeverity represents the severity of an anomaly alert.

const (
	AnomalySeverityInfo     AnomalySeverity = "INFO"
	AnomalySeverityWarning  AnomalySeverity = "WARNING"
	AnomalySeverityCritical AnomalySeverity = "CRITICAL"
)

type ApprovalDecision

type ApprovalDecision string

ApprovalDecision is the decision to approve or decline a card transaction.

const (
	ApprovalDecisionApproved ApprovalDecision = "APPROVED"
	ApprovalDecisionDeclined ApprovalDecision = "DECLINED"
)

type ApprovalList

type ApprovalList struct {
	Items  []CardApproval `json:"items"`
	Cursor *string        `json:"cursor,omitempty"`
}

ApprovalList wraps a list of approvals with a cursor.

type ApprovalListParams

type ApprovalListParams struct {
	ListParams
	Status ApprovalStatus
}

ApprovalListParams contains parameters for listing approvals.

func (ApprovalListParams) ToQuery

func (p ApprovalListParams) ToQuery() url.Values

ToQuery converts ApprovalListParams to URL query values.

type ApprovalStatus

type ApprovalStatus string

ApprovalStatus represents the status of a card approval.

const (
	ApprovalStatusPending  ApprovalStatus = "PENDING"
	ApprovalStatusApproved ApprovalStatus = "APPROVED"
	ApprovalStatusDeclined ApprovalStatus = "DECLINED"
	ApprovalStatusExpired  ApprovalStatus = "EXPIRED"
)

type Attachment

type Attachment struct {
	ID         string  `json:"id"`
	Filename   string  `json:"filename"`
	MimeType   string  `json:"mimeType"`
	SizeBytes  int64   `json:"sizeBytes"`
	StorageKey string  `json:"storageKey"`
	URL        *string `json:"url"`
	CreatedAt  string  `json:"createdAt"`
}

Attachment represents an uploaded attachment.

type AttachmentDownload

type AttachmentDownload struct {
	URL       string `json:"url"`
	ExpiresAt string `json:"expiresAt"`
}

AttachmentDownload contains a pre-signed URL for downloading an attachment.

type AttachmentOutput

type AttachmentOutput struct {
	ID         string  `json:"id"`
	Filename   string  `json:"filename"`
	MimeType   string  `json:"mimeType"`
	SizeBytes  int64   `json:"sizeBytes"`
	StorageKey string  `json:"storageKey"`
	URL        *string `json:"url"`
	CreatedAt  string  `json:"createdAt"`
}

AttachmentOutput represents an attachment on a message.

type AuditActorType

type AuditActorType string

AuditActorType represents the type of actor that performed an audited action.

const (
	AuditActorAPIKey AuditActorType = "api_key"
	AuditActorUser   AuditActorType = "user"
	AuditActorSystem AuditActorType = "system"
	AuditActorAgent  AuditActorType = "agent"
)

type AuditExportFormat

type AuditExportFormat string

AuditExportFormat represents the export format for audit logs.

const (
	AuditExportFormatCSV  AuditExportFormat = "csv"
	AuditExportFormatJSON AuditExportFormat = "json"
)

type AuditLog

type AuditLog struct {
	ID           string                 `json:"id"`
	OrgID        string                 `json:"orgId"`
	ActorType    AuditActorType         `json:"actorType"`
	ActorID      string                 `json:"actorId"`
	Action       string                 `json:"action"`
	ResourceType string                 `json:"resourceType"`
	ResourceID   string                 `json:"resourceId"`
	Result       AuditResult            `json:"result"`
	IPAddress    *string                `json:"ipAddress"`
	UserAgent    *string                `json:"userAgent"`
	Metadata     map[string]interface{} `json:"metadata"`
	CreatedAt    string                 `json:"createdAt"`
}

AuditLog represents an immutable audit log entry.

type AuditLogExportOutput

type AuditLogExportOutput struct {
	URL         string            `json:"url"`
	Format      AuditExportFormat `json:"format"`
	RecordCount int               `json:"recordCount"`
	ExpiresAt   string            `json:"expiresAt"`
}

AuditLogExportOutput contains the result of an audit log export.

type AuditLogExportParams

type AuditLogExportParams struct {
	Format       AuditExportFormat `json:"format,omitempty"`
	From         string            `json:"from,omitempty"`
	To           string            `json:"to,omitempty"`
	ActorID      string            `json:"actorId,omitempty"`
	Action       string            `json:"action,omitempty"`
	ResourceType string            `json:"resourceType,omitempty"`
}

AuditLogExportParams contains parameters for exporting audit logs.

type AuditLogListParams

type AuditLogListParams struct {
	ListParams
	ActorID      string
	ActorType    AuditActorType
	Action       string
	ResourceType string
	ResourceID   string
	Result       AuditResult
	From         string
	To           string
}

AuditLogListParams contains parameters for listing audit log entries.

func (AuditLogListParams) ToQuery

func (p AuditLogListParams) ToQuery() url.Values

ToQuery converts AuditLogListParams to URL query values.

type AuditResult

type AuditResult string

AuditResult represents the outcome of an audited action.

const (
	AuditResultSuccess AuditResult = "success"
	AuditResultFailure AuditResult = "failure"
	AuditResultDenied  AuditResult = "denied"
)

type AuditService

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

AuditService provides methods for querying and exporting immutable audit logs.

func (*AuditService) Export

Export initiates an audit log export and returns a download URL.

func (*AuditService) Get

func (s *AuditService) Get(ctx context.Context, orgID, logID string) (*AuditLog, error)

Get retrieves a single audit log entry by ID.

func (*AuditService) List

func (s *AuditService) List(ctx context.Context, orgID string, params *AuditLogListParams) (*Page[AuditLog], error)

List returns a paginated list of audit log entries for an organization.

func (*AuditService) ListAutoPaging

func (s *AuditService) ListAutoPaging(orgID string, params *AuditLogListParams) *ListIterator[AuditLog]

ListAutoPaging returns an iterator that automatically paginates through all audit log entries.

type AvailableNumber

type AvailableNumber struct {
	PhoneNumber  string            `json:"phoneNumber"`
	Region       string            `json:"region,omitempty"`
	Capabilities PhoneCapabilities `json:"capabilities"`
	MonthlyCost  float64           `json:"monthlyCost,omitempty"`
}

AvailableNumber represents a phone number available for provisioning.

type AvailableNumberList

type AvailableNumberList struct {
	Items []AvailableNumber `json:"items"`
}

AvailableNumberList wraps a list of available phone numbers.

type BaselineMetric

type BaselineMetric struct {
	Metric        AnomalyMetric      `json:"metric"`
	Period        BaselinePeriod     `json:"period"`
	Mean          float64            `json:"mean"`
	Stddev        float64            `json:"stddev"`
	SampleCount   int                `json:"sampleCount"`
	HourlyPattern map[string]float64 `json:"hourlyPattern"`
	WindowStart   string             `json:"windowStart"`
	WindowEnd     string             `json:"windowEnd"`
}

BaselineMetric represents a single behavioral metric baseline.

type BaselinePeriod

type BaselinePeriod string

BaselinePeriod represents the time period for a behavioral baseline.

const (
	BaselinePeriodHourly BaselinePeriod = "hourly"
	BaselinePeriodDaily  BaselinePeriod = "daily"
)

type Call

type Call struct {
	ID              string  `json:"id"`
	AgentID         string  `json:"agentId"`
	PhoneIdentityID string  `json:"phoneIdentityId"`
	Direction       string  `json:"direction"`
	Tier            string  `json:"tier"`
	State           string  `json:"state"`
	From            string  `json:"from"`
	To              string  `json:"to"`
	StartedAt       string  `json:"startedAt"`
	AnsweredAt      *string `json:"answeredAt"`
	EndedAt         *string `json:"endedAt"`
	EndReason       *string `json:"endReason"`
	DurationSeconds *int    `json:"durationSeconds"`
	CreatedAt       string  `json:"createdAt"`
}

Call represents a voice call.

type CallList

type CallList struct {
	Calls []Call `json:"calls"`
	Total int    `json:"total"`
}

CallList wraps a list of calls with total count.

type CallTranscript

type CallTranscript struct {
	CallID   string              `json:"callId"`
	Segments []TranscriptSegment `json:"segments"`
}

CallTranscript contains the full transcript for a call.

type CallsService

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

CallsService provides methods for managing voice calls.

func (*CallsService) Connect

Connect opens a bidirectional WebSocket connection for real-time voice call control.

func (*CallsService) Create

Create creates a new outbound call.

func (*CallsService) Get

func (s *CallsService) Get(ctx context.Context, callID string) (*Call, error)

Get returns a specific call by ID.

func (*CallsService) GetTranscript

func (s *CallsService) GetTranscript(ctx context.Context, callID string) (*CallTranscript, error)

GetTranscript returns the transcript for a call.

func (*CallsService) List

func (s *CallsService) List(ctx context.Context, params ListCallsParams) (*CallList, error)

List returns a list of calls, optionally filtered.

type Card

type Card struct {
	ID                string     `json:"id"`
	AgentID           string     `json:"agentId"`
	OrgID             string     `json:"orgId"`
	ProviderCardID    string     `json:"providerCardId"`
	CardType          CardType   `json:"cardType"`
	Status            CardStatus `json:"status"`
	Last4             string     `json:"last4"`
	Brand             string     `json:"brand"`
	ExpMonth          int        `json:"expMonth"`
	ExpYear           int        `json:"expYear"`
	Currency          string     `json:"currency"`
	Label             *string    `json:"label"`
	SpendLimitDaily   *int       `json:"spendLimitDaily"`
	SpendLimitMonthly *int       `json:"spendLimitMonthly"`
	SpendLimitPerAuth *int       `json:"spendLimitPerAuth"`
	SpentToday        int        `json:"spentToday"`
	SpentThisMonth    int        `json:"spentThisMonth"`
	KillSwitchActive  bool       `json:"killSwitchActive"`
	CreatedAt         string     `json:"createdAt"`
	UpdatedAt         string     `json:"updatedAt"`
}

Card represents a virtual or physical card in the Anima platform.

type CardApproval

type CardApproval struct {
	ID           string         `json:"id"`
	OrgID        string         `json:"orgId"`
	CardID       string         `json:"cardId"`
	AmountCents  int            `json:"amountCents"`
	Currency     string         `json:"currency"`
	MerchantName *string        `json:"merchantName"`
	Status       ApprovalStatus `json:"status"`
	DecidedBy    *string        `json:"decidedBy"`
	ExpiresAt    string         `json:"expiresAt"`
	CreatedAt    string         `json:"createdAt"`
}

CardApproval represents a pending card approval.

type CardList

type CardList struct {
	Items  []Card  `json:"items"`
	Cursor *string `json:"cursor,omitempty"`
}

CardList wraps a list of cards with a cursor.

type CardListParams

type CardListParams struct {
	ListParams
	AgentID string
	Status  CardStatus
}

CardListParams contains parameters for listing cards.

func (CardListParams) ToQuery

func (p CardListParams) ToQuery() url.Values

ToQuery converts CardListParams to URL query values.

type CardStatus

type CardStatus string

CardStatus represents the status of a card.

const (
	CardStatusActive   CardStatus = "ACTIVE"
	CardStatusFrozen   CardStatus = "FROZEN"
	CardStatusCanceled CardStatus = "CANCELED"
)

type CardTransaction

type CardTransaction struct {
	ID                   string            `json:"id"`
	CardID               string            `json:"cardId"`
	Status               TransactionStatus `json:"status"`
	Decision             *string           `json:"decision"`
	AmountCents          int               `json:"amountCents"`
	Currency             string            `json:"currency"`
	MerchantName         *string           `json:"merchantName"`
	MerchantCategory     *string           `json:"merchantCategory"`
	MerchantCategoryCode *string           `json:"merchantCategoryCode"`
	CreatedAt            string            `json:"createdAt"`
}

CardTransaction represents a card transaction.

type CardType

type CardType string

CardType represents the type of a card.

const (
	CardTypeVirtual  CardType = "VIRTUAL"
	CardTypePhysical CardType = "PHYSICAL"
)

type CardsService

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

CardsService provides methods for managing cards, spending policies, transactions, and approvals.

func (*CardsService) Create

func (s *CardsService) Create(ctx context.Context, params CreateCardParams) (*Card, error)

Create creates a new virtual card.

func (*CardsService) CreatePolicy

func (s *CardsService) CreatePolicy(ctx context.Context, params CreatePolicyParams) (*SpendingPolicy, error)

CreatePolicy creates a spending policy for a card.

func (*CardsService) DecideApproval

func (s *CardsService) DecideApproval(ctx context.Context, approvalID string, decision ApprovalDecision) (*CardApproval, error)

DecideApproval approves or declines a card approval.

func (*CardsService) Delete

func (s *CardsService) Delete(ctx context.Context, id string) error

Delete cancels and removes a card.

func (*CardsService) DeletePolicy

func (s *CardsService) DeletePolicy(ctx context.Context, policyID string) error

DeletePolicy deletes a spending policy.

func (*CardsService) Freeze

func (s *CardsService) Freeze(ctx context.Context, id string) (*Card, error)

Freeze freezes a card, preventing any transactions.

func (*CardsService) Get

func (s *CardsService) Get(ctx context.Context, id string) (*Card, error)

Get retrieves a card by ID.

func (*CardsService) GetTransaction

func (s *CardsService) GetTransaction(ctx context.Context, transactionID string) (*CardTransaction, error)

GetTransaction retrieves a transaction by ID.

func (*CardsService) KillSwitch

func (s *CardsService) KillSwitch(ctx context.Context, params KillSwitchParams) (*KillSwitchResult, error)

KillSwitch activates or deactivates the kill switch for a card or agent.

func (*CardsService) List

func (s *CardsService) List(ctx context.Context, params *CardListParams) (*CardList, error)

List returns a list of cards.

func (*CardsService) ListApprovals

func (s *CardsService) ListApprovals(ctx context.Context, params *ApprovalListParams) (*ApprovalList, error)

ListApprovals returns a list of pending card approvals.

func (*CardsService) ListPolicies

func (s *CardsService) ListPolicies(ctx context.Context, cardID string) ([]SpendingPolicy, error)

ListPolicies lists all spending policies for a card.

func (*CardsService) ListTransactions

func (s *CardsService) ListTransactions(ctx context.Context, params *TransactionListParams) (*TransactionList, error)

ListTransactions returns a list of card transactions.

func (*CardsService) Unfreeze

func (s *CardsService) Unfreeze(ctx context.Context, id string) (*Card, error)

Unfreeze unfreezes a frozen card.

func (*CardsService) Update

func (s *CardsService) Update(ctx context.Context, id string, params UpdateCardParams) (*Card, error)

Update updates a card.

func (*CardsService) UpdatePolicy

func (s *CardsService) UpdatePolicy(ctx context.Context, policyID string, params UpdatePolicyParams) (*SpendingPolicy, error)

UpdatePolicy updates a spending policy.

type Client

type Client struct {

	// Anomaly provides methods for anomaly detection alerts, rules, baselines, and quarantine.
	Anomaly *AnomalyService
	// Audit provides methods for querying and exporting immutable audit logs.
	Audit *AuditService

	// A2A provides methods for agent-to-agent communication.
	A2A *A2AService
	// Addresses provides methods for managing agent physical addresses.
	Addresses *AddressesService
	// Agents provides methods for managing agents.
	Agents *AgentsService
	// Cards provides methods for managing cards, policies, and transactions.
	Cards *CardsService
	// Compliance provides methods for compliance controls, reports, dashboards, and DSARs.
	Compliance *ComplianceService
	// Domains provides methods for managing email domains.
	Domains *DomainsService
	// Emails provides methods for listing emails and managing attachments.
	Emails *EmailsService
	// Identity provides methods for managing agent decentralized identity (DID).
	Identity *IdentityService
	// Messages provides methods for sending and listing messages.
	Messages *MessagesService
	// Organizations provides methods for managing organizations.
	Organizations *OrganizationsService
	// Phones provides methods for provisioning and managing phone numbers.
	Phones *PhonesService
	// Pods provides methods for managing agent compute pods.
	Pods *PodsService
	// Registry provides methods for the public agent registry.
	Registry *RegistryService
	// Security provides methods for content scanning and security events.
	Security *SecurityService
	// Vault provides methods for managing the agent credential vault.
	Vault *VaultService
	// VaultOAuth provides methods for managing OAuth connections.
	VaultOAuth *VaultOAuthService
	// Wallet provides methods for managing agent crypto wallets.
	Wallet *WalletService
	// Voices provides methods for browsing the voice catalog.
	Voices *VoicesService
	// Calls provides methods for managing voice calls.
	Calls *CallsService
	// Webhooks provides methods for managing webhooks.
	Webhooks *WebhooksService
	// contains filtered or unexported fields
}

Client is the Anima API client. Create one with NewClient.

func NewClient

func NewClient(apiKey string, opts ...Option) *Client

NewClient creates a new Anima API client.

If apiKey is empty, the ANIMA_API_KEY environment variable is used. If no key is found, NewClient panics.

The base URL defaults to DefaultBaseURL, but can be overridden with WithBaseURL or the ANIMA_API_URL environment variable.

client := anima.NewClient("",  // uses ANIMA_API_KEY env var
    anima.WithTimeout(10 * time.Second),
)

func (*Client) HTTPClient

func (c *Client) HTTPClient() *httpClient

HTTPClient returns the internal httpClient for use by service implementations. This is not part of the public API surface.

type CompleteDSARInput

type CompleteDSARInput struct {
	Notes    string                 `json:"notes,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

CompleteDSARInput contains parameters for completing a DSAR.

type ComplianceControl

type ComplianceControl struct {
	ID           string                  `json:"id"`
	OrgID        string                  `json:"orgId"`
	Framework    ComplianceFramework     `json:"framework"`
	ControlID    string                  `json:"controlId"`
	Title        string                  `json:"title"`
	Description  string                  `json:"description"`
	Category     string                  `json:"category"`
	Status       ComplianceControlStatus `json:"status"`
	Owner        *string                 `json:"owner"`
	LastTestedAt *string                 `json:"lastTestedAt"`
	NextReviewAt *string                 `json:"nextReviewAt"`
	CreatedAt    string                  `json:"createdAt"`
	UpdatedAt    string                  `json:"updatedAt"`
}

ComplianceControl represents a compliance control within a framework.

type ComplianceControlListParams

type ComplianceControlListParams struct {
	ListParams
	Framework ComplianceFramework
	Category  string
	Status    ComplianceControlStatus
}

ComplianceControlListParams contains parameters for listing compliance controls.

func (ComplianceControlListParams) ToQuery

ToQuery converts ComplianceControlListParams to URL query values.

type ComplianceControlStatus

type ComplianceControlStatus string

ComplianceControlStatus represents the status of a compliance control.

const (
	ComplianceControlStatusNotStarted  ComplianceControlStatus = "not_started"
	ComplianceControlStatusInProgress  ComplianceControlStatus = "in_progress"
	ComplianceControlStatusImplemented ComplianceControlStatus = "implemented"
	ComplianceControlStatusVerified    ComplianceControlStatus = "verified"
	ComplianceControlStatusFailed      ComplianceControlStatus = "failed"
)

type ComplianceControlStatusInput

type ComplianceControlStatusInput struct {
	Status ComplianceControlStatus `json:"status"`
	Owner  string                  `json:"owner,omitempty"`
}

ComplianceControlStatusInput contains parameters for updating a control's status.

type ComplianceDashboard

type ComplianceDashboard struct {
	OrgID          string                                `json:"orgId"`
	Frameworks     map[string]ComplianceFrameworkSummary `json:"frameworks"`
	OverallScore   float64                               `json:"overallScore"`
	RecentActivity []ComplianceReport                    `json:"recentActivity"`
}

ComplianceDashboard contains an overview of compliance status across frameworks.

type ComplianceFramework

type ComplianceFramework string

ComplianceFramework represents a compliance framework (e.g. SOC2, GDPR, PCI).

const (
	ComplianceFrameworkSOC2 ComplianceFramework = "SOC2"
	ComplianceFrameworkGDPR ComplianceFramework = "GDPR"
	ComplianceFrameworkPCI  ComplianceFramework = "PCI"
)

type ComplianceFrameworkSummary

type ComplianceFrameworkSummary struct {
	TotalControls int     `json:"totalControls"`
	Implemented   int     `json:"implemented"`
	Verified      int     `json:"verified"`
	Failed        int     `json:"failed"`
	NotStarted    int     `json:"notStarted"`
	Score         float64 `json:"score"`
}

ComplianceFrameworkSummary contains summary statistics for a single framework.

type ComplianceReport

type ComplianceReport struct {
	ID          string                 `json:"id"`
	OrgID       string                 `json:"orgId"`
	Type        ComplianceReportType   `json:"type"`
	Status      string                 `json:"status"`
	Title       string                 `json:"title"`
	Summary     *string                `json:"summary"`
	Data        map[string]interface{} `json:"data"`
	GeneratedAt string                 `json:"generatedAt"`
	CreatedAt   string                 `json:"createdAt"`
	UpdatedAt   string                 `json:"updatedAt"`
}

ComplianceReport represents a generated compliance report.

type ComplianceReportDownloadOutput

type ComplianceReportDownloadOutput struct {
	URL       string `json:"url"`
	Format    string `json:"format"`
	ExpiresAt string `json:"expiresAt"`
}

ComplianceReportDownloadOutput contains a download URL for a compliance report.

type ComplianceReportListParams

type ComplianceReportListParams struct {
	ListParams
	Type ComplianceReportType
}

ComplianceReportListParams contains parameters for listing compliance reports.

func (ComplianceReportListParams) ToQuery

ToQuery converts ComplianceReportListParams to URL query values.

type ComplianceReportType

type ComplianceReportType string

ComplianceReportType represents the type of a compliance report.

const (
	ComplianceReportTypeSOC2Summary    ComplianceReportType = "soc2_summary"
	ComplianceReportTypeActivityReport ComplianceReportType = "activity_report"
	ComplianceReportTypeAccessReview   ComplianceReportType = "access_review"
	ComplianceReportTypeAuditExport    ComplianceReportType = "audit_export"
	ComplianceReportTypeGDPRDSAR       ComplianceReportType = "gdpr_dsar"
)

type ComplianceService

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

ComplianceService provides methods for managing compliance controls, reports, dashboards, and Data Subject Access Requests (DSARs).

func (*ComplianceService) CompleteDSAR

func (s *ComplianceService) CompleteDSAR(ctx context.Context, orgID, dsarID string, input *CompleteDSARInput) (*DataSubjectRequest, error)

CompleteDSAR marks a Data Subject Access Request as completed.

func (*ComplianceService) CreateDSAR

func (s *ComplianceService) CreateDSAR(ctx context.Context, orgID string, input CreateDSARInput) (*DataSubjectRequest, error)

CreateDSAR creates a new Data Subject Access Request.

func (*ComplianceService) DownloadReport

func (s *ComplianceService) DownloadReport(ctx context.Context, orgID, reportID string) (*ComplianceReportDownloadOutput, error)

DownloadReport returns a temporary download URL for a compliance report.

func (*ComplianceService) GenerateReport

func (s *ComplianceService) GenerateReport(ctx context.Context, orgID string, input GenerateReportInput) (*ComplianceReport, error)

GenerateReport generates a new compliance report.

func (*ComplianceService) GetControl

func (s *ComplianceService) GetControl(ctx context.Context, orgID, controlID string) (*ComplianceControl, error)

GetControl retrieves a single compliance control by ID.

func (*ComplianceService) GetDashboard

func (s *ComplianceService) GetDashboard(ctx context.Context, orgID string) (*ComplianceDashboard, error)

GetDashboard retrieves the compliance dashboard with summary statistics across all frameworks.

func (*ComplianceService) GetReport

func (s *ComplianceService) GetReport(ctx context.Context, orgID, reportID string) (*ComplianceReport, error)

GetReport retrieves a single compliance report by ID.

func (*ComplianceService) ListControls

ListControls returns a paginated list of compliance controls for an organization.

func (*ComplianceService) ListControlsAutoPaging

func (s *ComplianceService) ListControlsAutoPaging(orgID string, params *ComplianceControlListParams) *ListIterator[ComplianceControl]

ListControlsAutoPaging returns an iterator that automatically paginates through all compliance controls.

func (*ComplianceService) ListDSARs

func (s *ComplianceService) ListDSARs(ctx context.Context, orgID string, params *DSARListParams) (*Page[DataSubjectRequest], error)

ListDSARs returns a paginated list of Data Subject Access Requests.

func (*ComplianceService) ListDSARsAutoPaging

func (s *ComplianceService) ListDSARsAutoPaging(orgID string, params *DSARListParams) *ListIterator[DataSubjectRequest]

ListDSARsAutoPaging returns an iterator that automatically paginates through all DSARs.

func (*ComplianceService) ListReports

ListReports returns a paginated list of compliance reports for an organization.

func (*ComplianceService) ListReportsAutoPaging

func (s *ComplianceService) ListReportsAutoPaging(orgID string, params *ComplianceReportListParams) *ListIterator[ComplianceReport]

ListReportsAutoPaging returns an iterator that automatically paginates through all compliance reports.

func (*ComplianceService) SeedFramework

func (s *ComplianceService) SeedFramework(ctx context.Context, orgID string, input SeedFrameworkInput) (*SeedFrameworkOutput, error)

SeedFramework seeds all predefined controls for a compliance framework (e.g. SOC2).

func (*ComplianceService) UpdateControlStatus

func (s *ComplianceService) UpdateControlStatus(ctx context.Context, orgID, controlID string, input ComplianceControlStatusInput) (*ComplianceControl, error)

UpdateControlStatus updates the status and optionally the owner of a compliance control.

type ConnectLinkResult

type ConnectLinkResult struct {
	LinkURL   string `json:"linkUrl"`
	Token     string `json:"token"`
	ExpiresAt string `json:"expiresAt"`
}

ConnectLinkResult is the response from creating a Connect Link.

type ConnectLinkStatus

type ConnectLinkStatus struct {
	Status             string  `json:"status"`
	ConnectedAccountID *string `json:"connectedAccountId"`
}

ConnectLinkStatus is the response from checking a Connect Link's status.

type ConnectedAccount

type ConnectedAccount struct {
	ID              string   `json:"id"`
	AgentID         string   `json:"agentId"`
	UserID          *string  `json:"userId"`
	AppDefinitionID string   `json:"appDefinitionId"`
	AppSlug         string   `json:"appSlug"`
	AppName         string   `json:"appName"`
	AppIconURL      *string  `json:"appIconUrl"`
	CustomAppID     *string  `json:"customAppId"`
	GrantedScopes   []string `json:"grantedScopes"`
	AccountLabel    *string  `json:"accountLabel"`
	AccountEmail    *string  `json:"accountEmail"`
	Status          string   `json:"status"`
	StatusMessage   *string  `json:"statusMessage"`
	TokenExpiresAt  *string  `json:"tokenExpiresAt"`
	LastRefreshedAt *string  `json:"lastRefreshedAt"`
	CreatedAt       string   `json:"createdAt"`
	UpdatedAt       string   `json:"updatedAt"`
}

ConnectedAccount represents an agent's authenticated connection to a service.

type ConnectedAccountList

type ConnectedAccountList struct {
	Items []ConnectedAccount `json:"items"`
}

ConnectedAccountList wraps a list of connected accounts.

type CreateAddressParams

type CreateAddressParams struct {
	AgentID    string `json:"agentId"`
	Type       string `json:"type,omitempty"`
	Line1      string `json:"line1"`
	Line2      string `json:"line2,omitempty"`
	City       string `json:"city"`
	State      string `json:"state"`
	PostalCode string `json:"postalCode"`
	Country    string `json:"country"`
	Primary    bool   `json:"primary,omitempty"`
}

CreateAddressParams contains the parameters for creating an address.

type CreateAgentParams

type CreateAgentParams struct {
	OrgID          string                 `json:"orgId"`
	Name           string                 `json:"name"`
	Slug           string                 `json:"slug"`
	Email          string                 `json:"email,omitempty"`
	ProvisionPhone bool                   `json:"provisionPhone,omitempty"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
}

CreateAgentParams contains the parameters for creating an agent.

type CreateAnomalyRuleInput

type CreateAnomalyRuleInput struct {
	Name             string           `json:"name"`
	Metric           AnomalyMetric    `json:"metric"`
	Condition        AnomalyCondition `json:"condition"`
	Threshold        float64          `json:"threshold"`
	Severity         AnomalySeverity  `json:"severity"`
	QuarantineAction QuarantineAction `json:"quarantineAction,omitempty"`
	CooldownMinutes  *int             `json:"cooldownMinutes,omitempty"`
	Enabled          *bool            `json:"enabled,omitempty"`
}

CreateAnomalyRuleInput contains parameters for creating an anomaly detection rule.

type CreateCallOptions

type CreateCallOptions struct {
	Tier       string
	Greeting   string
	FromNumber string
}

CreateCallOptions contains optional parameters for creating a call via WebSocket.

type CreateCallOutput

type CreateCallOutput struct {
	CallID    string `json:"callId"`
	State     string `json:"state"`
	From      string `json:"from"`
	To        string `json:"to"`
	Tier      string `json:"tier"`
	Direction string `json:"direction"`
}

CreateCallOutput contains the result of creating a call.

type CreateCallParams

type CreateCallParams struct {
	To         string `json:"to"`
	AgentID    string `json:"agentId,omitempty"`
	Tier       string `json:"tier,omitempty"`
	Greeting   string `json:"greeting,omitempty"`
	FromNumber string `json:"fromNumber,omitempty"`
}

CreateCallParams contains parameters for creating an outbound call.

type CreateCardParams

type CreateCardParams struct {
	AgentID           string            `json:"agentId"`
	Label             string            `json:"label,omitempty"`
	Currency          string            `json:"currency,omitempty"`
	SpendLimitDaily   *int              `json:"spendLimitDaily,omitempty"`
	SpendLimitMonthly *int              `json:"spendLimitMonthly,omitempty"`
	SpendLimitPerAuth *int              `json:"spendLimitPerAuth,omitempty"`
	Metadata          map[string]string `json:"metadata,omitempty"`
}

CreateCardParams contains the parameters for creating a card.

type CreateConnectLinkParams

type CreateConnectLinkParams struct {
	AgentID     string   `json:"agentId,omitempty"`
	AppSlug     string   `json:"appSlug"`
	UserID      string   `json:"userId,omitempty"`
	Scopes      []string `json:"scopes,omitempty"`
	CallbackURL string   `json:"callbackUrl,omitempty"`
	CustomAppID string   `json:"customAppId,omitempty"`
}

CreateConnectLinkParams contains parameters for creating a Connect Link.

type CreateDSARInput

type CreateDSARInput struct {
	SubjectEmail string                 `json:"subjectEmail"`
	RequestType  DSARRequestType        `json:"requestType"`
	Description  string                 `json:"description,omitempty"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
}

CreateDSARInput contains parameters for creating a Data Subject Access Request.

type CreateOrganizationParams

type CreateOrganizationParams struct {
	Name       string                 `json:"name"`
	Slug       string                 `json:"slug"`
	ClerkOrgID string                 `json:"clerkOrgId,omitempty"`
	Tier       Tier                   `json:"tier,omitempty"`
	Settings   map[string]interface{} `json:"settings,omitempty"`
}

CreateOrganizationParams contains the parameters for creating an organization.

type CreatePodParams

type CreatePodParams struct {
	AgentID   string                 `json:"agentId"`
	Name      string                 `json:"name"`
	Image     string                 `json:"image,omitempty"`
	Resources *PodResources          `json:"resources,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

CreatePodParams contains the parameters for creating a pod.

type CreatePolicyParams

type CreatePolicyParams struct {
	CardID            string       `json:"cardId"`
	Name              string       `json:"name"`
	Priority          int          `json:"priority,omitempty"`
	Action            PolicyAction `json:"action"`
	MaxAmountCents    *int         `json:"maxAmountCents,omitempty"`
	MinAmountCents    *int         `json:"minAmountCents,omitempty"`
	AllowedCategories []string     `json:"allowedCategories,omitempty"`
	BlockedCategories []string     `json:"blockedCategories,omitempty"`
	AllowedMerchants  []string     `json:"allowedMerchants,omitempty"`
	BlockedMerchants  []string     `json:"blockedMerchants,omitempty"`
	AllowedCountries  []string     `json:"allowedCountries,omitempty"`
	BlockedCountries  []string     `json:"blockedCountries,omitempty"`
}

CreatePolicyParams contains the parameters for creating a spending policy.

type CreateTokenParams

type CreateTokenParams struct {
	CredentialID string `json:"credentialId"`
	Scope        string `json:"scope"`
	AgentID      string `json:"agentId,omitempty"`
	TTLSeconds   *int   `json:"ttlSeconds,omitempty"`
}

CreateTokenParams contains parameters for creating an ephemeral token.

type CreateVaultCredentialParams

type CreateVaultCredentialParams struct {
	AgentID  string             `json:"agentId"`
	Type     CredentialType     `json:"type"`
	Name     string             `json:"name"`
	Notes    string             `json:"notes,omitempty"`
	Login    *VaultLoginData    `json:"login,omitempty"`
	Card     *VaultCardData     `json:"card,omitempty"`
	Identity *VaultIdentityData `json:"identity,omitempty"`
	Fields   []VaultCustomField `json:"fields,omitempty"`
	Favorite bool               `json:"favorite,omitempty"`
}

CreateVaultCredentialParams contains the parameters for creating a credential.

type CreateWalletParams

type CreateWalletParams struct {
	Network  string `json:"network,omitempty"`
	Currency string `json:"currency,omitempty"`
}

CreateWalletParams contains the parameters for creating an agent wallet.

type CreateWebhookParams

type CreateWebhookParams struct {
	URL         string             `json:"url"`
	Events      []WebhookEventType `json:"events"`
	Description string             `json:"description,omitempty"`
	Active      *bool              `json:"active,omitempty"`
}

CreateWebhookParams contains the parameters for creating a webhook.

type CredentialType

type CredentialType string

CredentialType represents the type of a vault credential.

const (
	CredentialTypeLogin      CredentialType = "login"
	CredentialTypeSecureNote CredentialType = "secure_note"
	CredentialTypeCard       CredentialType = "card"
	CredentialTypeIdentity   CredentialType = "identity"
)

type CursorPagination

type CursorPagination struct {
	NextCursor *string `json:"nextCursor"`
	HasMore    bool    `json:"hasMore"`
}

CursorPagination contains cursor-based pagination metadata.

type DSARListParams

type DSARListParams struct {
	ListParams
	Status DSARStatus
}

DSARListParams contains parameters for listing DSARs.

func (DSARListParams) ToQuery

func (p DSARListParams) ToQuery() url.Values

ToQuery converts DSARListParams to URL query values.

type DSARRequestType

type DSARRequestType string

DSARRequestType represents the type of a DSAR.

const (
	DSARRequestTypeAccess        DSARRequestType = "access"
	DSARRequestTypeDeletion      DSARRequestType = "deletion"
	DSARRequestTypeRectification DSARRequestType = "rectification"
	DSARRequestTypePortability   DSARRequestType = "portability"
)

type DSARStatus

type DSARStatus string

DSARStatus represents the status of a Data Subject Access Request.

const (
	DSARStatusPending    DSARStatus = "pending"
	DSARStatusInProgress DSARStatus = "in_progress"
	DSARStatusCompleted  DSARStatus = "completed"
	DSARStatusRejected   DSARStatus = "rejected"
)

type DataSubjectRequest

type DataSubjectRequest struct {
	ID           string                 `json:"id"`
	OrgID        string                 `json:"orgId"`
	SubjectEmail string                 `json:"subjectEmail"`
	RequestType  string                 `json:"requestType"`
	Status       DSARStatus             `json:"status"`
	Description  *string                `json:"description"`
	Metadata     map[string]interface{} `json:"metadata"`
	CompletedAt  *string                `json:"completedAt"`
	CreatedAt    string                 `json:"createdAt"`
	UpdatedAt    string                 `json:"updatedAt"`
}

DataSubjectRequest represents a GDPR Data Subject Access Request.

type DateRange

type DateRange struct {
	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

DateRange represents a time range filter.

type DeliverabilityStats

type DeliverabilityStats struct {
	Domain        string  `json:"domain"`
	Sent          int     `json:"sent"`
	Delivered     int     `json:"delivered"`
	Bounced       int     `json:"bounced"`
	Complained    int     `json:"complained"`
	BounceRate    float64 `json:"bounceRate"`
	ComplaintRate float64 `json:"complaintRate"`
	IsHealthy     bool    `json:"isHealthy"`
}

DeliverabilityStats contains deliverability statistics for a domain.

type DidDocument

type DidDocument struct {
	ID                 string                  `json:"id"`
	Context            []string                `json:"@context"`
	Controller         string                  `json:"controller,omitempty"`
	VerificationMethod []DidVerificationMethod `json:"verificationMethod,omitempty"`
	Authentication     []string                `json:"authentication,omitempty"`
	AssertionMethod    []string                `json:"assertionMethod,omitempty"`
	KeyAgreement       []string                `json:"keyAgreement,omitempty"`
	Service            []DidService            `json:"service,omitempty"`
	Created            string                  `json:"created,omitempty"`
	Updated            string                  `json:"updated,omitempty"`
}

DidDocument represents a DID (Decentralized Identifier) document for an agent.

type DidRotateOutput

type DidRotateOutput struct {
	DID      string      `json:"did"`
	Document DidDocument `json:"document"`
	Rotated  bool        `json:"rotated"`
}

DidRotateOutput contains the result of a DID key rotation.

type DidService

type DidService struct {
	ID              string `json:"id"`
	Type            string `json:"type"`
	ServiceEndpoint string `json:"serviceEndpoint"`
}

DidService represents a service endpoint in a DID document.

type DidVerificationMethod

type DidVerificationMethod struct {
	ID                 string `json:"id"`
	Type               string `json:"type"`
	Controller         string `json:"controller"`
	PublicKeyMultibase string `json:"publicKeyMultibase,omitempty"`
	PublicKeyJWK       any    `json:"publicKeyJwk,omitempty"`
}

DidVerificationMethod represents a verification method in a DID document.

type Domain

type Domain struct {
	ID                        string               `json:"id"`
	Domain                    string               `json:"domain"`
	Status                    DomainStatus         `json:"status"`
	Verified                  bool                 `json:"verified"`
	VerificationCooldownUntil *string              `json:"verificationCooldownUntil"`
	VerificationToken         string               `json:"verificationToken"`
	VerificationMethod        VerificationMethod   `json:"verificationMethod"`
	DKIMSelector              *string              `json:"dkimSelector"`
	DKIMPublicKey             *string              `json:"dkimPublicKey"`
	SPFConfigured             bool                 `json:"spfConfigured"`
	DMARCConfigured           bool                 `json:"dmarcConfigured"`
	MXConfigured              bool                 `json:"mxConfigured"`
	FeedbackEnabled           bool                 `json:"feedbackEnabled"`
	Records                   []DomainStatusRecord `json:"records"`
	CreatedAt                 string               `json:"createdAt"`
}

Domain represents an email domain in the Anima platform.

type DomainDNSRecord

type DomainDNSRecord struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

DomainDNSRecord represents a single DNS record entry.

type DomainDNSRecordWithPriority

type DomainDNSRecordWithPriority struct {
	Name     string `json:"name"`
	Value    string `json:"value"`
	Priority int    `json:"priority"`
}

DomainDNSRecordWithPriority is a DNS record with a priority field.

type DomainDNSRecords

type DomainDNSRecords struct {
	TXT      DomainDNSRecord             `json:"txt"`
	MailFrom DomainMailFrom              `json:"mailFrom"`
	DKIM     []DomainDNSRecord           `json:"dkim"`
	MX       DomainDNSRecordWithPriority `json:"mx"`
	SPF      string                      `json:"spf"`
	DMARC    string                      `json:"dmarc"`
}

DomainDNSRecords contains all the DNS records needed for a domain.

type DomainList

type DomainList struct {
	Items []Domain `json:"items"`
}

DomainList wraps a list of domains (non-paginated).

type DomainMailFrom

type DomainMailFrom struct {
	Name string                      `json:"name"`
	MX   DomainDNSRecordWithPriority `json:"mx"`
	SPF  string                      `json:"spf"`
}

DomainMailFrom contains the mail-from DNS configuration.

type DomainRecordStatus

type DomainRecordStatus string

DomainRecordStatus represents the status of a DNS record.

const (
	DomainRecordStatusMissing DomainRecordStatus = "MISSING"
	DomainRecordStatusInvalid DomainRecordStatus = "INVALID"
	DomainRecordStatusValid   DomainRecordStatus = "VALID"
)

type DomainStatus

type DomainStatus string

DomainStatus represents the verification status of a domain.

const (
	DomainStatusNotStarted DomainStatus = "NOT_STARTED"
	DomainStatusPending    DomainStatus = "PENDING"
	DomainStatusVerifying  DomainStatus = "VERIFYING"
	DomainStatusVerified   DomainStatus = "VERIFIED"
	DomainStatusInvalid    DomainStatus = "INVALID"
	DomainStatusFailed     DomainStatus = "FAILED"
)

type DomainStatusRecord

type DomainStatusRecord struct {
	Type     string             `json:"type"`
	Name     string             `json:"name"`
	Value    string             `json:"value"`
	Priority *int               `json:"priority,omitempty"`
	Status   DomainRecordStatus `json:"status"`
}

DomainStatusRecord represents a DNS record and its verification status.

type DomainZoneFile

type DomainZoneFile struct {
	ZoneFile string `json:"zoneFile"`
}

DomainZoneFile contains a zone file export.

type DomainsService

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

DomainsService provides methods for managing email domains.

func (*DomainsService) Add

func (s *DomainsService) Add(ctx context.Context, params AddDomainParams) (*Domain, error)

Add registers a new domain.

func (*DomainsService) DNSRecords

func (s *DomainsService) DNSRecords(ctx context.Context, id string) (*DomainDNSRecords, error)

DNSRecords retrieves the required DNS records for a domain.

func (*DomainsService) Delete

func (s *DomainsService) Delete(ctx context.Context, id string) error

Delete removes a domain.

func (*DomainsService) Deliverability

func (s *DomainsService) Deliverability(ctx context.Context, id string) (*DeliverabilityStats, error)

Deliverability retrieves deliverability stats for a domain.

func (*DomainsService) Get

func (s *DomainsService) Get(ctx context.Context, id string) (*Domain, error)

Get retrieves a domain by ID.

func (*DomainsService) List

func (s *DomainsService) List(ctx context.Context) (*DomainList, error)

List returns all domains.

func (*DomainsService) Update

func (s *DomainsService) Update(ctx context.Context, id string, params UpdateDomainParams) (*Domain, error)

Update updates a domain's settings.

func (*DomainsService) Verify

func (s *DomainsService) Verify(ctx context.Context, id string) (*Domain, error)

Verify triggers domain verification.

func (*DomainsService) ZoneFile

func (s *DomainsService) ZoneFile(ctx context.Context, id string) (*DomainZoneFile, error)

ZoneFile exports the zone file for a domain.

type EmailIdentity

type EmailIdentity struct {
	ID        string `json:"id"`
	Email     string `json:"email"`
	Domain    string `json:"domain"`
	LocalPart string `json:"localPart"`
	IsPrimary bool   `json:"isPrimary"`
	Verified  bool   `json:"verified"`
	CreatedAt string `json:"createdAt"`
}

EmailIdentity represents an email identity attached to an agent.

type EmailListParams

type EmailListParams struct {
	ListParams
	AgentID string
}

EmailListParams contains parameters for listing emails.

func (EmailListParams) ToQuery

func (p EmailListParams) ToQuery() url.Values

ToQuery converts EmailListParams to URL query values.

type EmailsService

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

EmailsService provides methods for managing emails and attachments.

func (*EmailsService) GetAttachmentURL

func (s *EmailsService) GetAttachmentURL(ctx context.Context, attachmentID string) (*AttachmentDownload, error)

GetAttachmentURL retrieves a pre-signed download URL for an attachment.

func (*EmailsService) List

func (s *EmailsService) List(ctx context.Context, params *EmailListParams) (*Page[Message], error)

List returns a paginated list of emails.

func (*EmailsService) ListAutoPaging

func (s *EmailsService) ListAutoPaging(params *EmailListParams) *ListIterator[Message]

ListAutoPaging returns an iterator that automatically paginates through all emails.

func (*EmailsService) UploadAttachment

func (s *EmailsService) UploadAttachment(ctx context.Context, messageID string, params UploadAttachmentParams) (*Attachment, error)

UploadAttachment uploads an attachment to a message.

type GeneratePasswordParams

type GeneratePasswordParams struct {
	Length    int   `json:"length,omitempty"`
	Uppercase *bool `json:"uppercase,omitempty"`
	Lowercase *bool `json:"lowercase,omitempty"`
	Number    *bool `json:"number,omitempty"`
	Special   *bool `json:"special,omitempty"`
}

GeneratePasswordParams contains parameters for generating a password.

type GeneratePasswordResult

type GeneratePasswordResult struct {
	Password string `json:"password"`
}

GeneratePasswordResult contains the generated password.

type GenerateReportInput

type GenerateReportInput struct {
	Type     ComplianceReportType   `json:"type"`
	From     string                 `json:"from,omitempty"`
	To       string                 `json:"to,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

GenerateReportInput contains parameters for generating a compliance report.

type IdentityService

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

IdentityService provides methods for managing agent decentralized identity.

func (*IdentityService) GetAgentCard

func (s *IdentityService) GetAgentCard(ctx context.Context, agentID string) (*AgentCardOutput, error)

GetAgentCard retrieves the public agent card for an agent.

func (*IdentityService) GetDID

func (s *IdentityService) GetDID(ctx context.Context, agentID string) (*DidDocument, error)

GetDID retrieves the DID document for an agent.

func (*IdentityService) ListCredentials

func (s *IdentityService) ListCredentials(ctx context.Context, agentID string) (*VerifiableCredentialList, error)

ListCredentials lists all verifiable credentials for an agent.

func (*IdentityService) ResolveDID

func (s *IdentityService) ResolveDID(ctx context.Context, did string) (*DidDocument, error)

ResolveDID resolves a DID to its DID document.

func (*IdentityService) RotateKeys

func (s *IdentityService) RotateKeys(ctx context.Context, agentID string) (*DidRotateOutput, error)

RotateKeys rotates the cryptographic keys for an agent's DID.

func (*IdentityService) VerifyCredential

func (s *IdentityService) VerifyCredential(ctx context.Context, jwtVC string) (*VerifyCredentialOutput, error)

VerifyCredential verifies a JWT-encoded verifiable credential.

type KillSwitchParams

type KillSwitchParams struct {
	AgentID string `json:"agentId,omitempty"`
	CardID  string `json:"cardId,omitempty"`
	Active  bool   `json:"active"`
}

KillSwitchParams contains the parameters for the kill switch.

type KillSwitchResult

type KillSwitchResult struct {
	Affected int  `json:"affected"`
	Active   bool `json:"active"`
}

KillSwitchResult contains the result of a kill switch operation.

type ListCallsParams

type ListCallsParams struct {
	AgentID   string
	Direction string
	State     string
	Limit     int
	Offset    int
}

ListCallsParams contains parameters for listing calls.

type ListConnectedAccountsParams

type ListConnectedAccountsParams struct {
	AgentID string
	UserID  string
	AppSlug string
	Status  string
}

ListConnectedAccountsParams contains parameters for listing connected accounts.

type ListIterator

type ListIterator[T any] struct {
	// contains filtered or unexported fields
}

ListIterator provides a convenient way to iterate through all pages of a paginated API response.

iter := anima.NewListIterator(fetchPage)
for iter.Next(ctx) {
    item := iter.Current()
    // ...
}
if err := iter.Err(); err != nil {
    // handle error
}

func NewListIterator

func NewListIterator[T any](fetch PageFunc[T]) *ListIterator[T]

NewListIterator creates a new paginated iterator using the given fetch function.

func (*ListIterator[T]) Current

func (it *ListIterator[T]) Current() T

Current returns the current item. Panics if called before Next or after iteration is complete.

func (*ListIterator[T]) Err

func (it *ListIterator[T]) Err() error

Err returns the error that caused iteration to stop, if any.

func (*ListIterator[T]) Next

func (it *ListIterator[T]) Next(ctx context.Context) bool

Next advances the iterator to the next item. It returns true if there is a current item available via Current(). When iteration is complete or an error occurs, it returns false.

func (*ListIterator[T]) Page

func (it *ListIterator[T]) Page() *Page[T]

Page returns the current page of results. Returns nil if no page has been fetched yet.

func (*ListIterator[T]) Reset

func (it *ListIterator[T]) Reset()

Reset resets the iterator to the beginning.

type ListParams

type ListParams struct {
	Cursor string
	Limit  int
}

ListParams are common pagination parameters accepted by list endpoints.

func (ListParams) ToQuery

func (p ListParams) ToQuery() url.Values

ToQuery converts ListParams into URL query values.

type ListVaultCredentialsParams

type ListVaultCredentialsParams struct {
	AgentID string
	Type    CredentialType
}

ListVaultCredentialsParams contains parameters for listing vault credentials.

type ListVoicesParams

type ListVoicesParams struct {
	Tier     string
	Gender   string
	Language string
}

ListVoicesParams contains parameters for filtering the voice catalog.

type Message

type Message struct {
	ID          string                 `json:"id"`
	AgentID     string                 `json:"agentId"`
	Channel     MessageChannel         `json:"channel"`
	Direction   MessageDirection       `json:"direction"`
	Status      MessageStatus          `json:"status"`
	FromAddress string                 `json:"fromAddress"`
	ToAddress   string                 `json:"toAddress"`
	Subject     *string                `json:"subject"`
	Body        string                 `json:"body"`
	BodyHTML    *string                `json:"bodyHtml"`
	Headers     map[string]interface{} `json:"headers"`
	Metadata    map[string]interface{} `json:"metadata"`
	ThreadID    *string                `json:"threadId"`
	InReplyTo   *string                `json:"inReplyTo"`
	ExternalID  *string                `json:"externalId"`
	SentAt      *string                `json:"sentAt"`
	ReceivedAt  *string                `json:"receivedAt"`
	Attachments []AttachmentOutput     `json:"attachments"`
	CreatedAt   string                 `json:"createdAt"`
	UpdatedAt   string                 `json:"updatedAt"`
}

Message represents a message in the Anima platform.

type MessageChannel

type MessageChannel string

MessageChannel represents the channel a message was sent through.

const (
	MessageChannelEmail MessageChannel = "EMAIL"
	MessageChannelSMS   MessageChannel = "SMS"
	MessageChannelMMS   MessageChannel = "MMS"
	MessageChannelVoice MessageChannel = "VOICE"
)

type MessageDirection

type MessageDirection string

MessageDirection indicates whether a message is inbound or outbound.

const (
	MessageDirectionInbound  MessageDirection = "INBOUND"
	MessageDirectionOutbound MessageDirection = "OUTBOUND"
)

type MessageListParams

type MessageListParams struct {
	ListParams
	AgentID   string
	ThreadID  string
	Channel   MessageChannel
	Direction MessageDirection
	DateRange *DateRange
}

MessageListParams contains parameters for listing messages.

func (MessageListParams) ToQuery

func (p MessageListParams) ToQuery() url.Values

ToQuery converts MessageListParams to URL query values.

type MessageSearchFilters

type MessageSearchFilters struct {
	AgentID   string           `json:"agentId,omitempty"`
	Channel   MessageChannel   `json:"channel,omitempty"`
	Direction MessageDirection `json:"direction,omitempty"`
	Status    MessageStatus    `json:"status,omitempty"`
	DateRange *DateRange       `json:"dateRange,omitempty"`
}

MessageSearchFilters contains filters for searching messages.

type MessageSearchParams

type MessageSearchParams struct {
	Query      string                `json:"query"`
	Filters    *MessageSearchFilters `json:"filters,omitempty"`
	Pagination *ListParams           `json:"pagination,omitempty"`
}

MessageSearchParams contains parameters for searching messages.

type MessageStatus

type MessageStatus string

MessageStatus represents the delivery status of a message.

const (
	MessageStatusQueued          MessageStatus = "QUEUED"
	MessageStatusSent            MessageStatus = "SENT"
	MessageStatusDelivered       MessageStatus = "DELIVERED"
	MessageStatusFailed          MessageStatus = "FAILED"
	MessageStatusBounced         MessageStatus = "BOUNCED"
	MessageStatusBlocked         MessageStatus = "BLOCKED"
	MessageStatusPendingApproval MessageStatus = "PENDING_APPROVAL"
)

type MessagesService

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

MessagesService provides methods for sending and managing messages.

func (*MessagesService) Get

func (s *MessagesService) Get(ctx context.Context, id string) (*Message, error)

Get retrieves a message by ID.

func (*MessagesService) List

func (s *MessagesService) List(ctx context.Context, params *MessageListParams) (*Page[Message], error)

List returns a paginated list of messages.

func (*MessagesService) ListAutoPaging

func (s *MessagesService) ListAutoPaging(params *MessageListParams) *ListIterator[Message]

ListAutoPaging returns an iterator that automatically paginates through all messages.

func (*MessagesService) Search

func (s *MessagesService) Search(ctx context.Context, params MessageSearchParams) (*Page[Message], error)

Search searches messages with full-text search and filters.

func (*MessagesService) SendEmail

func (s *MessagesService) SendEmail(ctx context.Context, params SendEmailParams) (*Message, error)

SendEmail sends an email message.

func (*MessagesService) SendSMS

func (s *MessagesService) SendSMS(ctx context.Context, params SendSMSParams) (*Message, error)

SendSMS sends an SMS message.

type OAuthApp

type OAuthApp struct {
	ID            string   `json:"id"`
	Slug          string   `json:"slug"`
	Name          string   `json:"name"`
	Description   *string  `json:"description"`
	IconURL       *string  `json:"iconUrl"`
	AuthMethod    string   `json:"authMethod"`
	DefaultScopes []string `json:"defaultScopes"`
	RequiresPKCE  bool     `json:"requiresPkce"`
	Category      *string  `json:"category"`
	IsManaged     bool     `json:"isManaged"`
	IsActive      bool     `json:"isActive"`
}

OAuthApp represents an OAuth app definition.

type OAuthAppList

type OAuthAppList struct {
	Items []OAuthApp `json:"items"`
}

OAuthAppList wraps a list of OAuth apps.

type Option

type Option func(*clientConfig)

Option configures the Anima client. Use the With* functions to create options.

func WithBaseURL

func WithBaseURL(url string) Option

WithBaseURL sets a custom API base URL (e.g. for staging or self-hosted).

func WithHTTPClient

func WithHTTPClient(hc *http.Client) Option

WithHTTPClient sets a custom *http.Client. When set, the client's Timeout field takes precedence over WithTimeout.

func WithMaxRetries

func WithMaxRetries(n int) Option

WithMaxRetries sets the maximum number of retries for failed requests. Default is 3. Set to 0 to disable retries.

func WithTimeout

func WithTimeout(d time.Duration) Option

WithTimeout sets the per-request timeout. Default is 30 seconds.

type Organization

type Organization struct {
	ID         string                 `json:"id"`
	Name       string                 `json:"name"`
	Slug       string                 `json:"slug"`
	ClerkOrgID *string                `json:"clerkOrgId"`
	Tier       Tier                   `json:"tier"`
	MasterKey  string                 `json:"masterKey"`
	Settings   map[string]interface{} `json:"settings"`
	CreatedAt  string                 `json:"createdAt"`
	UpdatedAt  string                 `json:"updatedAt"`
}

Organization represents an Anima organization.

type OrganizationListParams

type OrganizationListParams struct {
	ListParams
	Query string
}

OrganizationListParams contains parameters for listing organizations.

func (OrganizationListParams) ToQuery

func (p OrganizationListParams) ToQuery() url.Values

ToQuery converts OrganizationListParams to URL query values.

type OrganizationsService

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

OrganizationsService provides methods for managing organizations.

func (*OrganizationsService) Create

Create creates a new organization.

func (*OrganizationsService) Delete

func (s *OrganizationsService) Delete(ctx context.Context, id string) error

Delete deletes an organization.

func (*OrganizationsService) Get

Get retrieves an organization by ID.

func (*OrganizationsService) List

List returns a paginated list of organizations.

func (*OrganizationsService) ListAutoPaging

ListAutoPaging returns an iterator that automatically paginates through all organizations.

func (*OrganizationsService) RotateKey

RotateKey rotates an organization's master key.

func (*OrganizationsService) Update

Update updates an existing organization.

type Page

type Page[T any] struct {
	Items      []T              `json:"items"`
	Pagination CursorPagination `json:"pagination"`
}

Page represents a single page of results from a paginated API endpoint.

type PageFunc

type PageFunc[T any] func(ctx context.Context, cursor string) (*Page[T], error)

PageFunc is a function that fetches a single page given a cursor.

type PhoneCapabilities

type PhoneCapabilities struct {
	SMS   bool `json:"sms"`
	MMS   bool `json:"mms"`
	Voice bool `json:"voice"`
}

PhoneCapabilities describes what a phone number can do.

type PhoneIdentity

type PhoneIdentity struct {
	ID           string            `json:"id"`
	PhoneNumber  string            `json:"phoneNumber"`
	Provider     PhoneProvider     `json:"provider"`
	ProviderID   *string           `json:"providerId"`
	Capabilities PhoneCapabilities `json:"capabilities"`
	TenDLCStatus TenDLCStatus      `json:"tenDlcStatus"`
	IsPrimary    bool              `json:"isPrimary"`
	CreatedAt    string            `json:"createdAt"`
}

PhoneIdentity represents a phone identity attached to an agent.

type PhoneList

type PhoneList struct {
	Items []PhoneIdentity `json:"items"`
}

PhoneList wraps a list of phone identities.

type PhoneListParams

type PhoneListParams struct {
	AgentID string
}

PhoneListParams contains parameters for listing phone numbers.

type PhoneProvider

type PhoneProvider string

PhoneProvider is the telephony provider for a phone number.

const (
	PhoneProviderTelnyx PhoneProvider = "TELNYX"
)

type PhonesService

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

PhonesService provides methods for managing phone numbers.

func (*PhonesService) List

func (s *PhonesService) List(ctx context.Context, params PhoneListParams) (*PhoneList, error)

List returns a list of phone numbers for the specified agent.

func (*PhonesService) Provision

func (s *PhonesService) Provision(ctx context.Context, params ProvisionPhoneParams) (*PhoneIdentity, error)

Provision provisions a new phone number for an agent.

func (*PhonesService) Release

func (s *PhonesService) Release(ctx context.Context, params ReleasePhoneParams) error

Release releases a phone number from an agent.

func (*PhonesService) Search

Search searches for available phone numbers.

type Pod

type Pod struct {
	ID        string                 `json:"id"`
	AgentID   string                 `json:"agentId"`
	Name      string                 `json:"name"`
	Status    string                 `json:"status"`
	Image     string                 `json:"image,omitempty"`
	Resources *PodResources          `json:"resources,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
	CreatedAt string                 `json:"createdAt"`
	UpdatedAt string                 `json:"updatedAt"`
}

Pod represents an isolated compute pod for an agent.

type PodList

type PodList struct {
	Items []Pod `json:"items"`
}

PodList wraps a list of pods.

type PodListParams

type PodListParams struct {
	ListParams
	AgentID string
}

PodListParams contains parameters for listing pods.

func (PodListParams) ToQuery

func (p PodListParams) ToQuery() url.Values

ToQuery converts PodListParams to URL query values.

type PodResources

type PodResources struct {
	CPU    string `json:"cpu,omitempty"`
	Memory string `json:"memory,omitempty"`
	Disk   string `json:"disk,omitempty"`
}

PodResources describes the compute resources allocated to a pod.

type PodUsage

type PodUsage struct {
	PodID     string  `json:"podId"`
	CPU       float64 `json:"cpu"`
	Memory    float64 `json:"memory"`
	Disk      float64 `json:"disk"`
	Network   float64 `json:"network"`
	Uptime    int64   `json:"uptime"`
	CreatedAt string  `json:"createdAt"`
}

PodUsage represents resource usage statistics for a pod.

type PodsService

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

PodsService provides methods for managing agent compute pods.

func (*PodsService) Create

func (s *PodsService) Create(ctx context.Context, params CreatePodParams) (*Pod, error)

Create creates a new pod.

func (*PodsService) Delete

func (s *PodsService) Delete(ctx context.Context, id string) error

Delete deletes a pod.

func (*PodsService) Get

func (s *PodsService) Get(ctx context.Context, id string) (*Pod, error)

Get retrieves a pod by ID.

func (*PodsService) List

func (s *PodsService) List(ctx context.Context, params *PodListParams) (*PodList, error)

List lists pods, optionally filtered by agent.

func (*PodsService) Update

func (s *PodsService) Update(ctx context.Context, id string, params UpdatePodParams) (*Pod, error)

Update updates an existing pod.

func (*PodsService) Usage

func (s *PodsService) Usage(ctx context.Context, id string) (*PodUsage, error)

Usage retrieves resource usage statistics for a pod.

type PolicyAction

type PolicyAction string

PolicyAction is the action a spending policy takes.

const (
	PolicyActionAutoApprove     PolicyAction = "AUTO_APPROVE"
	PolicyActionRequireApproval PolicyAction = "REQUIRE_APPROVAL"
	PolicyActionAlwaysDecline   PolicyAction = "ALWAYS_DECLINE"
)

type ProvisionPhoneParams

type ProvisionPhoneParams struct {
	AgentID      string   `json:"agentId"`
	CountryCode  string   `json:"countryCode,omitempty"`
	AreaCode     string   `json:"areaCode,omitempty"`
	Capabilities []string `json:"capabilities,omitempty"`
}

ProvisionPhoneParams contains the parameters for provisioning a phone number.

type QuarantineAction

type QuarantineAction string

QuarantineAction represents the quarantine action taken when a rule triggers.

const (
	QuarantineActionNone QuarantineAction = "NONE"
	QuarantineActionSoft QuarantineAction = "SOFT"
	QuarantineActionHard QuarantineAction = "HARD"
)

type QuarantineInput

type QuarantineInput struct {
	Level  QuarantineLevel `json:"level"`
	Reason string          `json:"reason,omitempty"`
}

QuarantineInput contains parameters for quarantining an agent.

type QuarantineLevel

type QuarantineLevel string

QuarantineLevel represents the current quarantine level of an agent.

const (
	QuarantineLevelNone QuarantineLevel = "NONE"
	QuarantineLevelSoft QuarantineLevel = "SOFT"
	QuarantineLevelHard QuarantineLevel = "HARD"
)

type QuarantineOutput

type QuarantineOutput struct {
	AgentID         string          `json:"agentId"`
	QuarantineLevel QuarantineLevel `json:"quarantineLevel"`
	QuarantinedAt   *string         `json:"quarantinedAt"`
	Reason          *string         `json:"reason"`
}

QuarantineOutput contains the result of a quarantine or release operation.

type RegisterAgentParams

type RegisterAgentParams struct {
	DID          string   `json:"did"`
	Name         string   `json:"name"`
	Description  string   `json:"description,omitempty"`
	Category     string   `json:"category,omitempty"`
	Capabilities []string `json:"capabilities,omitempty"`
	Endpoints    any      `json:"endpoints,omitempty"`
}

RegisterAgentParams contains the parameters for registering an agent in the registry.

type RegistryAgent

type RegistryAgent struct {
	DID          string   `json:"did"`
	Name         string   `json:"name"`
	Description  string   `json:"description,omitempty"`
	Category     string   `json:"category,omitempty"`
	Capabilities []string `json:"capabilities,omitempty"`
	Endpoints    any      `json:"endpoints,omitempty"`
	Verified     bool     `json:"verified"`
	CreatedAt    string   `json:"createdAt"`
	UpdatedAt    string   `json:"updatedAt"`
}

RegistryAgent represents an agent registered in the public agent registry.

type RegistryAgentList

type RegistryAgentList struct {
	Items []RegistryAgent `json:"items"`
}

RegistryAgentList wraps a list of registry agents.

type RegistrySearchParams

type RegistrySearchParams struct {
	Query    string
	Category string
	Cursor   string
	Limit    int
}

RegistrySearchParams contains parameters for searching the agent registry.

type RegistryService

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

RegistryService provides methods for the public agent registry.

func (*RegistryService) Lookup

func (s *RegistryService) Lookup(ctx context.Context, did string) (*RegistryAgent, error)

Lookup retrieves a registry entry by DID.

func (*RegistryService) Register

Register registers an agent in the public registry.

func (*RegistryService) Search

Search searches the agent registry.

func (*RegistryService) Unlist

func (s *RegistryService) Unlist(ctx context.Context, did string) error

Unlist removes an agent from the public registry.

func (*RegistryService) Update

Update updates an existing registry entry.

type ReleasePhoneParams

type ReleasePhoneParams struct {
	AgentID     string `json:"agentId"`
	PhoneNumber string `json:"phoneNumber"`
}

ReleasePhoneParams contains the parameters for releasing a phone number.

type RequestOption

type RequestOption func(*http.Request)

RequestOption allows per-request customization.

type RevokeShareParams

type RevokeShareParams struct {
	ShareID string `json:"shareId"`
	AgentID string `json:"agentId,omitempty"`
}

RevokeShareParams contains parameters for revoking a share.

type RevokeTokensParams

type RevokeTokensParams struct {
	CredentialID string `json:"credentialId"`
	AgentID      string `json:"agentId,omitempty"`
}

RevokeTokensParams contains parameters for revoking tokens.

type RevokeTokensResult

type RevokeTokensResult struct {
	Success bool `json:"success"`
	Revoked int  `json:"revoked"`
}

RevokeTokensResult contains the result of revoking tokens.

type RotateKeyResult

type RotateKeyResult struct {
	APIKey       string `json:"apiKey"`
	APIKeyPrefix string `json:"apiKeyPrefix"`
}

RotateKeyResult contains the result of an API key rotation.

type RotateMasterKeyResult

type RotateMasterKeyResult struct {
	MasterKey string `json:"masterKey"`
}

RotateMasterKeyResult contains the result of a master key rotation.

type SearchPhonesParams

type SearchPhonesParams struct {
	CountryCode  string   `json:"countryCode,omitempty"`
	AreaCode     string   `json:"areaCode,omitempty"`
	Capabilities []string `json:"capabilities,omitempty"`
	Limit        int      `json:"limit,omitempty"`
}

SearchPhonesParams contains parameters for searching available phone numbers.

type SearchVaultParams

type SearchVaultParams struct {
	AgentID string
	Search  string
	Type    CredentialType
}

SearchVaultParams contains parameters for searching the vault.

type SecurityEvent

type SecurityEvent struct {
	ID         string                 `json:"id"`
	OrgID      string                 `json:"orgId"`
	AgentID    *string                `json:"agentId"`
	MessageID  *string                `json:"messageId"`
	Type       SecurityEventType      `json:"type"`
	Severity   SecuritySeverity       `json:"severity"`
	Details    map[string]interface{} `json:"details"`
	Resolved   bool                   `json:"resolved"`
	ResolvedBy *string                `json:"resolvedBy"`
	ResolvedAt *string                `json:"resolvedAt"`
	CreatedAt  string                 `json:"createdAt"`
}

SecurityEvent represents a security event in the Anima platform.

type SecurityEventType

type SecurityEventType string

SecurityEventType represents the type of a security event.

const (
	SecurityEventPIIDetected       SecurityEventType = "PII_DETECTED"
	SecurityEventInjectionDetected SecurityEventType = "INJECTION_DETECTED"
	SecurityEventRateLimited       SecurityEventType = "RATE_LIMITED"
	SecurityEventBlocked           SecurityEventType = "BLOCKED"
	SecurityEventApproved          SecurityEventType = "APPROVED"
	SecurityEventRejected          SecurityEventType = "REJECTED"
)

type SecurityEventsListParams

type SecurityEventsListParams struct {
	ListParams
	OrgID    string
	AgentID  string
	Type     SecurityEventType
	Severity SecuritySeverity
}

SecurityEventsListParams contains parameters for listing security events.

func (SecurityEventsListParams) ToQuery

func (p SecurityEventsListParams) ToQuery() url.Values

ToQuery converts SecurityEventsListParams to URL query values.

type SecurityScanParams

type SecurityScanParams struct {
	OrgID    string                 `json:"orgId"`
	AgentID  string                 `json:"agentId,omitempty"`
	Channel  string                 `json:"channel"` // "EMAIL" or "SMS"
	Subject  string                 `json:"subject,omitempty"`
	Body     string                 `json:"body"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

SecurityScanParams contains the parameters for a content security scan.

type SecurityScanResult

type SecurityScanResult struct {
	Blocked  bool                  `json:"blocked"`
	Warnings []SecurityScanWarning `json:"warnings"`
	Summary  string                `json:"summary"`
}

SecurityScanResult contains the result of a content security scan.

type SecurityScanWarning

type SecurityScanWarning struct {
	RuleID      string           `json:"ruleId"`
	Severity    SecuritySeverity `json:"severity"`
	Description string           `json:"description"`
	Match       string           `json:"match,omitempty"`
}

SecurityScanWarning represents a warning from a content scan.

type SecurityService

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

SecurityService provides methods for content scanning and security events.

func (*SecurityService) ListEvents

ListEvents returns a paginated list of security events.

func (*SecurityService) ListEventsAutoPaging

func (s *SecurityService) ListEventsAutoPaging(params SecurityEventsListParams) *ListIterator[SecurityEvent]

ListEventsAutoPaging returns an iterator that automatically paginates through all security events.

func (*SecurityService) ScanContent

ScanContent scans message content for security threats such as PII leakage or prompt injection.

type SecuritySeverity

type SecuritySeverity string

SecuritySeverity represents the severity of a security event or warning.

const (
	SecuritySeverityLow      SecuritySeverity = "LOW"
	SecuritySeverityMedium   SecuritySeverity = "MEDIUM"
	SecuritySeverityHigh     SecuritySeverity = "HIGH"
	SecuritySeverityCritical SecuritySeverity = "CRITICAL"
)

type SeedFrameworkInput

type SeedFrameworkInput struct {
	Framework ComplianceFramework `json:"framework"`
}

SeedFrameworkInput contains parameters for seeding a compliance framework.

type SeedFrameworkOutput

type SeedFrameworkOutput struct {
	ControlsCreated int                 `json:"controlsCreated"`
	Framework       ComplianceFramework `json:"framework"`
}

SeedFrameworkOutput contains the result of seeding a compliance framework.

type SendEmailParams

type SendEmailParams struct {
	AgentID  string                 `json:"agentId"`
	To       []string               `json:"to"`
	CC       []string               `json:"cc,omitempty"`
	BCC      []string               `json:"bcc,omitempty"`
	Subject  string                 `json:"subject"`
	Body     string                 `json:"body"`
	BodyHTML string                 `json:"bodyHtml,omitempty"`
	Headers  map[string]string      `json:"headers,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

SendEmailParams contains the parameters for sending an email.

type SendSMSParams

type SendSMSParams struct {
	AgentID   string                 `json:"agentId"`
	To        string                 `json:"to"`
	Body      string                 `json:"body"`
	MediaURLs []string               `json:"mediaUrls,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

SendSMSParams contains the parameters for sending an SMS.

type ShareCredentialParams

type ShareCredentialParams struct {
	AgentID          string `json:"agentId"`
	CredentialID     string `json:"credentialId"`
	TargetAgentID    string `json:"targetAgentId"`
	Permission       string `json:"permission"`
	ExpiresInSeconds *int   `json:"expiresInSeconds,omitempty"`
}

ShareCredentialParams contains parameters for sharing a credential.

type SharePermission

type SharePermission string

SharePermission represents the permission level for a shared credential.

const (
	SharePermissionRead   SharePermission = "READ"
	SharePermissionUse    SharePermission = "USE"
	SharePermissionManage SharePermission = "MANAGE"
)

type SpendingPolicy

type SpendingPolicy struct {
	ID                string       `json:"id"`
	CardID            string       `json:"cardId"`
	OrgID             string       `json:"orgId"`
	Name              string       `json:"name"`
	Priority          int          `json:"priority"`
	Action            PolicyAction `json:"action"`
	MaxAmountCents    *int         `json:"maxAmountCents"`
	MinAmountCents    *int         `json:"minAmountCents"`
	AllowedCategories []string     `json:"allowedCategories"`
	BlockedCategories []string     `json:"blockedCategories"`
	AllowedMerchants  []string     `json:"allowedMerchants"`
	BlockedMerchants  []string     `json:"blockedMerchants"`
	AllowedCountries  []string     `json:"allowedCountries"`
	BlockedCountries  []string     `json:"blockedCountries"`
	CreatedAt         string       `json:"createdAt"`
}

SpendingPolicy represents a spending policy for a card.

type SubmitA2ATaskParams

type SubmitA2ATaskParams struct {
	Input    any                    `json:"input"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

SubmitA2ATaskParams contains the parameters for submitting an A2A task.

type SuccessResult

type SuccessResult struct {
	Success bool `json:"success"`
}

SuccessResult is a generic success response.

type TenDLCStatus

type TenDLCStatus string

TenDLCStatus represents the 10DLC registration status.

const (
	TenDLCStatusPending     TenDLCStatus = "PENDING"
	TenDLCStatusRegistered  TenDLCStatus = "REGISTERED"
	TenDLCStatusRejected    TenDLCStatus = "REJECTED"
	TenDLCStatusNotRequired TenDLCStatus = "NOT_REQUIRED"
)

type Tier

type Tier string

Tier represents the subscription tier of an organization.

const (
	TierFree       Tier = "FREE"
	TierDeveloper  Tier = "DEVELOPER"
	TierGrowth     Tier = "GROWTH"
	TierScale      Tier = "SCALE"
	TierEnterprise Tier = "ENTERPRISE"
)

type TokenScope

type TokenScope string

TokenScope represents the scope of an ephemeral vault token.

const (
	TokenScopeAutofill TokenScope = "autofill"
	TokenScopeProxy    TokenScope = "proxy"
	TokenScopeExport   TokenScope = "export"
)

type TransactionList

type TransactionList struct {
	Items  []CardTransaction `json:"items"`
	Cursor *string           `json:"cursor,omitempty"`
}

TransactionList wraps a list of transactions with a cursor.

type TransactionListParams

type TransactionListParams struct {
	ListParams
	CardID  string
	AgentID string
	Status  string
}

TransactionListParams contains parameters for listing transactions.

func (TransactionListParams) ToQuery

func (p TransactionListParams) ToQuery() url.Values

ToQuery converts TransactionListParams to URL query values.

type TransactionStatus

type TransactionStatus string

TransactionStatus represents the status of a card transaction.

const (
	TransactionStatusPending  TransactionStatus = "PENDING"
	TransactionStatusApproved TransactionStatus = "APPROVED"
	TransactionStatusDeclined TransactionStatus = "DECLINED"
	TransactionStatusReversed TransactionStatus = "REVERSED"
	TransactionStatusExpired  TransactionStatus = "EXPIRED"
)

type TranscriptSegment

type TranscriptSegment struct {
	Speaker    string  `json:"speaker"`
	Text       string  `json:"text"`
	StartTime  float64 `json:"startTime"`
	EndTime    float64 `json:"endTime"`
	Confidence float64 `json:"confidence"`
	IsFinal    bool    `json:"isFinal"`
}

TranscriptSegment represents a segment of a call transcript.

type UpdateAddressParams

type UpdateAddressParams struct {
	AgentID    string `json:"agentId,omitempty"`
	Type       string `json:"type,omitempty"`
	Line1      string `json:"line1,omitempty"`
	Line2      string `json:"line2,omitempty"`
	City       string `json:"city,omitempty"`
	State      string `json:"state,omitempty"`
	PostalCode string `json:"postalCode,omitempty"`
	Country    string `json:"country,omitempty"`
	Primary    *bool  `json:"primary,omitempty"`
}

UpdateAddressParams contains the parameters for updating an address.

type UpdateAgentParams

type UpdateAgentParams struct {
	Name     string                 `json:"name,omitempty"`
	Slug     string                 `json:"slug,omitempty"`
	Status   AgentStatus            `json:"status,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

UpdateAgentParams contains the parameters for updating an agent.

type UpdateAnomalyRuleInput

type UpdateAnomalyRuleInput struct {
	Name             string           `json:"name,omitempty"`
	Threshold        *float64         `json:"threshold,omitempty"`
	Severity         AnomalySeverity  `json:"severity,omitempty"`
	QuarantineAction QuarantineAction `json:"quarantineAction,omitempty"`
	CooldownMinutes  *int             `json:"cooldownMinutes,omitempty"`
	Enabled          *bool            `json:"enabled,omitempty"`
}

UpdateAnomalyRuleInput contains parameters for updating an anomaly detection rule.

type UpdateCardParams

type UpdateCardParams struct {
	Label             string     `json:"label,omitempty"`
	Status            CardStatus `json:"status,omitempty"`
	SpendLimitDaily   *int       `json:"spendLimitDaily,omitempty"`
	SpendLimitMonthly *int       `json:"spendLimitMonthly,omitempty"`
	SpendLimitPerAuth *int       `json:"spendLimitPerAuth,omitempty"`
}

UpdateCardParams contains the parameters for updating a card.

type UpdateDomainParams

type UpdateDomainParams struct {
	FeedbackEnabled *bool `json:"feedbackEnabled,omitempty"`
}

UpdateDomainParams contains the parameters for updating a domain.

type UpdateOrganizationParams

type UpdateOrganizationParams struct {
	Name       string                 `json:"name,omitempty"`
	Slug       string                 `json:"slug,omitempty"`
	ClerkOrgID *string                `json:"clerkOrgId,omitempty"`
	Tier       Tier                   `json:"tier,omitempty"`
	Settings   map[string]interface{} `json:"settings,omitempty"`
}

UpdateOrganizationParams contains the parameters for updating an organization.

type UpdatePodParams

type UpdatePodParams struct {
	Name      string                 `json:"name,omitempty"`
	Image     string                 `json:"image,omitempty"`
	Resources *PodResources          `json:"resources,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

UpdatePodParams contains the parameters for updating a pod.

type UpdatePolicyParams

type UpdatePolicyParams struct {
	Name              string       `json:"name,omitempty"`
	Priority          int          `json:"priority,omitempty"`
	Action            PolicyAction `json:"action,omitempty"`
	MaxAmountCents    *int         `json:"maxAmountCents,omitempty"`
	MinAmountCents    *int         `json:"minAmountCents,omitempty"`
	AllowedCategories []string     `json:"allowedCategories,omitempty"`
	BlockedCategories []string     `json:"blockedCategories,omitempty"`
	AllowedMerchants  []string     `json:"allowedMerchants,omitempty"`
	BlockedMerchants  []string     `json:"blockedMerchants,omitempty"`
	AllowedCountries  []string     `json:"allowedCountries,omitempty"`
	BlockedCountries  []string     `json:"blockedCountries,omitempty"`
}

UpdatePolicyParams contains the parameters for updating a spending policy.

type UpdateRegistryAgentParams

type UpdateRegistryAgentParams struct {
	Name         string   `json:"name,omitempty"`
	Description  string   `json:"description,omitempty"`
	Category     string   `json:"category,omitempty"`
	Capabilities []string `json:"capabilities,omitempty"`
	Endpoints    any      `json:"endpoints,omitempty"`
}

UpdateRegistryAgentParams contains the parameters for updating a registry entry.

type UpdateVaultCredentialParams

type UpdateVaultCredentialParams struct {
	Name     string             `json:"name,omitempty"`
	Notes    string             `json:"notes,omitempty"`
	Login    *VaultLoginData    `json:"login,omitempty"`
	Card     *VaultCardData     `json:"card,omitempty"`
	Identity *VaultIdentityData `json:"identity,omitempty"`
	Fields   []VaultCustomField `json:"fields,omitempty"`
	Favorite *bool              `json:"favorite,omitempty"`
}

UpdateVaultCredentialParams contains the parameters for updating a credential.

type UpdateWalletParams

type UpdateWalletParams struct {
	Status string `json:"status,omitempty"`
}

UpdateWalletParams contains the parameters for updating an agent wallet.

type UpdateWebhookParams

type UpdateWebhookParams struct {
	URL         string             `json:"url,omitempty"`
	Events      []WebhookEventType `json:"events,omitempty"`
	Description string             `json:"description,omitempty"`
	Active      *bool              `json:"active,omitempty"`
}

UpdateWebhookParams contains the parameters for updating a webhook.

type UploadAttachmentParams

type UploadAttachmentParams struct {
	Filename  string `json:"filename"`
	MimeType  string `json:"mimeType"`
	SizeBytes int64  `json:"sizeBytes"`
}

UploadAttachmentParams contains parameters for uploading an attachment.

type ValidateAddressResult

type ValidateAddressResult struct {
	Valid             bool     `json:"valid"`
	Deliverable       bool     `json:"deliverable"`
	Corrections       []string `json:"corrections,omitempty"`
	NormalizedAddress *Address `json:"normalizedAddress,omitempty"`
}

ValidateAddressResult contains the result of address validation.

type VaultCardData

type VaultCardData struct {
	CardholderName string `json:"cardholderName,omitempty"`
	Brand          string `json:"brand,omitempty"`
	Number         string `json:"number,omitempty"`
	ExpMonth       string `json:"expMonth,omitempty"`
	ExpYear        string `json:"expYear,omitempty"`
	Code           string `json:"code,omitempty"`
}

VaultCardData contains card credential data.

type VaultCredential

type VaultCredential struct {
	ID        string             `json:"id"`
	Type      CredentialType     `json:"type"`
	Name      string             `json:"name"`
	Notes     string             `json:"notes,omitempty"`
	Login     *VaultLoginData    `json:"login,omitempty"`
	Card      *VaultCardData     `json:"card,omitempty"`
	Identity  *VaultIdentityData `json:"identity,omitempty"`
	Fields    []VaultCustomField `json:"fields,omitempty"`
	Favorite  bool               `json:"favorite"`
	CreatedAt string             `json:"createdAt"`
	UpdatedAt string             `json:"updatedAt"`
}

VaultCredential represents a credential stored in the vault.

type VaultCredentialList

type VaultCredentialList struct {
	Items []VaultCredential `json:"items"`
}

VaultCredentialList wraps a list of vault credentials.

type VaultCustomField

type VaultCustomField struct {
	Name  string `json:"name"`
	Value string `json:"value"`
	Type  string `json:"type"` // "text", "hidden", "boolean"
}

VaultCustomField represents a custom field on a vault credential.

type VaultIdentity

type VaultIdentity struct {
	ID              string  `json:"id"`
	AgentID         string  `json:"agentId"`
	OrgID           string  `json:"orgId"`
	Status          string  `json:"status"`
	CredentialCount int     `json:"credentialCount"`
	LastSyncAt      *string `json:"lastSyncAt"`
	CreatedAt       string  `json:"createdAt"`
}

VaultIdentity represents a vault provisioned for an agent.

type VaultIdentityData

type VaultIdentityData struct {
	FirstName  string `json:"firstName,omitempty"`
	LastName   string `json:"lastName,omitempty"`
	Email      string `json:"email,omitempty"`
	Phone      string `json:"phone,omitempty"`
	Address1   string `json:"address1,omitempty"`
	City       string `json:"city,omitempty"`
	State      string `json:"state,omitempty"`
	PostalCode string `json:"postalCode,omitempty"`
	Country    string `json:"country,omitempty"`
	Company    string `json:"company,omitempty"`
}

VaultIdentityData contains identity credential data.

type VaultLoginData

type VaultLoginData struct {
	Username string     `json:"username,omitempty"`
	Password string     `json:"password,omitempty"`
	URIs     []VaultURI `json:"uris,omitempty"`
	TOTP     string     `json:"totp,omitempty"`
}

VaultLoginData contains login credential data.

type VaultOAuthService

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

VaultOAuthService provides methods for managing OAuth connections.

CreateLink creates a Connect Link for zero-code authentication.

func (*VaultOAuthService) Disconnect

func (s *VaultOAuthService) Disconnect(ctx context.Context, accountID string) error

Disconnect disconnects an OAuth account.

func (*VaultOAuthService) GetApp

func (s *VaultOAuthService) GetApp(ctx context.Context, slug string) (*OAuthApp, error)

GetApp gets a single OAuth app definition by slug.

func (*VaultOAuthService) GetLinkStatus

func (s *VaultOAuthService) GetLinkStatus(ctx context.Context, token string) (*ConnectLinkStatus, error)

GetLinkStatus checks the status of a Connect Link.

func (*VaultOAuthService) ListAccounts

ListAccounts lists connected OAuth accounts.

func (*VaultOAuthService) ListApps

func (s *VaultOAuthService) ListApps(ctx context.Context, category string) (*OAuthAppList, error)

ListApps lists available OAuth app definitions.

type VaultService

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

VaultService provides methods for managing the agent credential vault.

func (*VaultService) CreateCredential

func (s *VaultService) CreateCredential(ctx context.Context, params CreateVaultCredentialParams) (*VaultCredential, error)

CreateCredential creates a new credential in the vault.

func (*VaultService) CreateToken

func (s *VaultService) CreateToken(ctx context.Context, params CreateTokenParams) (*VaultToken, error)

CreateToken creates a short-lived ephemeral token for a credential.

func (*VaultService) DeleteCredential

func (s *VaultService) DeleteCredential(ctx context.Context, id string) error

DeleteCredential deletes a credential from the vault.

func (*VaultService) Deprovision

func (s *VaultService) Deprovision(ctx context.Context, agentID string) error

Deprovision removes a vault from an agent.

func (*VaultService) ExchangeToken

func (s *VaultService) ExchangeToken(ctx context.Context, token string) (*VaultCredential, error)

ExchangeToken exchanges an ephemeral vtk_ token for the underlying credential.

func (*VaultService) GeneratePassword

func (s *VaultService) GeneratePassword(ctx context.Context, params *GeneratePasswordParams) (*GeneratePasswordResult, error)

GeneratePassword generates a random password.

func (*VaultService) GetCredential

func (s *VaultService) GetCredential(ctx context.Context, id string) (*VaultCredential, error)

GetCredential retrieves a credential by ID.

func (*VaultService) GetTOTP

func (s *VaultService) GetTOTP(ctx context.Context, credentialID string) (*VaultTOTP, error)

GetTOTP retrieves the current TOTP code for a credential.

func (*VaultService) ListCredentials

ListCredentials lists all credentials for an agent.

func (*VaultService) ListShares

func (s *VaultService) ListShares(ctx context.Context, direction string, agentID string) (*VaultShareList, error)

ListShares lists credential shares granted by or received by an agent.

func (*VaultService) Provision

func (s *VaultService) Provision(ctx context.Context, agentID string) (*VaultIdentity, error)

Provision provisions a vault for an agent.

func (*VaultService) RevokeShare

func (s *VaultService) RevokeShare(ctx context.Context, params RevokeShareParams) error

RevokeShare revokes a previously granted credential share.

func (*VaultService) RevokeTokens

func (s *VaultService) RevokeTokens(ctx context.Context, params RevokeTokensParams) (*RevokeTokensResult, error)

RevokeTokens revokes all active ephemeral tokens for a credential.

func (*VaultService) Search

Search searches credentials in the vault.

func (*VaultService) ShareCredential

func (s *VaultService) ShareCredential(ctx context.Context, params ShareCredentialParams) (*VaultShare, error)

ShareCredential shares a vault credential with another agent.

func (*VaultService) Status

func (s *VaultService) Status(ctx context.Context, agentID string) (*VaultStatus, error)

Status retrieves the vault sync status for an agent.

func (*VaultService) Sync

func (s *VaultService) Sync(ctx context.Context, agentID string) error

Sync triggers a vault sync for an agent.

func (*VaultService) UpdateCredential

func (s *VaultService) UpdateCredential(ctx context.Context, id string, params UpdateVaultCredentialParams) (*VaultCredential, error)

UpdateCredential updates an existing credential.

type VaultShare

type VaultShare struct {
	ID            string  `json:"id"`
	CredentialID  string  `json:"credentialId"`
	SourceAgentID string  `json:"sourceAgentId"`
	TargetAgentID string  `json:"targetAgentId"`
	Permission    string  `json:"permission"`
	ExpiresAt     *string `json:"expiresAt"`
	CreatedAt     string  `json:"createdAt"`
}

VaultShare represents a credential share between agents.

type VaultShareList

type VaultShareList struct {
	Items []VaultShare `json:"items"`
}

VaultShareList wraps a list of vault shares.

type VaultStatus

type VaultStatus struct {
	ServerURL string  `json:"serverUrl"`
	LastSync  *string `json:"lastSync"`
	Status    string  `json:"status"`
}

VaultStatus contains the vault sync status.

type VaultTOTP

type VaultTOTP struct {
	Code   string `json:"code"`
	Period int    `json:"period"`
}

VaultTOTP contains a TOTP code and its period.

type VaultToken

type VaultToken struct {
	Token        string `json:"token"`
	CredentialID string `json:"credentialId"`
	Scope        string `json:"scope"`
	ExpiresAt    string `json:"expiresAt"`
}

VaultToken represents an ephemeral vault token.

type VaultURI

type VaultURI struct {
	URI   string `json:"uri"`
	Match string `json:"match,omitempty"`
}

VaultURI represents a URI associated with a login credential.

type VerifiableCredential

type VerifiableCredential struct {
	ID                string   `json:"id"`
	Type              []string `json:"type"`
	Issuer            string   `json:"issuer"`
	IssuanceDate      string   `json:"issuanceDate"`
	ExpirationDate    string   `json:"expirationDate,omitempty"`
	CredentialSubject any      `json:"credentialSubject"`
	Proof             any      `json:"proof,omitempty"`
	JWT               string   `json:"jwt,omitempty"`
}

VerifiableCredential represents a W3C Verifiable Credential.

type VerifiableCredentialList

type VerifiableCredentialList struct {
	Items []VerifiableCredential `json:"items"`
}

VerifiableCredentialList wraps a list of verifiable credentials.

type VerificationMethod

type VerificationMethod string

VerificationMethod is the method used to verify a domain.

const (
	VerificationMethodDNSTXT   VerificationMethod = "DNS_TXT"
	VerificationMethodDNSCNAME VerificationMethod = "DNS_CNAME"
)

type VerifyCredentialOutput

type VerifyCredentialOutput struct {
	Valid  bool     `json:"valid"`
	Checks []string `json:"checks,omitempty"`
	Errors []string `json:"errors,omitempty"`
}

VerifyCredentialOutput contains the result of a credential verification.

type Voice

type Voice struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Provider    string `json:"provider"`
	Tier        string `json:"tier"`
	Gender      string `json:"gender,omitempty"`
	Language    string `json:"language"`
	Accent      string `json:"accent,omitempty"`
	Style       string `json:"style,omitempty"`
	AgeRange    string `json:"ageRange,omitempty"`
	Description string `json:"description,omitempty"`
	PreviewURL  string `json:"previewUrl,omitempty"`
}

Voice represents an available voice for AI agent phone calls.

type VoiceConnection

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

VoiceConnection is a bidirectional WebSocket connection for real-time voice call control.

Send commands (call.create, call.speak, call.hangup) and receive events (call.started, call.transcription, call.ended) over a persistent connection.

func (*VoiceConnection) Accept

func (vc *VoiceConnection) Accept(callID string) error

Accept accepts an inbound call.

func (*VoiceConnection) CancelSpeak

func (vc *VoiceConnection) CancelSpeak(callID string) error

CancelSpeak cancels in-progress speech.

func (*VoiceConnection) Close

func (vc *VoiceConnection) Close() error

Close closes the WebSocket connection.

func (*VoiceConnection) CreateCall

func (vc *VoiceConnection) CreateCall(to string, opts *CreateCallOptions) error

CreateCall creates an outbound call.

func (*VoiceConnection) DTMF

func (vc *VoiceConnection) DTMF(callID, digits string) error

DTMF sends DTMF tone(s).

func (*VoiceConnection) Hangup

func (vc *VoiceConnection) Hangup(callID string) error

Hangup hangs up a call.

func (*VoiceConnection) Hold

func (vc *VoiceConnection) Hold(callID string) error

Hold places a call on hold.

func (*VoiceConnection) OnConnected

func (vc *VoiceConnection) OnConnected(handler func())

OnConnected registers a handler called when the connection opens.

func (*VoiceConnection) OnDisconnected

func (vc *VoiceConnection) OnDisconnected(handler func())

OnDisconnected registers a handler called when the connection closes.

func (*VoiceConnection) OnError

func (vc *VoiceConnection) OnError(handler func(error))

OnError registers a handler for WebSocket errors.

func (*VoiceConnection) OnMessage

func (vc *VoiceConnection) OnMessage(handler func(VoiceMessage))

OnMessage registers a handler for incoming voice messages.

func (*VoiceConnection) Reject

func (vc *VoiceConnection) Reject(callID string) error

Reject rejects an inbound call.

func (*VoiceConnection) Resume

func (vc *VoiceConnection) Resume(callID string) error

Resume resumes a held call.

func (*VoiceConnection) Send

func (vc *VoiceConnection) Send(msgType string, data map[string]interface{}) error

Send sends a raw message to the voice WebSocket.

func (*VoiceConnection) Speak

func (vc *VoiceConnection) Speak(callID, text string) error

Speak sends text for TTS playback.

type VoiceConnectionOptions

type VoiceConnectionOptions struct {
	AgentID string
}

VoiceConnectionOptions configures a voice WebSocket connection.

type VoiceList

type VoiceList struct {
	Voices []Voice `json:"voices"`
}

VoiceList wraps a list of voices.

type VoiceMessage

type VoiceMessage struct {
	Type      string                 `json:"type"`
	Data      map[string]interface{} `json:"data,omitempty"`
	Timestamp string                 `json:"timestamp,omitempty"`
}

VoiceMessage represents a message on the voice WebSocket.

type VoicesService

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

VoicesService provides methods for browsing the voice catalog.

func (*VoicesService) List

func (s *VoicesService) List(ctx context.Context, params ListVoicesParams) (*VoiceList, error)

List returns available voices, optionally filtered by tier, gender, or language.

type Wallet

type Wallet struct {
	ID        string `json:"id"`
	AgentID   string `json:"agentId"`
	Address   string `json:"address"`
	Network   string `json:"network"`
	Balance   string `json:"balance,omitempty"`
	Currency  string `json:"currency,omitempty"`
	Status    string `json:"status"`
	CreatedAt string `json:"createdAt"`
	UpdatedAt string `json:"updatedAt"`
}

Wallet represents an agent's crypto wallet.

type WalletPayParams

type WalletPayParams struct {
	To       string `json:"to"`
	Amount   string `json:"amount"`
	Currency string `json:"currency,omitempty"`
	Memo     string `json:"memo,omitempty"`
}

WalletPayParams contains the parameters for making a payment from a wallet.

type WalletPayResult

type WalletPayResult struct {
	TransactionID string `json:"transactionId"`
	Status        string `json:"status"`
	Amount        string `json:"amount"`
	Currency      string `json:"currency"`
	To            string `json:"to"`
}

WalletPayResult contains the result of a wallet payment.

type WalletService

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

WalletService provides methods for managing agent crypto wallets.

func (*WalletService) Create

func (s *WalletService) Create(ctx context.Context, agentID string, params *CreateWalletParams) (*Wallet, error)

Create creates a wallet for an agent.

func (*WalletService) Freeze

func (s *WalletService) Freeze(ctx context.Context, agentID string) error

Freeze freezes an agent's wallet, preventing all outgoing transactions.

func (*WalletService) Get

func (s *WalletService) Get(ctx context.Context, agentID string) (*Wallet, error)

Get retrieves an agent's wallet.

func (*WalletService) Pay

func (s *WalletService) Pay(ctx context.Context, agentID string, params WalletPayParams) (*WalletPayResult, error)

Pay makes a payment from an agent's wallet.

func (*WalletService) Transactions

func (s *WalletService) Transactions(ctx context.Context, agentID string, params *WalletTransactionListParams) (*WalletTransactionList, error)

Transactions lists transactions for an agent's wallet.

func (*WalletService) Unfreeze

func (s *WalletService) Unfreeze(ctx context.Context, agentID string) error

Unfreeze unfreezes a previously frozen agent wallet.

func (*WalletService) Update

func (s *WalletService) Update(ctx context.Context, agentID string, params UpdateWalletParams) (*Wallet, error)

Update updates an agent's wallet.

func (*WalletService) X402Fetch

func (s *WalletService) X402Fetch(ctx context.Context, agentID string, params X402FetchParams) (*X402FetchResult, error)

X402Fetch performs an X-402 payment-gated HTTP fetch through the agent's wallet.

type WalletTransaction

type WalletTransaction struct {
	ID              string `json:"id"`
	WalletID        string `json:"walletId"`
	Type            string `json:"type"`
	Amount          string `json:"amount"`
	Currency        string `json:"currency"`
	Status          string `json:"status"`
	To              string `json:"to,omitempty"`
	From            string `json:"from,omitempty"`
	Memo            string `json:"memo,omitempty"`
	TransactionHash string `json:"transactionHash,omitempty"`
	CreatedAt       string `json:"createdAt"`
}

WalletTransaction represents a transaction on an agent wallet.

type WalletTransactionList

type WalletTransactionList struct {
	Items []WalletTransaction `json:"items"`
}

WalletTransactionList wraps a list of wallet transactions.

type WalletTransactionListParams

type WalletTransactionListParams struct {
	Cursor string
	Limit  int
	Status string
}

WalletTransactionListParams contains parameters for listing wallet transactions.

type Webhook

type Webhook struct {
	ID                  string             `json:"id"`
	OrgID               string             `json:"orgId"`
	URL                 string             `json:"url"`
	Events              []WebhookEventType `json:"events"`
	Active              bool               `json:"active"`
	Description         *string            `json:"description"`
	ConsecutiveFailures int                `json:"consecutiveFailures"`
	DisabledReason      *string            `json:"disabledReason"`
	DisabledAt          *string            `json:"disabledAt"`
	CreatedAt           string             `json:"createdAt"`
	UpdatedAt           string             `json:"updatedAt"`
}

Webhook represents a webhook configuration.

type WebhookDelivery

type WebhookDelivery struct {
	ID            string                 `json:"id"`
	WebhookID     string                 `json:"webhookId"`
	MessageID     *string                `json:"messageId"`
	Event         WebhookEventType       `json:"event"`
	Payload       map[string]interface{} `json:"payload"`
	StatusCode    *int                   `json:"statusCode"`
	ResponseBody  *string                `json:"responseBody"`
	Attempts      int                    `json:"attempts"`
	MaxAttempts   int                    `json:"maxAttempts"`
	NextAttemptAt *string                `json:"nextAttemptAt"`
	CompletedAt   *string                `json:"completedAt"`
	CreatedAt     string                 `json:"createdAt"`
}

WebhookDelivery represents a webhook delivery attempt.

type WebhookDeliveryListParams

type WebhookDeliveryListParams struct {
	ListParams
}

WebhookDeliveryListParams contains parameters for listing webhook deliveries.

type WebhookEvent

type WebhookEvent struct {
	ID        string         `json:"id,omitempty"`
	Type      string         `json:"type"`
	Data      map[string]any `json:"data"`
	CreatedAt string         `json:"createdAt,omitempty"`
}

WebhookEvent represents a parsed and verified webhook event from Anima.

func ConstructWebhookEvent

func ConstructWebhookEvent(payload []byte, signatureHeader, secret string, opts *WebhookVerifyOptions) (*WebhookEvent, error)

ConstructWebhookEvent verifies the signature and parses the payload into a WebhookEvent. Returns an error if the signature is invalid or the payload cannot be parsed.

type WebhookEventType

type WebhookEventType string

WebhookEventType represents the type of event a webhook can subscribe to.

const (
	WebhookEventMessageReceived  WebhookEventType = "message.received"
	WebhookEventMessageSent      WebhookEventType = "message.sent"
	WebhookEventMessageFailed    WebhookEventType = "message.failed"
	WebhookEventMessageBounced   WebhookEventType = "message.bounced"
	WebhookEventAgentCreated     WebhookEventType = "agent.created"
	WebhookEventAgentUpdated     WebhookEventType = "agent.updated"
	WebhookEventAgentDeleted     WebhookEventType = "agent.deleted"
	WebhookEventPhoneProvisioned WebhookEventType = "phone.provisioned"
	WebhookEventPhoneReleased    WebhookEventType = "phone.released"
)

type WebhookListParams

type WebhookListParams struct {
	ListParams
}

WebhookListParams contains parameters for listing webhooks.

type WebhookTestResult

type WebhookTestResult struct {
	Success    bool   `json:"success"`
	DeliveryID string `json:"deliveryId"`
}

WebhookTestResult contains the result of testing a webhook.

type WebhookVerifyOptions

type WebhookVerifyOptions struct {
	// Tolerance is the maximum allowed age of the webhook timestamp.
	// Defaults to DefaultWebhookTolerance (5 minutes).
	Tolerance time.Duration
	// Now overrides the current time (useful for testing).
	Now time.Time
}

WebhookVerifyOptions configures webhook signature verification.

type WebhooksService

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

WebhooksService provides methods for managing webhooks.

func (*WebhooksService) Create

func (s *WebhooksService) Create(ctx context.Context, params CreateWebhookParams) (*Webhook, error)

Create creates a new webhook.

func (*WebhooksService) Delete

func (s *WebhooksService) Delete(ctx context.Context, id string) error

Delete deletes a webhook.

func (*WebhooksService) Get

func (s *WebhooksService) Get(ctx context.Context, id string) (*Webhook, error)

Get retrieves a webhook by ID.

func (*WebhooksService) List

func (s *WebhooksService) List(ctx context.Context, params *WebhookListParams) (*Page[Webhook], error)

List returns a paginated list of webhooks.

func (*WebhooksService) ListAutoPaging

func (s *WebhooksService) ListAutoPaging(params *WebhookListParams) *ListIterator[Webhook]

ListAutoPaging returns an iterator that automatically paginates through all webhooks.

func (*WebhooksService) ListDeliveries

func (s *WebhooksService) ListDeliveries(ctx context.Context, webhookID string, params *WebhookDeliveryListParams) (*Page[WebhookDelivery], error)

ListDeliveries returns a paginated list of delivery attempts for a webhook.

func (*WebhooksService) Test

Test sends a test event to a webhook endpoint.

func (*WebhooksService) Update

func (s *WebhooksService) Update(ctx context.Context, id string, params UpdateWebhookParams) (*Webhook, error)

Update updates a webhook.

type X402FetchParams

type X402FetchParams struct {
	URL      string `json:"url"`
	MaxPrice string `json:"maxPrice,omitempty"`
}

X402FetchParams contains the parameters for an X-402 payment-gated fetch.

type X402FetchResult

type X402FetchResult struct {
	Status  int               `json:"status"`
	Headers map[string]string `json:"headers,omitempty"`
	Body    string            `json:"body"`
	Paid    bool              `json:"paid"`
	Amount  string            `json:"amount,omitempty"`
}

X402FetchResult contains the result of an X-402 fetch.

Directories

Path Synopsis
_examples
quickstart command
Package main demonstrates basic usage of the Anima Go SDK.
Package main demonstrates basic usage of the Anima Go SDK.
send-email command
Package main demonstrates sending an email using the Anima Go SDK.
Package main demonstrates sending an email using the Anima Go SDK.
cmd
test-voice command

Jump to

Keyboard shortcuts

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