schema

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	Ref     KeyRef
	Display string
	Totals  Totals
}

type Group

type Group struct {
	Canonical string
	Ref       KeyRef
	Display   string
	Totals    Totals
}

type Item

type Item struct {
	RowID          string `json:"row_id"`
	KeyName        string `json:"key_name"`
	KeyDisplay     string `json:"key_display"`
	Source         string `json:"source"`
	Owner          Owner  `json:"owner"`
	KeyStatus      string `json:"key_status"`
	MetadataStatus string `json:"metadata_status"`
	Metrics
}

type KeyRef

type KeyRef struct {
	Hash, KeyID, WorkspaceID, UserID, TenantID string
}

KeyRef, Candidate, Resolution, Group and Metadata are internal only, never HTTP DTOs.

type Metadata

type Metadata struct {
	KeyName, Display, Source, KeyStatus, MetadataStatus string
	Owner                                               Owner
}

type Metrics

type Metrics struct {
	RequestCount        uint64   `json:"request_count"`
	SuccessCount        uint64   `json:"success_count"`
	SuccessRate         float64  `json:"success_rate"`
	InputTokens         uint64   `json:"input_tokens"`
	OutputTokens        uint64   `json:"output_tokens"`
	CachedTokens        uint64   `json:"cached_tokens"`
	CacheCreationTokens uint64   `json:"cache_creation_tokens"`
	TotalTokens         uint64   `json:"total_tokens"`
	TotalCost           string   `json:"total_cost"`
	TokenShare          *float64 `json:"token_share"`
}

type Owner

type Owner struct {
	Kind string `json:"kind"`
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Query

type Query struct {
	TimeRange string
	SortBy    string
	Limit     int
}

func ParseQuery

func ParseQuery(values url.Values) (Query, error)

func (Query) Validate

func (q Query) Validate() error

type Resolution

type Resolution struct {
	Keys     map[KeyRef]string
	Warnings []string
}

type Response

type Response struct {
	State        string     `json:"state"`
	DataSource   string     `json:"data_source"`
	Window       *Window    `json:"window"`
	GeneratedAt  *time.Time `json:"generated_at"`
	Summary      *Summary   `json:"summary"`
	Items        []Item     `json:"items"`
	Unattributed *Metrics   `json:"unattributed"`
	Warnings     []string   `json:"warnings"`
}

type Summary

type Summary struct {
	KeyCount uint64 `json:"key_count"`
	Metrics
}

type Totals

type Totals struct {
	Requests, Success, Input, Output, Cached, CacheCreation uint64
	Cost                                                    decimal.Decimal
}

func (*Totals) Add

func (t *Totals) Add(other Totals)

func (Totals) Tokens

func (t Totals) Tokens() uint64

type Window

type Window struct {
	Start    time.Time `json:"start"`
	End      time.Time `json:"end"`
	Timezone string    `json:"timezone"`
}

func ResolveWindow

func ResolveWindow(q Query, end time.Time) Window

ResolveWindow expects a validated query and preserves the server's day boundary.

Jump to

Keyboard shortcuts

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