models

package
v0.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: MIT Imports: 7 Imported by: 5

Documentation

Index

Constants

View Source
const LimitRows = 32_000

Variables

This section is empty.

Functions

This section is empty.

Types

type BillingPeriod added in v0.3.0

type BillingPeriod struct {
	StartDate       string  `json:"start_date"`
	EndDate         string  `json:"end_date"`
	CreditsUsed     float64 `json:"credits_used"`
	CreditsIncluded int     `json:"credits_included"`
}

type CancelResponse

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

func (CancelResponse) HasError

func (r CancelResponse) HasError() error

type CreateQueryRequest added in v0.4.0

type CreateQueryRequest struct {
	Name        string           `json:"name"`
	QuerySQL    string           `json:"query_sql"`
	Description string           `json:"description,omitempty"`
	IsPrivate   bool             `json:"is_private,omitempty"`
	IsTemp      bool             `json:"is_temp,omitempty"`
	Parameters  []QueryParameter `json:"parameters,omitempty"`
}

type CreateQueryResponse added in v0.4.0

type CreateQueryResponse struct {
	QueryID int `json:"query_id"`
}

type CreateVisualizationRequest added in v0.4.6

type CreateVisualizationRequest struct {
	QueryID     int            `json:"query_id"`
	Name        string         `json:"name"`
	Type        string         `json:"type"`
	Description string         `json:"description,omitempty"`
	Options     map[string]any `json:"options,omitempty"`
}

type CreateVisualizationResponse added in v0.4.6

type CreateVisualizationResponse struct {
	ID int64 `json:"id"`
}

type DatasetColumn added in v0.3.0

type DatasetColumn struct {
	Name        string         `json:"name"`
	Type        string         `json:"type"`
	Nullable    bool           `json:"nullable"`
	Description string         `json:"description,omitempty"`
	Metadata    map[string]any `json:"metadata,omitempty"`
}

type DatasetOwner added in v0.3.0

type DatasetOwner struct {
	Handle string `json:"handle"`
	Type   string `json:"type"`
}

type DatasetResponse added in v0.3.0

type DatasetResponse struct {
	Type      string          `json:"type"`
	FullName  string          `json:"full_name"`
	IsPrivate bool            `json:"is_private"`
	Columns   []DatasetColumn `json:"columns"`
	Owner     *DatasetOwner   `json:"owner"`
	Metadata  map[string]any  `json:"metadata,omitempty"`
	CreatedAt string          `json:"created_at"`
	UpdatedAt string          `json:"updated_at"`
}

func (DatasetResponse) HasError added in v0.3.0

func (d DatasetResponse) HasError() error

type DeleteVisualizationResponse added in v0.4.7

type DeleteVisualizationResponse struct {
	OK bool `json:"ok"`
}

type ExecuteRequest

type ExecuteRequest struct {
	QueryID         int            `json:"-"`
	QueryParameters map[string]any `json:"query_parameters,omitempty"`
	Performance     string         `json:"performance,omitempty"`
}

type ExecuteResponse

type ExecuteResponse struct {
	ExecutionID string `json:"execution_id,omitempty"`
	State       string `json:"state,omitempty"`
}

func (ExecuteResponse) HasError

func (e ExecuteResponse) HasError() error

type ExecuteSQLRequest added in v0.3.0

type ExecuteSQLRequest struct {
	SQL             string         `json:"sql"`
	Performance     string         `json:"performance,omitempty"`
	QueryParameters map[string]any `json:"query_parameters,omitempty"`
}

type ExecutionError added in v0.3.0

type ExecutionError struct {
	Type     string                 `json:"type"`
	Message  string                 `json:"message"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

type GetQueryResponse added in v0.4.0

type GetQueryResponse struct {
	QueryID     int              `json:"query_id"`
	Name        string           `json:"name"`
	Description string           `json:"description"`
	QuerySQL    string           `json:"query_sql"`
	Owner       string           `json:"owner"`
	IsPrivate   bool             `json:"is_private"`
	IsArchived  bool             `json:"is_archived"`
	IsUnsaved   bool             `json:"is_unsaved"`
	IsTemp      bool             `json:"is_temp"`
	Version     int              `json:"version"`
	QueryEngine string           `json:"query_engine"`
	Tags        []string         `json:"tags"`
	Parameters  []QueryParameter `json:"parameters"`
}

type GetVisualizationResponse added in v0.4.7

type GetVisualizationResponse struct {
	ID          int64          `json:"id"`
	QueryID     int64          `json:"query_id"`
	Name        string         `json:"name"`
	Description string         `json:"description"`
	Type        string         `json:"type"`
	Options     map[string]any `json:"options"`
	CreatedAt   string         `json:"created_at"`
	UpdatedAt   string         `json:"updated_at"`
}

type ListDatasetsResponse added in v0.3.0

type ListDatasetsResponse struct {
	Datasets []DatasetResponse `json:"datasets"`
	Total    int               `json:"total"`
}

func (ListDatasetsResponse) HasError added in v0.3.0

func (l ListDatasetsResponse) HasError() error

type ListVisualizationsResponse added in v0.4.7

type ListVisualizationsResponse struct {
	Results    []VisualizationSummary `json:"results"`
	TotalCount int32                  `json:"total_count"`
}

type PipelineExecuteRequest added in v0.3.0

type PipelineExecuteRequest struct {
	QueryID     string `json:"-"`
	Performance string `json:"performance,omitempty"`
}

type PipelineExecuteResponse added in v0.3.0

type PipelineExecuteResponse struct {
	PipelineExecutionID string `json:"pipeline_execution_id,omitempty"`
}

type PipelineNodeExecution added in v0.3.0

type PipelineNodeExecution struct {
	ID                   int                          `json:"id,omitempty"`
	QueryExecutionStatus PipelineQueryExecutionStatus `json:"query_execution_status,omitempty"`
}

type PipelineQueryExecutionStatus added in v0.3.0

type PipelineQueryExecutionStatus struct {
	Status      string `json:"status,omitempty"`
	QueryID     int    `json:"query_id,omitempty"`
	ExecutionID string `json:"execution_id,omitempty"`
}

type PipelineStatusResponse added in v0.3.0

type PipelineStatusResponse struct {
	Status         string                  `json:"status,omitempty"`
	NodeExecutions []PipelineNodeExecution `json:"node_executions,omitempty"`
}

type QueryParameter added in v0.4.0

type QueryParameter struct {
	Key         string   `json:"key"`
	Type        string   `json:"type"`
	Value       string   `json:"value"`
	EnumOptions []string `json:"enumOptions,omitempty"`
}

type Result

type Result struct {
	Metadata ResultMetadata   `json:"metadata,omitempty"`
	Rows     []map[string]any `json:"rows,omitempty"`
}

type ResultMetadata

type ResultMetadata struct {
	ColumnNames         []string `json:"column_names,omitempty"`
	ResultSetBytes      int64    `json:"result_set_bytes,omitempty"`
	RowCount            int      `json:"row_count,omitempty"`
	TotalResultSetBytes int64    `json:"total_result_set_bytes,omitempty"`
	TotalRowCount       int      `json:"total_row_count,omitempty"`
	DatapointCount      int      `json:"datapoint_count,omitempty"`
}

type ResultOptions

type ResultOptions struct {
	// request a specific page of rows
	Page *ResultPageOption
}

ResultOptions is a struct that contains options for getting a result

func (ResultOptions) ToURLValues

func (r ResultOptions) ToURLValues() url.Values

type ResultPageOption

type ResultPageOption struct {
	// we can have more than 2^32 rows, so we need to use int64 for the offset
	Offset uint64
	// assume server can't return more than 2^32 rows
	Limit uint32
}

To paginate a large result set

type ResultsResponse

type ResultsResponse struct {
	QueryID             int64           `json:"query_id"`
	State               string          `json:"state"`
	SubmittedAt         time.Time       `json:"submitted_at"`
	ExpiresAt           time.Time       `json:"expires_at"`
	ExecutionStartedAt  *time.Time      `json:"execution_started_at,omitempty"`
	ExecutionEndedAt    *time.Time      `json:"execution_ended_at,omitempty"`
	CancelledAt         *time.Time      `json:"cancelled_at,omitempty"`
	Error               *ExecutionError `json:"error,omitempty"`
	Result              Result          `json:"result,omitempty"`
	NextOffset          *uint64         `json:"next_offset,omitempty"`
	NextURI             *string         `json:"next_uri,omitempty"`
	IsExecutionFinished bool            `json:"is_execution_finished,omitempty"`
}

func (*ResultsResponse) AddPageResult

func (r *ResultsResponse) AddPageResult(pageResp *ResultsResponse)

func (ResultsResponse) HasError

func (r ResultsResponse) HasError() error

func (ResultsResponse) IsEmpty

func (r ResultsResponse) IsEmpty() bool

type SearchDatasetMetadata added in v0.4.1

type SearchDatasetMetadata struct {
	PageRankScore *float64        `json:"page_rank_score,omitempty"`
	Description   *string         `json:"description,omitempty"`
	AbiType       *string         `json:"abi_type,omitempty"`
	ContractName  *string         `json:"contract_name,omitempty"`
	ProjectName   *string         `json:"project_name,omitempty"`
	SpellType     *string         `json:"spell_type,omitempty"`
	SpellMetadata json.RawMessage `json:"spell_metadata,omitempty"`
}

type SearchDatasetResult added in v0.4.1

type SearchDatasetResult struct {
	FullName    string                 `json:"full_name"`
	Category    string                 `json:"category"`
	DatasetType *string                `json:"dataset_type,omitempty"`
	Blockchains []string               `json:"blockchains,omitempty"`
	Visibility  *string                `json:"visibility,omitempty"`
	OwnerScope  *string                `json:"owner_scope,omitempty"`
	Description *string                `json:"description,omitempty"`
	Schema      json.RawMessage        `json:"schema,omitempty"`
	Metadata    *SearchDatasetMetadata `json:"metadata,omitempty"`
}

type SearchDatasetsByContractAddressRequest added in v0.4.3

type SearchDatasetsByContractAddressRequest struct {
	ContractAddress string   `json:"contract_address"`
	Blockchains     []string `json:"blockchains,omitempty"`
	Limit           *int32   `json:"limit,omitempty"`
	Offset          *int32   `json:"offset,omitempty"`
	IncludeSchema   *bool    `json:"include_schema,omitempty"`
}

type SearchDatasetsPagination added in v0.4.1

type SearchDatasetsPagination struct {
	Limit      int32  `json:"limit"`
	Offset     int32  `json:"offset"`
	NextOffset *int32 `json:"next_offset,omitempty"`
	HasMore    bool   `json:"has_more"`
}

type SearchDatasetsRequest added in v0.4.1

type SearchDatasetsRequest struct {
	Query           *string  `json:"query,omitempty"`
	Categories      []string `json:"categories,omitempty"`
	Blockchains     []string `json:"blockchains,omitempty"`
	DatasetTypes    []string `json:"dataset_types,omitempty"`
	Schemas         []string `json:"schemas,omitempty"`
	OwnerScope      *string  `json:"owner_scope,omitempty"`
	IncludePrivate  *bool    `json:"include_private,omitempty"`
	IncludeSchema   *bool    `json:"include_schema,omitempty"`
	IncludeMetadata *bool    `json:"include_metadata,omitempty"`
	Limit           *int32   `json:"limit,omitempty"`
	Offset          *int32   `json:"offset,omitempty"`
}

type SearchDatasetsResponse added in v0.4.1

type SearchDatasetsResponse struct {
	Total      int32                    `json:"total"`
	Results    []SearchDatasetResult    `json:"results"`
	Pagination SearchDatasetsPagination `json:"pagination"`
}

type StatusResponse

type StatusResponse struct {
	ExecutionID        string          `json:"execution_id,omitempty"`
	QueryID            int             `json:"query_id,omitempty"`
	State              string          `json:"state,omitempty"`
	SubmittedAt        time.Time       `json:"submitted_at,omitempty"`
	ExecutionStartedAt *time.Time      `json:"execution_started_at,omitempty"`
	ExecutionEndedAt   *time.Time      `json:"execution_ended_at,omitempty"`
	CancelledAt        *time.Time      `json:"cancelled_at,omitempty"`
	Error              *ExecutionError `json:"error,omitempty"`
	ResultMetadata     *ResultMetadata `json:"result_metadata,omitempty"`
}

func (StatusResponse) HasError

func (s StatusResponse) HasError() error

type UpdateQueryRequest added in v0.4.0

type UpdateQueryRequest struct {
	Name        *string          `json:"name,omitempty"`
	QuerySQL    *string          `json:"query_sql,omitempty"`
	Description *string          `json:"description,omitempty"`
	IsPrivate   *bool            `json:"is_private,omitempty"`
	IsArchived  *bool            `json:"is_archived,omitempty"`
	Tags        []string         `json:"tags,omitempty"`
	Parameters  []QueryParameter `json:"parameters,omitempty"`
}

type UpdateQueryResponse added in v0.4.0

type UpdateQueryResponse struct {
	QueryID int `json:"query_id"`
}

type UpdateVisualizationRequest added in v0.4.7

type UpdateVisualizationRequest struct {
	Name        string         `json:"name"`
	Type        string         `json:"type"`
	Description string         `json:"description"`
	Options     map[string]any `json:"options"`
}

type UpdateVisualizationResponse added in v0.4.7

type UpdateVisualizationResponse struct {
	ID int64 `json:"id"`
}

type UploadsCSVRequest added in v0.3.0

type UploadsCSVRequest struct {
	TableName   string `json:"table_name"`
	Data        string `json:"data"`
	Description string `json:"description,omitempty"`
	IsPrivate   bool   `json:"is_private,omitempty"`
}

type UploadsCSVResponse added in v0.3.0

type UploadsCSVResponse struct {
	Success      bool   `json:"success"`
	TableName    string `json:"table_name"`
	FullName     string `json:"full_name"`
	ExampleQuery string `json:"example_query"`
}

type UploadsClearResponse added in v0.3.0

type UploadsClearResponse struct {
	Message string `json:"message"`
}

type UploadsColumn added in v0.3.0

type UploadsColumn struct {
	Name        string         `json:"name"`
	Type        string         `json:"type"`
	Nullable    bool           `json:"nullable"`
	Metadata    map[string]any `json:"metadata,omitempty"`
	Description string         `json:"description,omitempty"`
}

type UploadsCreateRequest added in v0.3.0

type UploadsCreateRequest struct {
	Namespace   string          `json:"namespace"`
	TableName   string          `json:"table_name"`
	Schema      []UploadsColumn `json:"schema"`
	Description string          `json:"description,omitempty"`
	IsPrivate   bool            `json:"is_private,omitempty"`
}

type UploadsCreateResponse added in v0.3.0

type UploadsCreateResponse struct {
	Namespace      string `json:"namespace"`
	TableName      string `json:"table_name"`
	FullName       string `json:"full_name"`
	ExampleQuery   string `json:"example_query"`
	AlreadyExisted bool   `json:"already_existed"`
	Message        string `json:"message"`
}

type UploadsDeleteResponse added in v0.3.0

type UploadsDeleteResponse struct {
	Message string `json:"message"`
}

type UploadsInsertResponse added in v0.3.0

type UploadsInsertResponse struct {
	Name         string `json:"name"`
	RowsWritten  int64  `json:"rows_written"`
	BytesWritten int64  `json:"bytes_written"`
}

type UploadsListElement added in v0.3.0

type UploadsListElement struct {
	FullName       string          `json:"full_name"`
	IsPrivate      bool            `json:"is_private"`
	TableSizeBytes string          `json:"table_size_bytes"`
	CreatedAt      time.Time       `json:"created_at"`
	UpdatedAt      time.Time       `json:"updated_at"`
	PurgedAt       *time.Time      `json:"purged_at,omitempty"`
	Owner          UploadsOwner    `json:"owner"`
	Columns        []UploadsColumn `json:"columns"`
}

type UploadsListResponse added in v0.3.0

type UploadsListResponse struct {
	Tables []UploadsListElement `json:"tables"`
}

type UploadsOwner added in v0.3.0

type UploadsOwner struct {
	Handle string `json:"handle"`
	Type   string `json:"type"`
}

type UsageRequest added in v0.3.0

type UsageRequest struct {
	StartDate *string `json:"start_date,omitempty"`
	EndDate   *string `json:"end_date,omitempty"`
}

type UsageResponse added in v0.3.0

type UsageResponse struct {
	PrivateQueries    int             `json:"private_queries"`
	PrivateDashboards int             `json:"private_dashboards"`
	BytesUsed         int64           `json:"bytes_used"`
	BytesAllowed      int64           `json:"bytes_allowed"`
	BillingPeriods    []BillingPeriod `json:"billing_periods"`
}

type VisualizationSummary added in v0.4.7

type VisualizationSummary struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	Type      string `json:"type"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
}

type WhoAmIResponse added in v0.4.4

type WhoAmIResponse struct {
	CustomerID string `json:"customer_id"` // e.g. "user_123" or "team_456"
	CreatedBy  int    `json:"created_by"`  // integer user ID of the key creator
	APIKeyID   string `json:"api_key_id"`  // ULID of the API key
	Handle     string `json:"handle"`      // username or team handle
}

WhoAmIResponse represents the response from the /api/whoami endpoint. It identifies the user or team associated with the current API key.

Jump to

Keyboard shortcuts

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