proofchain

package module
v0.0.0-...-8935ba0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package proofchain provides a Go client for the ProofChain API.

ProofChain is a blockchain-anchored document attestation platform. This SDK provides methods for attesting documents, managing events, streaming to state channels, issuing certificates, and more.

Basic usage:

client := proofchain.NewClient("your-api-key")
result, err := client.Documents.Attest(ctx, &proofchain.AttestRequest{
    FilePath:  "contract.pdf",
    UserID:    "user@example.com",
})

Package proofchain provides a Go client for the ProofChain API.

Package proofchain provides a Go client for the ProofChain API.

Package proofchain provides a Go client for the ProofChain API.

Package proofchain provides a Go client for the ProofChain API.

Package proofchain provides a Go client for the ProofChain API.

Package proofchain provides a Go client for the ProofChain API.

Package proofchain provides a Go client for the ProofChain API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Message      string                 `json:"message"`
	StatusCode   int                    `json:"status_code,omitempty"`
	ResponseBody map[string]interface{} `json:"response_body,omitempty"`
}

APIError is the base error type for ProofChain API errors.

func (*APIError) Error

func (e *APIError) Error() string

type APIKey

type APIKey struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	KeyPrefix   string     `json:"key_prefix"`
	Permissions []string   `json:"permissions"`
	CreatedAt   Timestamp  `json:"created_at"`
	LastUsedAt  *Timestamp `json:"last_used_at,omitempty"`
	ExpiresAt   *Timestamp `json:"expires_at,omitempty"`
	IsActive    bool       `json:"is_active"`
	// Key is only available when creating a new key
	Key string `json:"key,omitempty"`
}

APIKey represents an API key for the tenant.

type Achievement

type Achievement struct {
	ID            string                 `json:"id"`
	TenantID      string                 `json:"tenant_id"`
	AchievementID string                 `json:"achievement_id"`
	Name          string                 `json:"name"`
	Description   *string                `json:"description,omitempty"`
	Category      *string                `json:"category,omitempty"`
	PointsReward  int                    `json:"points_reward"`
	Requirements  map[string]interface{} `json:"requirements"`
	CreatedAt     time.Time              `json:"created_at"`
}

Achievement represents an achievement that can be earned

type ActivitySummaryView

type ActivitySummaryView struct {
	WalletAddress    string         `json:"wallet_address"`
	TotalEvents      int            `json:"total_events"`
	EventCountByType map[string]int `json:"event_count_by_type"`
	LastActivity     string         `json:"last_activity"`
	ActiveDays       int            `json:"active_days"`
	PeriodDays       int            `json:"period_days"`
	ComputedAt       string         `json:"computed_at"`
}

ActivitySummaryView is the builtin activity summary view result.

type AddNFTRequest

type AddNFTRequest struct {
	ContractAddress string                 `json:"contract_address"`
	TokenID         string                 `json:"token_id"`
	Network         string                 `json:"network"`
	Metadata        map[string]interface{} `json:"metadata,omitempty"`
	Source          string                 `json:"source,omitempty"`
}

type AttestBytesRequest

type AttestBytesRequest struct {
	Content   []byte                 `json:"content"`
	Filename  string                 `json:"filename"`
	UserID    string                 `json:"user_id"`
	EventType string                 `json:"event_type,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
	Encrypt   bool                   `json:"encrypt,omitempty"`
}

AttestBytesRequest is the request for attesting raw bytes.

type AttestRequest

type AttestRequest struct {
	FilePath  string                 `json:"file_path"`
	UserID    string                 `json:"user_id"`
	EventType string                 `json:"event_type,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
	Encrypt   bool                   `json:"encrypt,omitempty"`
}

AttestRequest is the request for attesting a document file.

type AttestationMode

type AttestationMode string

AttestationMode represents how an attestation was processed.

const (
	AttestationModeDirect  AttestationMode = "direct"
	AttestationModeBatch   AttestationMode = "batch"
	AttestationModeChannel AttestationMode = "channel"
)

type AttestationResult

type AttestationResult struct {
	ID              string          `json:"id"`
	IPFSHash        string          `json:"ipfs_hash"`
	DocumentHash    string          `json:"document_hash"`
	GatewayURL      string          `json:"gateway_url"`
	VerifyURL       string          `json:"verify_url"`
	CertificateID   string          `json:"certificate_id"`
	Status          EventStatus     `json:"status"`
	AttestationMode AttestationMode `json:"attestation_mode"`
	Timestamp       Timestamp       `json:"timestamp"`
	BlockchainTx    *string         `json:"blockchain_tx,omitempty"`
	Proof           []string        `json:"proof,omitempty"`
}

AttestationResult is the result of a document attestation.

type AuthenticationError

type AuthenticationError struct {
	APIError
}

AuthenticationError is returned when authentication fails (401).

func NewAuthenticationError

func NewAuthenticationError(message string) *AuthenticationError

NewAuthenticationError creates a new AuthenticationError.

type AuthorizationError

type AuthorizationError struct {
	APIError
}

AuthorizationError is returned when access is forbidden (403).

func NewAuthorizationError

func NewAuthorizationError(message string) *AuthorizationError

NewAuthorizationError creates a new AuthorizationError.

type Badge

type Badge struct {
	ID           string                 `json:"id"`
	TenantID     string                 `json:"tenant_id"`
	BadgeID      string                 `json:"badge_id"`
	Name         string                 `json:"name"`
	Description  *string                `json:"description,omitempty"`
	IconURL      *string                `json:"icon_url,omitempty"`
	Rarity       string                 `json:"rarity"`
	Requirements map[string]interface{} `json:"requirements"`
	CreatedAt    time.Time              `json:"created_at"`
}

Badge represents a badge that can be earned

type BatchIngestRequest

type BatchIngestRequest struct {
	Events []IngestEventRequest `json:"events"`
}

BatchIngestRequest is the request for ingesting multiple events.

type BatchIngestResponse

type BatchIngestResponse struct {
	TotalEvents int                   `json:"total_events"`
	Queued      int                   `json:"queued"`
	Failed      int                   `json:"failed"`
	Results     []IngestEventResponse `json:"results"`
}

BatchIngestResponse is the response from batch ingestion.

type BatchVerifyItem

type BatchVerifyItem struct {
	Type string `json:"type"` // "certificate", "ipfs_hash", "event_id"
	ID   string `json:"id"`
}

BatchVerifyItem is an item to verify in a batch request.

type BatchVerifyResult

type BatchVerifyResult struct {
	BatchID      string                   `json:"batch_id"`
	MerkleRoot   string                   `json:"merkle_root"`
	TotalEvents  int                      `json:"total_events"`
	BlockchainTx *string                  `json:"blockchain_tx,omitempty"`
	BlockNumber  *int64                   `json:"block_number,omitempty"`
	Verified     bool                     `json:"verified"`
	Events       []map[string]interface{} `json:"events"`
}

BatchVerifyResult is the result of verifying a batch.

type BlockchainProof

type BlockchainProof struct {
	CertificateID string   `json:"certificate_id"`
	Verified      bool     `json:"verified"`
	TxHash        *string  `json:"tx_hash,omitempty"`
	BlockNumber   *int64   `json:"block_number,omitempty"`
	MerkleRoot    *string  `json:"merkle_root,omitempty"`
	MerkleProof   []string `json:"merkle_proof,omitempty"`
	LeafIndex     *int     `json:"leaf_index,omitempty"`
	ChainName     string   `json:"chain_name"`
}

BlockchainProof contains blockchain proof for a certificate.

type BlockchainStats

type BlockchainStats struct {
	TotalTransactions   int     `json:"total_transactions"`
	TotalGasUsed        int64   `json:"total_gas_used"`
	TotalEventsAttested int     `json:"total_events_attested"`
	PendingEvents       int     `json:"pending_events"`
	LastTransaction     *string `json:"last_transaction,omitempty"`
	ContractAddress     *string `json:"contract_address,omitempty"`
	ChainID             int     `json:"chain_id"`
	ChainName           string  `json:"chain_name"`
}

BlockchainStats contains blockchain statistics for the tenant.

type Certificate

type Certificate struct {
	CertificateID    string                 `json:"certificate_id"`
	RecipientName    string                 `json:"recipient_name"`
	RecipientEmail   *string                `json:"recipient_email,omitempty"`
	Title            string                 `json:"title"`
	Description      *string                `json:"description,omitempty"`
	IPFSHash         string                 `json:"ipfs_hash"`
	VerifyURL        string                 `json:"verify_url"`
	QRCodeURL        string                 `json:"qr_code_url"`
	IssuedAt         Timestamp              `json:"issued_at"`
	ExpiresAt        *Timestamp             `json:"expires_at,omitempty"`
	Revoked          bool                   `json:"revoked"`
	RevokedAt        *Timestamp             `json:"revoked_at,omitempty"`
	RevocationReason *string                `json:"revocation_reason,omitempty"`
	Metadata         map[string]interface{} `json:"metadata,omitempty"`
	BlockchainTx     *string                `json:"blockchain_tx,omitempty"`
}

Certificate represents an issued certificate.

type CertificateVerifyResult

type CertificateVerifyResult struct {
	CertificateID string                 `json:"certificate_id"`
	Status        string                 `json:"status"`
	Type          string                 `json:"type"`
	Event         map[string]interface{} `json:"event"`
	Issuer        map[string]interface{} `json:"issuer"`
	Verification  map[string]interface{} `json:"verification"`
	Blockchain    map[string]interface{} `json:"blockchain"`
}

CertificateVerifyResult is the result of verifying a certificate.

func (*CertificateVerifyResult) IsValid

func (c *CertificateVerifyResult) IsValid() bool

IsValid returns true if the certificate is valid.

type CertificatesResource

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

CertificatesResource handles certificate operations.

func (*CertificatesResource) Get

func (r *CertificatesResource) Get(ctx context.Context, certificateID string) (*Certificate, error)

Get retrieves a certificate by ID.

func (*CertificatesResource) Issue

Issue issues a new certificate.

func (*CertificatesResource) List

List lists certificates.

func (*CertificatesResource) Revoke

func (r *CertificatesResource) Revoke(ctx context.Context, certificateID, reason string) (*Certificate, error)

Revoke revokes a certificate.

func (*CertificatesResource) Verify

func (r *CertificatesResource) Verify(ctx context.Context, certificateID string) (map[string]interface{}, error)

Verify verifies a certificate.

type Channel

type Channel struct {
	ChannelID string       `json:"channel_id"`
	Name      string       `json:"name"`
	State     ChannelState `json:"state"`
	CreatedAt Timestamp    `json:"created_at"`
}

Channel represents a state channel for high-volume streaming.

type ChannelState

type ChannelState string

ChannelState represents the state of a state channel.

const (
	ChannelStateOpen     ChannelState = "open"
	ChannelStateSyncing  ChannelState = "syncing"
	ChannelStateSettling ChannelState = "settling"
	ChannelStateSettled  ChannelState = "settled"
	ChannelStateClosed   ChannelState = "closed"
)

type ChannelStatus

type ChannelStatus struct {
	ChannelID      string       `json:"channel_id"`
	Name           string       `json:"name"`
	State          ChannelState `json:"state"`
	EventCount     int          `json:"event_count"`
	SyncedCount    int          `json:"synced_count"`
	PendingCount   int          `json:"pending_count"`
	CreatedAt      Timestamp    `json:"created_at"`
	LastActivity   *Timestamp   `json:"last_activity,omitempty"`
	LastSettlement *Timestamp   `json:"last_settlement,omitempty"`
	MerkleRoot     *string      `json:"merkle_root,omitempty"`
}

ChannelStatus contains detailed status information for a channel.

type ChannelsResource

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

ChannelsResource handles state channel operations.

func (*ChannelsResource) Close

func (r *ChannelsResource) Close(ctx context.Context, channelID string) (*Channel, error)

Close closes a channel.

func (*ChannelsResource) Create

Create creates a new state channel.

func (*ChannelsResource) Get

func (r *ChannelsResource) Get(ctx context.Context, channelID string) (*Channel, error)

Get retrieves a channel by ID.

func (*ChannelsResource) List

func (r *ChannelsResource) List(ctx context.Context, limit, offset int) ([]Channel, error)

List lists all channels.

func (*ChannelsResource) Settle

func (r *ChannelsResource) Settle(ctx context.Context, channelID string) (*Settlement, error)

Settle settles a channel on-chain.

func (*ChannelsResource) Status

func (r *ChannelsResource) Status(ctx context.Context, channelID string) (*ChannelStatus, error)

Status retrieves detailed status of a channel.

func (*ChannelsResource) Stream

func (r *ChannelsResource) Stream(ctx context.Context, channelID string, req *StreamEventRequest) (*StreamAck, error)

Stream streams an event to a channel.

func (*ChannelsResource) StreamBatch

func (r *ChannelsResource) StreamBatch(ctx context.Context, channelID string, events []StreamEventRequest) (map[string]interface{}, error)

StreamBatch streams multiple events in a single request.

type Client

type Client struct {

	// Resource managers
	Documents      *DocumentsResource
	Events         *EventsResource
	Channels       *ChannelsResource
	Certificates   *CertificatesResource
	Webhooks       *WebhooksResource
	Vault          *VaultResource
	Search         *SearchResource
	VerifyResource *VerifyResource
	Tenant         *TenantResource
	Passports      *PassportClient
	Wallets        *WalletClient
	Users          *EndUsersClient
	Rewards        *RewardsClient
	Quests         *QuestsClient
	Schemas        *SchemasClient
	DataViews      *DataViewsClient
	Cohorts        *CohortLeaderboardClient
	Fanpass        *FanpassLeaderboardClient
	// contains filtered or unexported fields
}

Client is the main ProofChain API client.

func NewClient

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

NewClient creates a new ProofChain client.

func NewClientFromEnv

func NewClientFromEnv(opts ...HTTPClientOption) (*Client, error)

NewClientFromEnv creates a client using the PROOFCHAIN_API_KEY environment variable.

func (*Client) TenantInfo

func (c *Client) TenantInfo(ctx context.Context) (*TenantInfo, error)

TenantInfo returns information about the current tenant.

func (*Client) Usage

func (c *Client) Usage(ctx context.Context, period string) (*UsageStats, error)

Usage returns API usage statistics.

func (*Client) Verify

func (c *Client) Verify(ctx context.Context, ipfsHash string) (*VerificationResult, error)

Verify verifies a document or event by its IPFS hash.

type CohortDefinition

type CohortDefinition struct {
	ID          string   `json:"id"`
	TenantID    string   `json:"tenant_id"`
	Name        string   `json:"name"`
	Slug        string   `json:"slug"`
	Description *string  `json:"description,omitempty"`
	ScoringType string   `json:"scoring_type"`
	Icon        *string  `json:"icon,omitempty"`
	Color       *string  `json:"color,omitempty"`
	Status      string   `json:"status"`
	AvgScore    *float64 `json:"avg_score,omitempty"`
	TotalUsers  *int     `json:"total_users,omitempty"`
	CreatedAt   string   `json:"created_at"`
	UpdatedAt   string   `json:"updated_at"`
}

CohortDefinition represents a cohort scoring definition.

type CohortGroupStats

type CohortGroupStats struct {
	FilteredAvgPercentile     *float64 `json:"filtered_avg_percentile,omitempty"`
	FilteredTopNAvgPercentile *float64 `json:"filtered_top_n_avg_percentile,omitempty"`
	GlobalCount               int      `json:"global_count"`
	GlobalAvgPercentile       float64  `json:"global_avg_percentile"`
}

CohortGroupStats contains aggregate statistics for a cohort group.

type CohortLeaderboardClient

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

CohortLeaderboardClient provides cohort leaderboard operations.

func NewCohortLeaderboardClient

func NewCohortLeaderboardClient(http *HTTPClient) *CohortLeaderboardClient

NewCohortLeaderboardClient creates a new cohort leaderboard client.

func (*CohortLeaderboardClient) Get

Get returns a cohort definition by ID.

func (*CohortLeaderboardClient) GetLeaderboard

GetLeaderboard returns the filtered cohort leaderboard with global and filtered percentiles.

func (*CohortLeaderboardClient) GetUserBreakdown

func (c *CohortLeaderboardClient) GetUserBreakdown(ctx context.Context, userID string, filters map[string]string, country string) (*UserBreakdownResponse, error)

GetUserBreakdown returns a user's breakdown across all cohorts (for spider charts).

func (*CohortLeaderboardClient) List

List returns all cohort definitions.

type CohortLeaderboardEntry

type CohortLeaderboardEntry struct {
	Rank               int                     `json:"rank"`
	UserID             string                  `json:"user_id"`
	Score              float64                 `json:"score"`
	PercentileGlobal   float64                 `json:"percentile_global"`
	PercentileFiltered *float64                `json:"percentile_filtered,omitempty"`
	ComputedAt         *string                 `json:"computed_at,omitempty"`
	User               *LeaderboardUserProfile `json:"user,omitempty"`
}

CohortLeaderboardEntry is a single entry in a cohort leaderboard.

type CohortLeaderboardOptions

type CohortLeaderboardOptions struct {
	Filters map[string]string
	Country string
	Limit   int
	TopN    int
	Fresh   bool
	UserID  string
}

CohortLeaderboardOptions configures the GetLeaderboard query.

type CohortLeaderboardResponse

type CohortLeaderboardResponse struct {
	CohortID                 string                   `json:"cohort_id"`
	CohortName               string                   `json:"cohort_name"`
	Filter                   map[string]interface{}   `json:"filter"`
	TotalUsers               int                      `json:"total_users"`
	GroupStats               CohortGroupStats         `json:"group_stats"`
	Leaderboard              []CohortLeaderboardEntry `json:"leaderboard"`
	CurrentUser              *CohortLeaderboardEntry  `json:"current_user,omitempty"`
	CurrentUserInLeaderboard bool                     `json:"current_user_in_leaderboard"`
}

CohortLeaderboardResponse is the full leaderboard response.

type ComprehensiveWalletInfo

type ComprehensiveWalletInfo struct {
	WalletID       string                 `json:"wallet_id"`
	Address        string                 `json:"address"`
	UserID         string                 `json:"user_id"`
	WalletType     string                 `json:"wallet_type"`
	Network        string                 `json:"network"`
	Name           *string                `json:"name,omitempty"`
	Status         string                 `json:"status"`
	SupportsExport bool                   `json:"supports_export"`
	CreatedAt      string                 `json:"created_at"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
	OwnerWalletID  *string                `json:"owner_wallet_id,omitempty"`
	OwnerAddress   *string                `json:"owner_address,omitempty"`
	IsDeployed     *bool                  `json:"is_deployed,omitempty"`
	Balances       *WalletBalanceInfo     `json:"balances,omitempty"`
	NFTs           *WalletNFTInfo         `json:"nfts,omitempty"`
	Activity       *WalletActivityInfo    `json:"activity,omitempty"`
}

ComprehensiveWalletInfo contains all wallet data in one response

type CreateAPIKeyRequest

type CreateAPIKeyRequest struct {
	Name          string   `json:"name"`
	Permissions   []string `json:"permissions,omitempty"`
	ExpiresInDays int      `json:"expires_in_days,omitempty"`
}

CreateAPIKeyRequest contains parameters for creating an API key.

type CreateAchievementRequest

type CreateAchievementRequest struct {
	AchievementID string                 `json:"achievement_id"`
	Name          string                 `json:"name"`
	Description   *string                `json:"description,omitempty"`
	Category      *string                `json:"category,omitempty"`
	PointsReward  int                    `json:"points_reward,omitempty"`
	Requirements  map[string]interface{} `json:"requirements,omitempty"`
}

CreateAchievementRequest is the request to create an achievement

type CreateBadgeRequest

type CreateBadgeRequest struct {
	BadgeID      string                 `json:"badge_id"`
	Name         string                 `json:"name"`
	Description  *string                `json:"description,omitempty"`
	IconURL      *string                `json:"icon_url,omitempty"`
	Rarity       string                 `json:"rarity,omitempty"`
	Requirements map[string]interface{} `json:"requirements,omitempty"`
}

CreateBadgeRequest is the request to create a badge

type CreateChannelRequest

type CreateChannelRequest struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
}

CreateChannelRequest is the request for creating a state channel.

type CreateDataViewRequest

type CreateDataViewRequest struct {
	Name             string      `json:"name"`
	DisplayName      string      `json:"display_name"`
	Description      string      `json:"description"`
	ViewType         string      `json:"view_type,omitempty"`
	Computation      interface{} `json:"computation"` // single or []DataViewComputation
	SourceCategories []string    `json:"source_categories,omitempty"`
	IsPublic         *bool       `json:"is_public,omitempty"`
}

CreateDataViewRequest creates a new custom data view.

type CreateDualWalletsRequest

type CreateDualWalletsRequest struct {
	UserID     string  `json:"user_id"`
	Network    string  `json:"network,omitempty"`
	NamePrefix *string `json:"name_prefix,omitempty"`
}

type CreateEndUserRequest

type CreateEndUserRequest struct {
	ExternalID    string                 `json:"external_id"`
	Email         *string                `json:"email,omitempty"`
	FirstName     *string                `json:"first_name,omitempty"`
	LastName      *string                `json:"last_name,omitempty"`
	DisplayName   *string                `json:"display_name,omitempty"`
	Phone         *string                `json:"phone,omitempty"`
	DateOfBirth   *time.Time             `json:"date_of_birth,omitempty"`
	Country       *string                `json:"country,omitempty"`
	City          *string                `json:"city,omitempty"`
	Timezone      *string                `json:"timezone,omitempty"`
	Language      *string                `json:"language,omitempty"`
	Bio           *string                `json:"bio,omitempty"`
	WalletAddress *string                `json:"wallet_address,omitempty"`
	Segments      []string               `json:"segments,omitempty"`
	Attributes    map[string]interface{} `json:"attributes,omitempty"`
}

CreateEndUserRequest creates a new end-user.

type CreateEventRequest

type CreateEventRequest struct {
	EventType string                 `json:"event_type"`
	UserID    string                 `json:"user_id"`
	Data      map[string]interface{} `json:"data"`
	Source    string                 `json:"event_source,omitempty"`
}

CreateEventRequest is the request for creating an event.

type CreatePassportRequest

type CreatePassportRequest struct {
	UserID         string                 `json:"user_id"`
	WalletAddress  *string                `json:"wallet_address,omitempty"`
	Level          int                    `json:"level,omitempty"`
	Points         int                    `json:"points,omitempty"`
	Experience     int                    `json:"experience,omitempty"`
	Traits         map[string]interface{} `json:"traits,omitempty"`
	CustomMetadata map[string]interface{} `json:"custom_metadata,omitempty"`
}

CreatePassportRequest is the request to create a new passport

type CreateQuestRequest

type CreateQuestRequest struct {
	Name                  string                   `json:"name"`
	Slug                  string                   `json:"slug,omitempty"`
	Description           *string                  `json:"description,omitempty"`
	ShortDescription      *string                  `json:"short_description,omitempty"`
	IconURL               *string                  `json:"icon_url,omitempty"`
	BannerURL             *string                  `json:"banner_url,omitempty"`
	Category              *string                  `json:"category,omitempty"`
	Difficulty            *string                  `json:"difficulty,omitempty"`
	EstimatedTime         *string                  `json:"estimated_time,omitempty"`
	IsOrdered             bool                     `json:"is_ordered,omitempty"`
	IsRepeatable          bool                     `json:"is_repeatable,omitempty"`
	RepeatCooldownHours   *int                     `json:"repeat_cooldown_hours,omitempty"`
	MaxCompletionsPerUser *int                     `json:"max_completions_per_user,omitempty"`
	StartsAt              *time.Time               `json:"starts_at,omitempty"`
	EndsAt                *time.Time               `json:"ends_at,omitempty"`
	TimeLimitHours        *int                     `json:"time_limit_hours,omitempty"`
	PrerequisiteQuestIDs  []string                 `json:"prerequisite_quest_ids,omitempty"`
	MaxParticipants       *int                     `json:"max_participants,omitempty"`
	MaxCompletions        *int                     `json:"max_completions,omitempty"`
	RewardDefinitionID    *string                  `json:"reward_definition_id,omitempty"`
	RewardPoints          *int                     `json:"reward_points,omitempty"`
	IsPublic              bool                     `json:"is_public,omitempty"`
	IsFeatured            bool                     `json:"is_featured,omitempty"`
	Tags                  []string                 `json:"tags,omitempty"`
	Steps                 []CreateQuestStepRequest `json:"steps"`
}

Request types

type CreateQuestStepRequest

type CreateQuestStepRequest struct {
	Name               string                 `json:"name"`
	Description        *string                `json:"description,omitempty"`
	Order              *int                   `json:"order,omitempty"`
	StepType           string                 `json:"step_type,omitempty"`
	EventType          *string                `json:"event_type,omitempty"`
	EventTypes         []string               `json:"event_types,omitempty"`
	Criteria           map[string]interface{} `json:"criteria,omitempty"`
	RequiredDataFields []string               `json:"required_data_fields,omitempty"`
	StepPoints         *int                   `json:"step_points,omitempty"`
	IconURL            *string                `json:"icon_url,omitempty"`
	IsOptional         bool                   `json:"is_optional,omitempty"`
}

type CreateRewardDefinitionRequest

type CreateRewardDefinitionRequest struct {
	Name                 string                 `json:"name"`
	Slug                 string                 `json:"slug"`
	Description          *string                `json:"description,omitempty"`
	CampaignID           *string                `json:"campaign_id,omitempty"`
	RewardType           string                 `json:"reward_type,omitempty"`
	Value                *float64               `json:"value,omitempty"`
	ValueCurrency        *string                `json:"value_currency,omitempty"`
	TokenContractAddress *string                `json:"token_contract_address,omitempty"`
	TokenSymbol          *string                `json:"token_symbol,omitempty"`
	TokenDecimals        int                    `json:"token_decimals,omitempty"`
	TokenChain           string                 `json:"token_chain,omitempty"`
	NFTMetadataTemplate  map[string]interface{} `json:"nft_metadata_template,omitempty"`
	NFTIsSoulbound       bool                   `json:"nft_is_soulbound,omitempty"`
	NFTValidityDays      *int                   `json:"nft_validity_days,omitempty"`
	NFTMintingStrategy   string                 `json:"nft_minting_strategy,omitempty"`
	NFTPreMintCount      *int                   `json:"nft_pre_mint_count,omitempty"`
	PassportThresholdID  *string                `json:"passport_threshold_id,omitempty"`
	TriggerType          string                 `json:"trigger_type,omitempty"`
	TriggerConfig        map[string]interface{} `json:"trigger_config,omitempty"`
	MaxPerUser           *int                   `json:"max_per_user,omitempty"`
	MaxTotal             *int                   `json:"max_total,omitempty"`
	IsActive             bool                   `json:"is_active,omitempty"`
	IconURL              *string                `json:"icon_url,omitempty"`
	BadgeColor           *string                `json:"badge_color,omitempty"`
	IsPublic             bool                   `json:"is_public,omitempty"`
}

Request types

type CreateSchemaRequest

type CreateSchemaRequest struct {
	YAMLContent string `json:"yaml_content"`
}

Request types

type CreateTemplateFieldRequest

type CreateTemplateFieldRequest struct {
	Name          string                 `json:"name"`
	FieldKey      string                 `json:"field_key"`
	Description   *string                `json:"description,omitempty"`
	DataType      string                 `json:"data_type,omitempty"`
	DefaultValue  interface{}            `json:"default_value,omitempty"`
	Formula       *string                `json:"formula,omitempty"`
	FormulaType   *string                `json:"formula_type,omitempty"`
	Aggregation   *string                `json:"aggregation,omitempty"`
	EventFilter   map[string]interface{} `json:"event_filter,omitempty"`
	DisplayFormat *string                `json:"display_format,omitempty"`
	Icon          *string                `json:"icon,omitempty"`
	Color         *string                `json:"color,omitempty"`
	SortOrder     int                    `json:"sort_order,omitempty"`
	IsVisible     bool                   `json:"is_visible,omitempty"`
	IsComputed    bool                   `json:"is_computed,omitempty"`
}

CreateTemplateFieldRequest is the request to create a template field

type CreateTemplateRequest

type CreateTemplateRequest struct {
	Name        string                       `json:"name"`
	Description *string                      `json:"description,omitempty"`
	Slug        string                       `json:"slug"`
	IconURL     *string                      `json:"icon_url,omitempty"`
	IsDefault   bool                         `json:"is_default,omitempty"`
	Fields      []CreateTemplateFieldRequest `json:"fields,omitempty"`
}

CreateTemplateRequest is the request to create a new template

type CreateTokenRequest

type CreateTokenRequest struct {
	ContractAddress    string  `json:"contract_address"`
	Network            string  `json:"network"`
	Symbol             string  `json:"symbol"`
	Name               string  `json:"name"`
	Decimals           *int    `json:"decimals,omitempty"`
	LogoURL            *string `json:"logo_url,omitempty"`
	Color              *string `json:"color,omitempty"`
	CoingeckoID        *string `json:"coingecko_id,omitempty"`
	CoinmarketcapID    *string `json:"coinmarketcap_id,omitempty"`
	CustomPriceFeedURL *string `json:"custom_price_feed_url,omitempty"`
	IsNativeWrapper    *bool   `json:"is_native_wrapper,omitempty"`
	DisplayOrder       *int    `json:"display_order,omitempty"`
}

CreateTokenRequest registers a custom token for the tenant

type CreateUserWalletRequest

type CreateUserWalletRequest struct {
	WalletType string `json:"wallet_type,omitempty"`
	Network    string `json:"network,omitempty"`
}

CreateUserWalletRequest creates a CDP wallet for an end-user.

type CreateWalletRequest

type CreateWalletRequest struct {
	UserID     string                 `json:"user_id"`
	WalletType string                 `json:"wallet_type,omitempty"`
	Network    string                 `json:"network,omitempty"`
	Name       *string                `json:"name,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

Request types

type CreateWebhookRequest

type CreateWebhookRequest struct {
	URL    string   `json:"url"`
	Events []string `json:"events"`
	Secret string   `json:"secret,omitempty"`
}

CreateWebhookRequest is the request for creating a webhook.

type DataViewComputation

type DataViewComputation struct {
	Type           string             `json:"type"`
	Name           *string            `json:"name,omitempty"`
	EventTypes     []string           `json:"event_types,omitempty"`
	TimeWindowDays *int               `json:"time_window_days,omitempty"`
	EventWeights   map[string]float64 `json:"event_weights,omitempty"`
	MaxScore       *float64           `json:"max_score,omitempty"`
	DecayRate      *float64           `json:"decay_rate,omitempty"`
	Field          *string            `json:"field,omitempty"`
	Operation      *string            `json:"operation,omitempty"`
	GroupBy        *string            `json:"group_by,omitempty"`
	Limit          *int               `json:"limit,omitempty"`
	Fields         []string           `json:"fields,omitempty"`
	Tiers          []TierDefinition   `json:"tiers,omitempty"`
	ScoreSource    *string            `json:"score_source,omitempty"`
}

DataViewComputation defines a computation within a data view.

type DataViewDetail

type DataViewDetail struct {
	ID               string      `json:"id"`
	Name             string      `json:"name"`
	DisplayName      string      `json:"display_name"`
	Description      string      `json:"description"`
	ViewType         string      `json:"view_type"`
	Computation      interface{} `json:"computation"` // single DataViewComputation or []DataViewComputation
	SourceCategories []string    `json:"source_categories"`
	IsPublic         bool        `json:"is_public"`
	CreatedAt        string      `json:"created_at"`
	UpdatedAt        string      `json:"updated_at"`
}

DataViewDetail contains full details of a data view.

type DataViewExecuteResult

type DataViewExecuteResult struct {
	ViewName       string                 `json:"view_name"`
	DisplayName    string                 `json:"display_name"`
	Identifier     string                 `json:"identifier"`
	IdentifierType string                 `json:"identifier_type"`
	Data           map[string]interface{} `json:"data"`
	ComputedAt     string                 `json:"computed_at"`
	TotalEvents    int                    `json:"total_events"`
}

DataViewExecuteResult is the result of executing a data view.

type DataViewListResponse

type DataViewListResponse struct {
	OwnViews     []DataViewSummary `json:"own_views"`
	PublicViews  []DataViewSummary `json:"public_views"`
	BuiltinViews []DataViewSummary `json:"builtin_views"`
}

DataViewListResponse contains categorised data views.

type DataViewPreviewRequest

type DataViewPreviewRequest struct {
	WalletAddress  string      `json:"wallet_address"`
	Computation    interface{} `json:"computation"` // single or []DataViewComputation
	TimeWindowDays *int        `json:"time_window_days,omitempty"`
	Limit          *int        `json:"limit,omitempty"`
}

DataViewPreviewRequest previews a computation without saving.

type DataViewPreviewResult

type DataViewPreviewResult struct {
	Preview         bool                   `json:"preview"`
	WalletAddress   string                 `json:"wallet_address"`
	ComputationType string                 `json:"computation_type"`
	Result          map[string]interface{} `json:"result"`
	EventsProcessed int                    `json:"events_processed"`
	TimeWindowDays  int                    `json:"time_window_days"`
}

DataViewPreviewResult is the result of previewing a computation.

type DataViewSummary

type DataViewSummary struct {
	Name             string   `json:"name"`
	DisplayName      *string  `json:"display_name,omitempty"`
	Description      string   `json:"description"`
	ViewType         *string  `json:"view_type,omitempty"`
	SourceCategories []string `json:"source_categories,omitempty"`
}

DataViewSummary represents a summary of a data view.

type DataViewsClient

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

DataViewsClient provides data view operations.

func NewDataViewsClient

func NewDataViewsClient(http *HTTPClient) *DataViewsClient

NewDataViewsClient creates a new data views client.

func (*DataViewsClient) Create

Create creates a new custom data view.

func (*DataViewsClient) Delete

func (d *DataViewsClient) Delete(ctx context.Context, viewName string) error

Delete deletes a data view.

func (*DataViewsClient) Execute

func (d *DataViewsClient) Execute(ctx context.Context, identifier, viewName string) (*DataViewExecuteResult, error)

Execute executes a data view for a specific identifier (user ID or wallet address).

func (*DataViewsClient) Get

func (d *DataViewsClient) Get(ctx context.Context, viewName string) (*DataViewDetail, error)

Get returns detailed information about a specific data view.

func (*DataViewsClient) GetActivitySummary

func (d *DataViewsClient) GetActivitySummary(ctx context.Context, walletAddress string, days int) (*ActivitySummaryView, error)

GetActivitySummary returns the builtin activity summary view for a wallet.

func (*DataViewsClient) GetEventMetadata

func (d *DataViewsClient) GetEventMetadata(ctx context.Context) (*EventMetadata, error)

GetEventMetadata returns available event types and their counts.

func (*DataViewsClient) GetFanProfile

func (d *DataViewsClient) GetFanProfile(ctx context.Context, walletAddress string) (*FanProfileView, error)

GetFanProfile returns the builtin fan profile view for a wallet.

func (*DataViewsClient) GetTemplates

func (d *DataViewsClient) GetTemplates(ctx context.Context) ([]ViewTemplate, error)

GetTemplates returns available view templates.

func (*DataViewsClient) List

List returns all available data views (own, public, builtin).

func (*DataViewsClient) Preview

Preview previews a computation without saving it.

func (*DataViewsClient) Update

func (d *DataViewsClient) Update(ctx context.Context, viewName string, req *UpdateDataViewRequest) (*DataViewDetail, error)

Update updates an existing data view.

type DocumentsResource

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

DocumentsResource handles document attestation operations.

func (*DocumentsResource) Attest

Attest attests a document file.

func (*DocumentsResource) AttestBytes

AttestBytes attests raw bytes content.

func (*DocumentsResource) Get

func (r *DocumentsResource) Get(ctx context.Context, ipfsHash string) (*Event, error)

Get retrieves a document by its IPFS hash.

type DualWallets

type DualWallets struct {
	UserID      string `json:"user_id"`
	AssetWallet Wallet `json:"asset_wallet"`
	SmartWallet Wallet `json:"smart_wallet"`
	Network     string `json:"network"`
}

DualWallets represents EOA + Smart Account pair

type EarnedReward

type EarnedReward struct {
	ID             string     `json:"id"`
	UserID         string     `json:"user_id"`
	UserExternalID string     `json:"user_external_id"`
	RewardName     string     `json:"reward_name"`
	RewardType     string     `json:"reward_type"`
	Status         string     `json:"status"`
	NFTTokenID     *int       `json:"nft_token_id,omitempty"`
	NFTTxHash      *string    `json:"nft_tx_hash,omitempty"`
	EarnedAt       time.Time  `json:"earned_at"`
	DistributedAt  *time.Time `json:"distributed_at,omitempty"`
}

EarnedReward represents a reward earned by a user

type EndUser

type EndUser struct {
	ID             string                 `json:"id"`
	ExternalID     string                 `json:"external_id"`
	Email          *string                `json:"email,omitempty"`
	FirstName      *string                `json:"first_name,omitempty"`
	LastName       *string                `json:"last_name,omitempty"`
	DisplayName    *string                `json:"display_name,omitempty"`
	AvatarURL      *string                `json:"avatar_url,omitempty"`
	Phone          *string                `json:"phone,omitempty"`
	DateOfBirth    *time.Time             `json:"date_of_birth,omitempty"`
	Country        *string                `json:"country,omitempty"`
	City           *string                `json:"city,omitempty"`
	Timezone       *string                `json:"timezone,omitempty"`
	Language       *string                `json:"language,omitempty"`
	Bio            *string                `json:"bio,omitempty"`
	WalletAddress  *string                `json:"wallet_address,omitempty"`
	WalletSource   *string                `json:"wallet_source,omitempty"`
	Status         string                 `json:"status"`
	TotalEvents    int                    `json:"total_events"`
	FirstEventAt   *time.Time             `json:"first_event_at,omitempty"`
	LastEventAt    *time.Time             `json:"last_event_at,omitempty"`
	EventTypes     []string               `json:"event_types"`
	Segments       []string               `json:"segments"`
	Tags           map[string]interface{} `json:"tags"`
	PointsBalance  int                    `json:"points_balance"`
	LifetimePoints int                    `json:"lifetime_points"`
	Attributes     map[string]interface{} `json:"attributes"`
	CreatedAt      time.Time              `json:"created_at"`
	DiscoveredAt   *time.Time             `json:"discovered_at,omitempty"`
}

EndUser represents an end-user discovered from events.

type EndUserListResponse

type EndUserListResponse struct {
	Users    []EndUser `json:"users"`
	Total    int       `json:"total"`
	Page     int       `json:"page"`
	PageSize int       `json:"page_size"`
	HasMore  bool      `json:"has_more"`
}

EndUserListResponse is a paginated list of users.

type EndUsersClient

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

EndUsersClient provides end-user operations.

func NewEndUsersClient

func NewEndUsersClient(http *HTTPClient) *EndUsersClient

NewEndUsersClient creates a new end-users client.

func (*EndUsersClient) AddPoints

func (u *EndUsersClient) AddPoints(ctx context.Context, externalID string, points int, reason string) (*PointsResult, error)

AddPoints adds or subtracts points from a user by external ID.

func (*EndUsersClient) Create

Create creates an end-user manually.

func (*EndUsersClient) CreateWallet

func (u *EndUsersClient) CreateWallet(ctx context.Context, externalID string, req *CreateUserWalletRequest) (*WalletCreationResult, error)

CreateWallet creates a CDP (custodial) wallet for an end-user by external ID.

func (*EndUsersClient) EnsureWallet

func (u *EndUsersClient) EnsureWallet(ctx context.Context, externalID string, network string) (*EnsureWalletResult, error)

EnsureWallet guarantees a user has dual wallets (EOA + Smart Account), creating them if they don't exist.

This is the recommended way to guarantee wallets exist before performing any wallet-dependent operation (e.g. attestation, on-chain claims, token transfers). If the user already has both wallet types, returns them immediately. If not, creates a dual wallet pair via the CDP SDK.

func (*EndUsersClient) GDPRDelete

func (u *EndUsersClient) GDPRDelete(ctx context.Context, userID string, req *GDPRDeletionRequest) (*GDPRDeletionResponse, error)

GDPRDelete permanently deletes all user data (Right to Be Forgotten).

func (*EndUsersClient) GDPRPreview

func (u *EndUsersClient) GDPRPreview(ctx context.Context, userID string) (*GDPRPreviewResponse, error)

GDPRPreview previews what would be deleted for a GDPR request.

func (*EndUsersClient) Get

func (u *EndUsersClient) Get(ctx context.Context, userID string) (*EndUser, error)

Get returns an end-user by internal UUID.

func (*EndUsersClient) GetActivity

func (u *EndUsersClient) GetActivity(ctx context.Context, externalID string, days int) (*UserActivityResponse, error)

GetActivity returns user activity summary by external ID.

func (*EndUsersClient) GetByExternalID

func (u *EndUsersClient) GetByExternalID(ctx context.Context, externalID string) (*EndUser, error)

GetByExternalID returns an end-user by external ID.

func (*EndUsersClient) GetRewards

func (u *EndUsersClient) GetRewards(ctx context.Context, externalID string, status string, page, pageSize int) (*UserRewardsResponse, error)

GetRewards returns rewards earned by a user by external ID.

func (*EndUsersClient) GetRewardsByInternalID

func (u *EndUsersClient) GetRewardsByInternalID(ctx context.Context, userID string, status string, page, pageSize int) (*UserRewardsResponse, error)

GetRewardsByInternalID returns rewards earned by a user by internal UUID.

func (*EndUsersClient) LinkWallet

func (u *EndUsersClient) LinkWallet(ctx context.Context, externalID string, req *LinkWalletRequest) (*EndUser, error)

LinkWallet links a wallet to an end-user by external ID.

func (*EndUsersClient) List

List returns paginated end-users.

func (*EndUsersClient) Merge

func (u *EndUsersClient) Merge(ctx context.Context, req *MergeUsersRequest) (*EndUser, error)

Merge merges source users into a target user.

func (*EndUsersClient) RegisterWallet

func (u *EndUsersClient) RegisterWallet(ctx context.Context, externalID string, req *RegisterWalletRequest) (*WalletCreationResult, error)

RegisterWallet registers an external wallet for an end-user by external ID.

func (*EndUsersClient) RemoveAttributes

func (u *EndUsersClient) RemoveAttributes(ctx context.Context, externalID string, keys []string) (*EndUser, error)

RemoveAttributes removes specific attribute keys from a user by external ID. Fetches the current user, removes the keys, and saves.

func (*EndUsersClient) SetProfile

func (u *EndUsersClient) SetProfile(ctx context.Context, externalID string, req *UpdateEndUserRequest) (*EndUser, error)

SetProfile sets profile fields on a user by external ID. Only the non-nil fields in the request are updated.

func (*EndUsersClient) Update

func (u *EndUsersClient) Update(ctx context.Context, userID string, req *UpdateEndUserRequest) (*EndUser, error)

Update updates an end-user profile by internal UUID.

func (*EndUsersClient) UpdateAttributes

func (u *EndUsersClient) UpdateAttributes(ctx context.Context, externalID string, attributes map[string]interface{}) (*EndUser, error)

UpdateAttributes merges the provided attributes into the user's existing attributes by external ID.

func (*EndUsersClient) UpdateByExternalID

func (u *EndUsersClient) UpdateByExternalID(ctx context.Context, externalID string, req *UpdateEndUserRequest) (*EndUser, error)

UpdateByExternalID updates an end-user profile by external ID.

type EnsureWalletResult

type EnsureWalletResult struct {
	UserID      string `json:"user_id"`
	AssetWallet Wallet `json:"asset_wallet"`
	SmartWallet Wallet `json:"smart_wallet"`
	Network     string `json:"network"`
	Created     bool   `json:"created"`
}

EnsureWalletResult is the response from EnsureWallet, containing both wallets and whether they were newly created.

type Event

type Event struct {
	ID              string                 `json:"id"`
	EventType       string                 `json:"event_type"`
	UserID          string                 `json:"user_id"`
	IPFSHash        string                 `json:"ipfs_hash"`
	DocumentHash    *string                `json:"document_hash,omitempty"`
	GatewayURL      string                 `json:"gateway_url"`
	CertificateID   string                 `json:"certificate_id"`
	Status          EventStatus            `json:"status"`
	AttestationMode AttestationMode        `json:"attestation_mode"`
	Timestamp       Timestamp              `json:"timestamp"`
	Data            map[string]interface{} `json:"data,omitempty"`
	BlockchainTx    *string                `json:"blockchain_tx,omitempty"`
	BatchID         *string                `json:"batch_id,omitempty"`
	ChannelID       *string                `json:"channel_id,omitempty"`
}

Event represents an attested event record.

type EventBatchProof

type EventBatchProof struct {
	EventID       string   `json:"event_id"`
	CertificateID string   `json:"certificate_id"`
	BatchID       string   `json:"batch_id"`
	LeafIndex     int      `json:"leaf_index"`
	MerkleProof   []string `json:"merkle_proof"`
	MerkleRoot    string   `json:"merkle_root"`
	BlockchainTx  *string  `json:"blockchain_tx,omitempty"`
	Verified      bool     `json:"verified"`
}

EventBatchProof contains the batch proof for an event.

type EventMetadata

type EventMetadata struct {
	EventTypes  []EventTypeInfo `json:"event_types"`
	TotalEvents int             `json:"total_events"`
	Categories  []string        `json:"categories"`
}

EventMetadata contains available event types and counts.

type EventStatus

type EventStatus string

EventStatus represents the status of an event.

const (
	EventStatusPending   EventStatus = "pending"
	EventStatusQueued    EventStatus = "queued"
	EventStatusConfirmed EventStatus = "confirmed"
	EventStatusSettled   EventStatus = "settled"
	EventStatusFailed    EventStatus = "failed"
)

type EventTypeInfo

type EventTypeInfo struct {
	EventType string `json:"event_type"`
	Count     int    `json:"count"`
	LastSeen  string `json:"last_seen"`
}

EventTypeInfo describes a single event type.

type EventsResource

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

EventsResource handles event operations.

func (*EventsResource) ByHash

func (r *EventsResource) ByHash(ctx context.Context, ipfsHash string) (*Event, error)

ByHash retrieves an event by its IPFS hash.

func (*EventsResource) Create

func (r *EventsResource) Create(ctx context.Context, req *CreateEventRequest) (*Event, error)

Create creates a new attestation event.

func (*EventsResource) Get

func (r *EventsResource) Get(ctx context.Context, eventID string) (*Event, error)

Get retrieves an event by ID.

func (*EventsResource) List

func (r *EventsResource) List(ctx context.Context, req *ListEventsRequest) ([]Event, error)

List lists events with optional filters.

func (*EventsResource) Search

func (r *EventsResource) Search(ctx context.Context, req *SearchRequest) (*SearchResult, error)

Search searches events by query.

type ExecuteSwapRequest

type ExecuteSwapRequest struct {
	WalletID    string `json:"wallet_id"`
	FromToken   string `json:"from_token"`
	ToToken     string `json:"to_token"`
	FromAmount  string `json:"from_amount"`
	Network     string `json:"network,omitempty"`
	SlippageBps int    `json:"slippage_bps,omitempty"`
}

type Facet

type Facet struct {
	Key   string `json:"key"`
	Count int    `json:"count"`
}

Facet is an aggregation bucket.

type FacetsResponse

type FacetsResponse struct {
	EventTypes   []Facet `json:"event_types"`
	EventSources []Facet `json:"event_sources"`
	Statuses     []Facet `json:"statuses"`
	Users        []Facet `json:"users"`
}

FacetsResponse contains faceted aggregations.

type FanProfileView

type FanProfileView struct {
	WalletAddress  string         `json:"wallet_address"`
	FanScore       float64        `json:"fan_score"`
	TotalEvents    int            `json:"total_events"`
	EventBreakdown map[string]int `json:"event_breakdown"`
	FirstSeen      string         `json:"first_seen"`
	LastSeen       string         `json:"last_seen"`
	LoyaltyTier    string         `json:"loyalty_tier"`
	ComputedAt     string         `json:"computed_at"`
}

FanProfileView is the builtin fan profile view result.

type FanpassGroupStats

type FanpassGroupStats struct {
	AvgFanScore       float64 `json:"avg_fan_score"`
	TopNAvgFanScore   float64 `json:"top_n_avg_fan_score"`
	GlobalCount       int     `json:"global_count"`
	GlobalAvgFanScore float64 `json:"global_avg_fan_score"`
}

FanpassGroupStats contains aggregate statistics for the fanpass group.

type FanpassLeaderboardClient

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

FanpassLeaderboardClient provides fanpass leaderboard operations.

func NewFanpassLeaderboardClient

func NewFanpassLeaderboardClient(http *HTTPClient) *FanpassLeaderboardClient

NewFanpassLeaderboardClient creates a new fanpass leaderboard client.

func (*FanpassLeaderboardClient) GetLeaderboard

GetLeaderboard returns the fanpass leaderboard with composite scores.

func (*FanpassLeaderboardClient) GetUserComparison

func (f *FanpassLeaderboardClient) GetUserComparison(ctx context.Context, userID string, filters map[string]string, country string) (*FanpassUserComparisonResponse, error)

GetUserComparison returns a user's comparison across all cohorts (spider chart data).

type FanpassLeaderboardEntry

type FanpassLeaderboardEntry struct {
	Rank            int                     `json:"rank"`
	UserID          string                  `json:"user_id"`
	FanScore        float64                 `json:"fan_score"`
	NormalizedScore float64                 `json:"normalized_score"`
	RawScore        float64                 `json:"raw_score"`
	Percentile      float64                 `json:"percentile"`
	ComputedAt      *string                 `json:"computed_at,omitempty"`
	User            *LeaderboardUserProfile `json:"user,omitempty"`
}

FanpassLeaderboardEntry is a single entry in the fanpass leaderboard.

type FanpassLeaderboardOptions

type FanpassLeaderboardOptions struct {
	AggregationRuleID string
	Filters           map[string]string
	Country           string
	Limit             int
	TopN              int
	Fresh             bool
	UserID            string
}

FanpassLeaderboardOptions configures the GetLeaderboard query.

type FanpassLeaderboardResponse

type FanpassLeaderboardResponse struct {
	AggregationRuleID        *string                   `json:"aggregation_rule_id,omitempty"`
	AggregationRuleName      *string                   `json:"aggregation_rule_name,omitempty"`
	Filter                   map[string]interface{}    `json:"filter"`
	TotalUsers               int                       `json:"total_users"`
	GroupStats               FanpassGroupStats         `json:"group_stats"`
	Leaderboard              []FanpassLeaderboardEntry `json:"leaderboard"`
	CurrentUser              *FanpassLeaderboardEntry  `json:"current_user,omitempty"`
	CurrentUserInLeaderboard bool                      `json:"current_user_in_leaderboard"`
}

FanpassLeaderboardResponse is the full fanpass leaderboard response.

type FanpassUserComparisonResponse

type FanpassUserComparisonResponse struct {
	UserID  string                     `json:"user_id"`
	Filter  map[string]interface{}     `json:"filter"`
	Cohorts []UserCohortBreakdownEntry `json:"cohorts"`
}

FanpassUserComparisonResponse contains a user's comparison across all cohorts.

type FieldValue

type FieldValue struct {
	FieldKey    string      `json:"field_key"`
	FieldName   string      `json:"field_name"`
	Value       interface{} `json:"value"`
	DataType    string      `json:"data_type"`
	ComputedAt  *time.Time  `json:"computed_at,omitempty"`
	ManuallySet bool        `json:"manually_set"`
}

FieldValue represents a computed or manual field value on a passport

type GDPRDeletionRequest

type GDPRDeletionRequest struct {
	Confirm       bool    `json:"confirm"`
	DeleteEvents  *bool   `json:"delete_events,omitempty"`
	DeleteWallets *bool   `json:"delete_wallets,omitempty"`
	Reason        *string `json:"reason,omitempty"`
}

GDPRDeletionRequest requests permanent deletion of user data.

type GDPRDeletionResponse

type GDPRDeletionResponse struct {
	Success        bool           `json:"success"`
	UserID         string         `json:"user_id"`
	ExternalID     string         `json:"external_id"`
	DeletedRecords map[string]int `json:"deleted_records"`
	MerkleWarning  *string        `json:"merkle_warning,omitempty"`
	AuditID        *string        `json:"audit_id,omitempty"`
}

GDPRDeletionResponse is the response from a GDPR deletion.

type GDPRPreviewResponse

type GDPRPreviewResponse struct {
	User          map[string]interface{} `json:"user"`
	WouldDelete   map[string]int         `json:"would_delete"`
	MerkleWarning *string                `json:"merkle_warning,omitempty"`
}

GDPRPreviewResponse is the response from a GDPR deletion preview.

type GRPCClient

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

GRPCClient provides high-performance gRPC streaming for event ingestion. Supports single-stream and multi-stream modes for maximum throughput.

Multi-stream mode creates multiple parallel connections to distribute load across server pods, achieving 5-10x higher throughput than single-stream.

func NewGRPCClient

func NewGRPCClient(apiKey string, opts ...GRPCClientOption) *GRPCClient

NewGRPCClient creates a new gRPC streaming client.

Example:

client := proofchain.NewGRPCClient("your-api-key")
defer client.Close()

stats, err := client.StreamEvents(ctx, events)

func (*GRPCClient) Close

func (c *GRPCClient) Close() error

Close closes all gRPC connections.

func (*GRPCClient) Connect

func (c *GRPCClient) Connect(ctx context.Context) error

Connect establishes gRPC connections. Call this before streaming. For multi-stream mode, this creates multiple connections.

func (*GRPCClient) StreamEvents

func (c *GRPCClient) StreamEvents(ctx context.Context, events <-chan *GRPCEvent) (*StreamStats, error)

StreamEvents streams events using bidirectional gRPC streaming. In multi-stream mode, events are distributed across parallel streams.

Example:

events := make(chan *proofchain.GRPCEvent, 1000)
go func() {
    for i := 0; i < 10000; i++ {
        events <- &proofchain.GRPCEvent{
            UserID:    fmt.Sprintf("user-%d", i),
            EventType: "action",
            Data:      map[string]interface{}{"index": i},
        }
    }
    close(events)
}()

stats, err := client.StreamEvents(ctx, events)

func (*GRPCClient) StreamEventsSlice

func (c *GRPCClient) StreamEventsSlice(ctx context.Context, events []*GRPCEvent) (*StreamStats, error)

StreamEventsSlice is a convenience method that streams a slice of events.

type GRPCClientOption

type GRPCClientOption func(*GRPCClient)

GRPCClientOption configures the gRPC client.

func WithGRPCEndpoint

func WithGRPCEndpoint(endpoint string) GRPCClientOption

WithGRPCEndpoint sets a custom gRPC endpoint.

func WithGRPCTimeout

func WithGRPCTimeout(timeout time.Duration) GRPCClientOption

WithGRPCTimeout sets the connection timeout.

func WithNumStreams

func WithNumStreams(n int) GRPCClientOption

WithNumStreams sets the number of parallel streams for multi-stream mode.

func WithTLS

func WithTLS(enabled bool) GRPCClientOption

WithTLS enables or disables TLS (enabled by default for port 443).

type GRPCEvent

type GRPCEvent struct {
	UserID       string                 `json:"user_id"`
	EventType    string                 `json:"event_type"`
	DocumentHash string                 `json:"document_hash,omitempty"`
	Data         map[string]interface{} `json:"data,omitempty"`
	Timestamp    *time.Time             `json:"timestamp,omitempty"`
}

GRPCEvent represents an event to be sent via gRPC streaming.

type GRPCResponse

type GRPCResponse struct {
	EventID       string `json:"event_id"`
	CertificateID string `json:"certificate_id"`
	Status        string `json:"status"`
	Error         string `json:"error,omitempty"`
}

GRPCResponse represents a response from the gRPC stream.

type GetInfoOptions

type GetInfoOptions struct {
	IncludeBalances bool
	IncludeNFTs     bool
	IncludeActivity bool
}

GetInfoOptions controls what data is included in GetInfo

type HTTPClient

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

HTTPClient handles HTTP requests to the ProofChain API.

func NewHTTPClient

func NewHTTPClient(apiKey string, opts ...HTTPClientOption) *HTTPClient

NewHTTPClient creates a new HTTP client.

func NewHTTPClientFromEnv

func NewHTTPClientFromEnv(opts ...HTTPClientOption) (*HTTPClient, error)

NewHTTPClientFromEnv creates a client using the PROOFCHAIN_API_KEY environment variable.

func (*HTTPClient) Delete

func (c *HTTPClient) Delete(ctx context.Context, path string) error

Delete makes a DELETE request.

func (*HTTPClient) Get

func (c *HTTPClient) Get(ctx context.Context, path string, params url.Values, result interface{}) error

Get makes a GET request.

func (*HTTPClient) GetRaw

func (c *HTTPClient) GetRaw(ctx context.Context, path string) ([]byte, error)

GetRaw makes a GET request and returns raw bytes (for file downloads).

func (*HTTPClient) Patch

func (c *HTTPClient) Patch(ctx context.Context, path string, body interface{}, result interface{}) error

Patch makes a PATCH request.

func (*HTTPClient) Post

func (c *HTTPClient) Post(ctx context.Context, path string, body interface{}, result interface{}) error

Post makes a POST request.

func (*HTTPClient) Put

func (c *HTTPClient) Put(ctx context.Context, path string, body interface{}, result interface{}) error

Put makes a PUT request.

func (*HTTPClient) Request

func (c *HTTPClient) Request(ctx context.Context, method, path string, body interface{}, result interface{}) error

Request makes an HTTP request to the API.

func (*HTTPClient) RequestMultipart

func (c *HTTPClient) RequestMultipart(ctx context.Context, path string, fields map[string]string, fileField, filename string, fileContent []byte, result interface{}) error

RequestMultipart makes a multipart form request.

func (*HTTPClient) RequestWithParams

func (c *HTTPClient) RequestWithParams(ctx context.Context, method, path string, params url.Values, result interface{}) error

RequestWithParams makes an HTTP request with query parameters.

type HTTPClientOption

type HTTPClientOption func(*HTTPClient)

HTTPClientOption is a function that configures the HTTP client.

func WithBaseURL

func WithBaseURL(baseURL string) HTTPClientOption

WithBaseURL sets a custom base URL.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) HTTPClientOption

WithHTTPClient sets a custom HTTP client.

func WithRetries

func WithRetries(maxRetries int) HTTPClientOption

WithRetries sets the maximum number of retries.

func WithTimeout

func WithTimeout(timeout time.Duration) HTTPClientOption

WithTimeout sets a custom timeout.

type IngestEventRequest

type IngestEventRequest struct {
	UserID      string                 `json:"user_id"`
	EventType   string                 `json:"event_type"`
	Data        map[string]interface{} `json:"data,omitempty"`
	EventSource string                 `json:"event_source,omitempty"`
	Timestamp   string                 `json:"timestamp,omitempty"` // ISO8601/RFC3339 format
	SchemaIDs   []string               `json:"-"`                   // Sent via header
}

IngestEventRequest is the request for ingesting a single event.

type IngestEventResponse

type IngestEventResponse struct {
	EventID               string `json:"event_id"`
	CertificateID         string `json:"certificate_id"`
	Status                string `json:"status"`
	QueuePosition         int    `json:"queue_position,omitempty"`
	EstimatedConfirmation string `json:"estimated_confirmation,omitempty"`
}

IngestEventResponse is the response from ingesting an event.

type IngestionClient

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

IngestionClient is a high-performance client for the Rust ingestion API. Use this for maximum throughput when ingesting events.

func NewIngestionClient

func NewIngestionClient(apiKey string, opts ...IngestionClientOption) *IngestionClient

NewIngestionClient creates a new high-performance ingestion client.

Example:

client := proofchain.NewIngestionClient("your-api-key")
result, err := client.Ingest(ctx, &proofchain.IngestEventRequest{
    UserID:    "user-123",
    EventType: "purchase",
    Data:      map[string]interface{}{"amount": 99.99},
})

func (*IngestionClient) GetEventStatus

func (c *IngestionClient) GetEventStatus(ctx context.Context, eventID string) (string, error)

GetEventStatus retrieves the status of an event by ID.

func (*IngestionClient) Ingest

Ingest sends a single event to the high-performance Rust ingestion API. Events are attested immediately upon ingestion.

func (*IngestionClient) IngestBatch

IngestBatch sends multiple events in a single request (up to 1000 events). More efficient than individual calls for bulk data.

type IngestionClientOption

type IngestionClientOption func(*IngestionClient)

IngestionClientOption is a function that configures the ingestion client.

func WithIngestTimeout

func WithIngestTimeout(timeout time.Duration) IngestionClientOption

WithIngestTimeout sets a custom timeout for ingestion requests.

func WithIngestURL

func WithIngestURL(url string) IngestionClientOption

WithIngestURL sets a custom ingestion URL.

type IssueCertificateRequest

type IssueCertificateRequest struct {
	RecipientName  string                 `json:"recipient_name"`
	RecipientEmail string                 `json:"recipient_email,omitempty"`
	Title          string                 `json:"title"`
	Description    string                 `json:"description,omitempty"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
	ExpiresAt      *time.Time             `json:"expires_at,omitempty"`
}

IssueCertificateRequest is the request for issuing a certificate.

type LeaderboardUserProfile

type LeaderboardUserProfile struct {
	ExternalID  string                 `json:"external_id"`
	DisplayName *string                `json:"display_name,omitempty"`
	FirstName   *string                `json:"first_name,omitempty"`
	LastName    *string                `json:"last_name,omitempty"`
	Email       *string                `json:"email,omitempty"`
	AvatarURL   *string                `json:"avatar_url,omitempty"`
	Country     *string                `json:"country,omitempty"`
	City        *string                `json:"city,omitempty"`
	Attributes  map[string]interface{} `json:"attributes"`
}

LeaderboardUserProfile contains user profile data in leaderboard entries.

type LinkWalletRequest

type LinkWalletRequest struct {
	WalletAddress string  `json:"wallet_address"`
	WalletSource  *string `json:"wallet_source,omitempty"`
	Signature     *string `json:"signature,omitempty"`
}

LinkWalletRequest links an external wallet to a user.

type ListCertificatesRequest

type ListCertificatesRequest struct {
	RecipientEmail string `json:"recipient_email,omitempty"`
	Limit          int    `json:"limit,omitempty"`
	Offset         int    `json:"offset,omitempty"`
}

ListCertificatesRequest is the request for listing certificates.

type ListCohortsOptions

type ListCohortsOptions struct {
	Status string // "active", "inactive", "draft"
	Limit  int
	Offset int
}

ListCohortsOptions configures the List query.

type ListEndUsersOptions

type ListEndUsersOptions struct {
	Page      int
	PageSize  int
	Search    string
	Status    string
	Segment   string
	HasWallet *bool
	MinEvents *int
	SortBy    string
	SortOrder string
}

ListEndUsersOptions configures the List query.

type ListEventsRequest

type ListEventsRequest struct {
	UserID    string `json:"user_id,omitempty"`
	EventType string `json:"event_type,omitempty"`
	Status    string `json:"status,omitempty"`
	StartDate string `json:"start_date,omitempty"`
	EndDate   string `json:"end_date,omitempty"`
	Limit     int    `json:"limit,omitempty"`
	Offset    int    `json:"offset,omitempty"`
}

ListEventsRequest is the request for listing events.

type ListQuestsOptions

type ListQuestsOptions struct {
	Status     string
	Category   string
	IsPublic   *bool
	IsFeatured *bool
	Limit      int
	Offset     int
}

type ListRewardsOptions

type ListRewardsOptions struct {
	IsActive   *bool
	RewardType string
	Limit      int
	Offset     int
}

type ListSchemasOptions

type ListSchemasOptions struct {
	Status string
	Search string
	Limit  int
	Offset int
}

type ListTokensOptions

type ListTokensOptions struct {
	Network       string
	IncludeGlobal *bool
	IncludeHidden *bool
}

ListTokensOptions configures the ListTokens query

type ManualRewardRequest

type ManualRewardRequest struct {
	DefinitionID          string                 `json:"definition_id"`
	UserIDs               []string               `json:"user_ids"`
	TriggerData           map[string]interface{} `json:"trigger_data,omitempty"`
	DistributeImmediately bool                   `json:"distribute_immediately,omitempty"`
}

type MergeUsersRequest

type MergeUsersRequest struct {
	SourceUserIDs []string `json:"source_user_ids"`
	TargetUserID  string   `json:"target_user_id"`
}

MergeUsersRequest merges source users into a target user.

type MultiStreamClient

type MultiStreamClient struct {
	*GRPCClient
	// contains filtered or unexported fields
}

MultiStreamClient provides a higher-level API for multi-stream ingestion. It automatically manages connections and provides simple Send/Flush methods.

func NewMultiStreamClient

func NewMultiStreamClient(apiKey string, opts ...GRPCClientOption) (*MultiStreamClient, error)

NewMultiStreamClient creates a client optimized for high-throughput streaming.

Example:

client, err := proofchain.NewMultiStreamClient("your-api-key",
    proofchain.WithNumStreams(8),
)
if err != nil {
    log.Fatal(err)
}
defer client.Close()

// Send events
for i := 0; i < 100000; i++ {
    client.Send(&proofchain.GRPCEvent{
        UserID:    fmt.Sprintf("user-%d", i%1000),
        EventType: "action",
        Data:      map[string]interface{}{"index": i},
    })
}

// Wait for completion and get stats
stats, err := client.Flush()
fmt.Printf("Sent %d events at %.2f events/sec\n", stats.TotalSent, stats.EventsPerSec)

func (*MultiStreamClient) Close

func (c *MultiStreamClient) Close() error

Close closes the client and all connections.

func (*MultiStreamClient) Flush

func (c *MultiStreamClient) Flush() (*StreamStats, error)

Flush closes the event channel and waits for all events to be sent. Returns the final statistics including any dropped events from TrySend.

func (*MultiStreamClient) Send

func (c *MultiStreamClient) Send(event *GRPCEvent) bool

Send queues an event for streaming, blocking if the buffer is full. This ensures no events are silently dropped. Automatically starts the streaming session on first call if not already started.

func (*MultiStreamClient) SendBlocking

func (c *MultiStreamClient) SendBlocking(event *GRPCEvent)

SendBlocking is an alias for Send (which now blocks by default). Deprecated: Use Send() instead.

func (*MultiStreamClient) Start

func (c *MultiStreamClient) Start(ctx context.Context)

Start begins the streaming session. Must be called before Send.

func (*MultiStreamClient) TrySend

func (c *MultiStreamClient) TrySend(event *GRPCEvent) bool

TrySend attempts to queue an event without blocking. Returns false if the client is not started or buffer is full. Use Send() instead unless you need non-blocking behavior and handle drops.

type NFT

type NFT struct {
	ID              string                 `json:"id"`
	WalletID        string                 `json:"wallet_id"`
	ContractAddress string                 `json:"contract_address"`
	TokenID         string                 `json:"token_id"`
	Network         string                 `json:"network"`
	Name            *string                `json:"name,omitempty"`
	Description     *string                `json:"description,omitempty"`
	ImageURL        *string                `json:"image_url,omitempty"`
	Metadata        map[string]interface{} `json:"metadata,omitempty"`
	Source          string                 `json:"source"`
	AcquiredAt      string                 `json:"acquired_at"`
}

NFT represents an NFT in a wallet

type NetworkError

type NetworkError struct {
	APIError
	Cause error
}

NetworkError is returned when a network error occurs.

func NewNetworkError

func NewNetworkError(cause error) *NetworkError

NewNetworkError creates a new NetworkError.

func (*NetworkError) Unwrap

func (e *NetworkError) Unwrap() error

Unwrap returns the underlying error.

type NotFoundError

type NotFoundError struct {
	APIError
}

NotFoundError is returned when a resource is not found (404).

func NewNotFoundError

func NewNotFoundError(message string) *NotFoundError

NewNotFoundError creates a new NotFoundError.

type Passport

type Passport struct {
	ID             string                 `json:"id"`
	TenantID       string                 `json:"tenant_id"`
	UserID         string                 `json:"user_id"`
	WalletAddress  *string                `json:"wallet_address,omitempty"`
	Level          int                    `json:"level"`
	Points         int                    `json:"points"`
	Experience     int                    `json:"experience"`
	Traits         map[string]interface{} `json:"traits"`
	CustomMetadata map[string]interface{} `json:"custom_metadata"`
	OnChainTokenID *string                `json:"on_chain_token_id,omitempty"`
	OnChainTxHash  *string                `json:"on_chain_tx_hash,omitempty"`
	CreatedAt      time.Time              `json:"created_at"`
	LastUpdatedAt  time.Time              `json:"last_updated_at"`
}

Passport represents a user's passport with points, level, and traits

type PassportClient

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

PassportClient provides access to passport operations

func NewPassportClient

func NewPassportClient(http *HTTPClient) *PassportClient

NewPassportClient creates a new passport client

func (*PassportClient) AddPoints

func (p *PassportClient) AddPoints(ctx context.Context, userID string, points int, reason string) (*Passport, error)

AddPoints adds points to a passport

func (*PassportClient) AddTemplateField

func (p *PassportClient) AddTemplateField(ctx context.Context, templateID string, req *CreateTemplateFieldRequest) (*TemplateField, error)

AddTemplateField adds a field to a template

func (*PassportClient) AssignTemplate

func (p *PassportClient) AssignTemplate(ctx context.Context, userID string, templateID string) error

AssignTemplate assigns a template to a passport

func (*PassportClient) AwardBadge

func (p *PassportClient) AwardBadge(ctx context.Context, userID string, badgeID string, metadata map[string]interface{}) (*UserBadge, error)

AwardBadge awards a badge to a user

func (*PassportClient) Create

Create creates a new passport

func (*PassportClient) CreateAchievement

func (p *PassportClient) CreateAchievement(ctx context.Context, req *CreateAchievementRequest) (*Achievement, error)

CreateAchievement creates a new achievement

func (*PassportClient) CreateBadge

func (p *PassportClient) CreateBadge(ctx context.Context, req *CreateBadgeRequest) (*Badge, error)

CreateBadge creates a new badge

func (*PassportClient) CreateTemplate

func (p *PassportClient) CreateTemplate(ctx context.Context, req *CreateTemplateRequest) (*PassportTemplate, error)

CreateTemplate creates a new template

func (*PassportClient) Delete

func (p *PassportClient) Delete(ctx context.Context, userID string) error

Delete deletes a passport

func (*PassportClient) DeleteTemplate

func (p *PassportClient) DeleteTemplate(ctx context.Context, templateID string) error

DeleteTemplate deletes a template

func (*PassportClient) Get

func (p *PassportClient) Get(ctx context.Context, userID string) (*Passport, error)

Get returns a passport by user ID

func (*PassportClient) GetFieldValues

func (p *PassportClient) GetFieldValues(ctx context.Context, userID string) ([]FieldValue, error)

GetFieldValues returns all field values for a passport

func (*PassportClient) GetHistory

func (p *PassportClient) GetHistory(ctx context.Context, userID string, opts *PassportListOptions) ([]PassportHistory, error)

GetHistory returns passport history/activity log

func (*PassportClient) GetTemplate

func (p *PassportClient) GetTemplate(ctx context.Context, templateID string) (*PassportTemplate, error)

GetTemplate returns a template by ID

func (*PassportClient) GetUserAchievements

func (p *PassportClient) GetUserAchievements(ctx context.Context, userID string) ([]UserAchievement, error)

GetUserAchievements returns achievements for a user

func (*PassportClient) GetUserBadges

func (p *PassportClient) GetUserBadges(ctx context.Context, userID string) ([]UserBadge, error)

GetUserBadges returns badges earned by a user

func (*PassportClient) GetWithFields

func (p *PassportClient) GetWithFields(ctx context.Context, userID string) (*PassportWithFields, error)

GetWithFields returns a passport with all field values

func (*PassportClient) LevelUp

func (p *PassportClient) LevelUp(ctx context.Context, userID string) (*Passport, error)

LevelUp levels up a passport

func (*PassportClient) LinkWallet

func (p *PassportClient) LinkWallet(ctx context.Context, userID string, walletAddress string) (*Passport, error)

LinkWallet links a wallet address to a passport

func (*PassportClient) List

List returns all passports for the tenant

func (*PassportClient) ListAchievements

func (p *PassportClient) ListAchievements(ctx context.Context) ([]Achievement, error)

ListAchievements returns all achievements

func (*PassportClient) ListBadges

func (p *PassportClient) ListBadges(ctx context.Context) ([]Badge, error)

ListBadges returns all badges

func (*PassportClient) ListTemplates

func (p *PassportClient) ListTemplates(ctx context.Context) ([]PassportTemplate, error)

ListTemplates returns all passport templates

func (*PassportClient) RecomputeFields

func (p *PassportClient) RecomputeFields(ctx context.Context, userID string) (map[string]interface{}, error)

RecomputeFields recomputes all computed field values

func (*PassportClient) SetFieldValue

func (p *PassportClient) SetFieldValue(ctx context.Context, userID string, fieldKey string, value interface{}) error

SetFieldValue sets a field value manually

func (*PassportClient) Update

func (p *PassportClient) Update(ctx context.Context, userID string, req *UpdatePassportRequest) (*Passport, error)

Update updates a passport

func (*PassportClient) UpdateAchievementProgress

func (p *PassportClient) UpdateAchievementProgress(ctx context.Context, userID string, achievementID string, progress float64) (*UserAchievement, error)

UpdateAchievementProgress updates achievement progress

type PassportHistory

type PassportHistory struct {
	ID           string      `json:"id"`
	PassportID   string      `json:"passport_id"`
	EventType    string      `json:"event_type"`
	OldValue     interface{} `json:"old_value,omitempty"`
	NewValue     interface{} `json:"new_value,omitempty"`
	ChangeReason *string     `json:"change_reason,omitempty"`
	CreatedAt    time.Time   `json:"created_at"`
}

PassportHistory represents a history entry for a passport

type PassportListOptions

type PassportListOptions struct {
	Limit  int `json:"limit,omitempty"`
	Offset int `json:"offset,omitempty"`
}

ListOptions for pagination

type PassportTemplate

type PassportTemplate struct {
	ID          string          `json:"id"`
	TenantID    string          `json:"tenant_id"`
	Name        string          `json:"name"`
	Description *string         `json:"description,omitempty"`
	Slug        string          `json:"slug"`
	IconURL     *string         `json:"icon_url,omitempty"`
	IsDefault   bool            `json:"is_default"`
	IsActive    bool            `json:"is_active"`
	CreatedAt   time.Time       `json:"created_at"`
	UpdatedAt   time.Time       `json:"updated_at"`
	Fields      []TemplateField `json:"fields"`
}

PassportTemplate defines the structure of a passport

type PassportWithFields

type PassportWithFields struct {
	Passport
	TemplateID   *string      `json:"template_id,omitempty"`
	TemplateName *string      `json:"template_name,omitempty"`
	FieldValues  []FieldValue `json:"field_values"`
}

PassportWithFields includes field values

type PointsResult

type PointsResult struct {
	UserID         string `json:"user_id"`
	PointsAdded    int    `json:"points_added"`
	NewBalance     int    `json:"new_balance"`
	LifetimePoints int    `json:"lifetime_points"`
	Reason         string `json:"reason"`
}

PointsResult is the response from adding/subtracting points.

type ProofVerifyRequest

type ProofVerifyRequest struct {
	Leaf  string   `json:"leaf"`
	Proof []string `json:"proof"`
	Root  string   `json:"root"`
}

ProofVerifyRequest contains parameters for verifying a Merkle proof.

type ProofVerifyResult

type ProofVerifyResult struct {
	Valid      bool   `json:"valid"`
	Message    string `json:"message"`
	VerifiedAt string `json:"verified_at"`
}

ProofVerifyResult is the result of verifying a Merkle proof.

type Quest

type Quest struct {
	ID                    string      `json:"id"`
	Name                  string      `json:"name"`
	Slug                  string      `json:"slug"`
	Description           *string     `json:"description,omitempty"`
	ShortDescription      *string     `json:"short_description,omitempty"`
	IconURL               *string     `json:"icon_url,omitempty"`
	BannerURL             *string     `json:"banner_url,omitempty"`
	Category              *string     `json:"category,omitempty"`
	Difficulty            *string     `json:"difficulty,omitempty"`
	EstimatedTime         *string     `json:"estimated_time,omitempty"`
	IsOrdered             bool        `json:"is_ordered"`
	IsRepeatable          bool        `json:"is_repeatable"`
	RepeatCooldownHours   *int        `json:"repeat_cooldown_hours,omitempty"`
	MaxCompletionsPerUser *int        `json:"max_completions_per_user,omitempty"`
	StartsAt              *time.Time  `json:"starts_at,omitempty"`
	EndsAt                *time.Time  `json:"ends_at,omitempty"`
	TimeLimitHours        *int        `json:"time_limit_hours,omitempty"`
	PrerequisiteQuestIDs  []string    `json:"prerequisite_quest_ids"`
	MaxParticipants       *int        `json:"max_participants,omitempty"`
	MaxCompletions        *int        `json:"max_completions,omitempty"`
	RewardDefinitionID    *string     `json:"reward_definition_id,omitempty"`
	RewardPoints          *int        `json:"reward_points,omitempty"`
	IsPublic              bool        `json:"is_public"`
	IsFeatured            bool        `json:"is_featured"`
	Tags                  []string    `json:"tags"`
	Status                string      `json:"status"`
	Steps                 []QuestStep `json:"steps"`
	TotalParticipants     int         `json:"total_participants"`
	TotalCompletions      int         `json:"total_completions"`
	CreatedAt             time.Time   `json:"created_at"`
	UpdatedAt             time.Time   `json:"updated_at"`
}

Quest represents a quest definition

type QuestStep

type QuestStep struct {
	ID                 string                 `json:"id"`
	QuestID            string                 `json:"quest_id"`
	Name               string                 `json:"name"`
	Description        *string                `json:"description,omitempty"`
	Order              int                    `json:"order"`
	StepType           string                 `json:"step_type"`
	EventType          *string                `json:"event_type,omitempty"`
	EventTypes         []string               `json:"event_types,omitempty"`
	Criteria           map[string]interface{} `json:"criteria,omitempty"`
	RequiredDataFields []string               `json:"required_data_fields,omitempty"`
	StepPoints         *int                   `json:"step_points,omitempty"`
	IconURL            *string                `json:"icon_url,omitempty"`
	IsOptional         bool                   `json:"is_optional"`
}

QuestStep represents a step in a quest

type QuestWithProgress

type QuestWithProgress struct {
	Quest
	UserProgress *UserQuestProgress `json:"user_progress,omitempty"`
}

QuestWithProgress includes user progress

type QuestsClient

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

QuestsClient provides quest operations

func NewQuestsClient

func NewQuestsClient(http *HTTPClient) *QuestsClient

NewQuestsClient creates a new quests client

func (*QuestsClient) Activate

func (q *QuestsClient) Activate(ctx context.Context, questID string) (*Quest, error)

Activate activates a quest

func (*QuestsClient) AddStep

func (q *QuestsClient) AddStep(ctx context.Context, questID string, step *CreateQuestStepRequest) (*QuestStep, error)

AddStep adds a step to a quest

func (*QuestsClient) Archive

func (q *QuestsClient) Archive(ctx context.Context, questID string) (*Quest, error)

Archive archives a quest

func (*QuestsClient) CompleteStep

func (q *QuestsClient) CompleteStep(ctx context.Context, questID, userID, stepID string) (*UserQuestProgress, error)

CompleteStep completes a step manually

func (*QuestsClient) Create

func (q *QuestsClient) Create(ctx context.Context, req *CreateQuestRequest) (*Quest, error)

Create creates a quest

func (*QuestsClient) Delete

func (q *QuestsClient) Delete(ctx context.Context, questID string) error

Delete deletes a quest

func (*QuestsClient) DeleteStep

func (q *QuestsClient) DeleteStep(ctx context.Context, questID, stepID string) error

DeleteStep deletes a step

func (*QuestsClient) Get

func (q *QuestsClient) Get(ctx context.Context, questID string) (*Quest, error)

Get returns a quest by ID

func (*QuestsClient) GetAllUserProgress

func (q *QuestsClient) GetAllUserProgress(ctx context.Context, userID string) ([]UserQuestProgress, error)

GetAllUserProgress returns all quest progress for a user

func (*QuestsClient) GetBySlug

func (q *QuestsClient) GetBySlug(ctx context.Context, slug string) (*Quest, error)

GetBySlug returns a quest by slug

func (*QuestsClient) GetUserProgress

func (q *QuestsClient) GetUserProgress(ctx context.Context, questID, userID string) (*UserQuestProgress, error)

GetUserProgress returns user's progress on a quest

func (*QuestsClient) GetWithProgress

func (q *QuestsClient) GetWithProgress(ctx context.Context, questID, userID string) (*QuestWithProgress, error)

GetWithProgress returns quest with user progress

func (*QuestsClient) List

func (q *QuestsClient) List(ctx context.Context, opts *ListQuestsOptions) ([]Quest, error)

List returns quests

func (*QuestsClient) ListWithProgress

func (q *QuestsClient) ListWithProgress(ctx context.Context, userID string, opts *ListQuestsOptions) ([]QuestWithProgress, error)

ListWithProgress returns quests with progress for a user

func (*QuestsClient) Pause

func (q *QuestsClient) Pause(ctx context.Context, questID string) (*Quest, error)

Pause pauses a quest

func (*QuestsClient) ReorderSteps

func (q *QuestsClient) ReorderSteps(ctx context.Context, questID string, stepIDs []string) (*Quest, error)

ReorderSteps reorders steps

func (*QuestsClient) StartQuest

func (q *QuestsClient) StartQuest(ctx context.Context, questID, userID string) (*UserQuestProgress, error)

StartQuest starts a quest for a user

func (*QuestsClient) Update

func (q *QuestsClient) Update(ctx context.Context, questID string, req *CreateQuestRequest) (*Quest, error)

Update updates a quest

func (*QuestsClient) UpdateStep

func (q *QuestsClient) UpdateStep(ctx context.Context, questID, stepID string, step *CreateQuestStepRequest) (*QuestStep, error)

UpdateStep updates a step

type RateLimitError

type RateLimitError struct {
	APIError
	RetryAfter int `json:"retry_after,omitempty"`
}

RateLimitError is returned when rate limit is exceeded (429).

func NewRateLimitError

func NewRateLimitError(retryAfter int) *RateLimitError

NewRateLimitError creates a new RateLimitError.

type RegisterWalletRequest

type RegisterWalletRequest struct {
	WalletAddress string  `json:"wallet_address"`
	Signature     *string `json:"signature,omitempty"`
}

RegisterWalletRequest registers an external wallet.

type RewardAsset

type RewardAsset struct {
	ID           string                 `json:"id"`
	DefinitionID string                 `json:"definition_id"`
	AssetType    string                 `json:"asset_type"`
	FilePath     string                 `json:"file_path"`
	MimeType     string                 `json:"mime_type"`
	FileSize     int64                  `json:"file_size"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
	CreatedAt    time.Time              `json:"created_at"`
}

RewardAsset represents an asset for a reward

type RewardDefinition

type RewardDefinition struct {
	ID                   string                 `json:"id"`
	Name                 string                 `json:"name"`
	Slug                 string                 `json:"slug"`
	Description          *string                `json:"description,omitempty"`
	RewardType           string                 `json:"reward_type"`
	Value                *float64               `json:"value,omitempty"`
	ValueCurrency        *string                `json:"value_currency,omitempty"`
	TokenContractAddress *string                `json:"token_contract_address,omitempty"`
	TokenSymbol          *string                `json:"token_symbol,omitempty"`
	TokenDecimals        int                    `json:"token_decimals"`
	TokenChain           string                 `json:"token_chain"`
	NFTMintingStrategy   *string                `json:"nft_minting_strategy,omitempty"`
	NFTPreMintCount      *int                   `json:"nft_pre_mint_count,omitempty"`
	NFTMintedPoolCount   int                    `json:"nft_minted_pool_count"`
	NFTIsSoulbound       bool                   `json:"nft_is_soulbound"`
	PassportThresholdID  *string                `json:"passport_threshold_id,omitempty"`
	TriggerType          string                 `json:"trigger_type"`
	TriggerConfig        map[string]interface{} `json:"trigger_config,omitempty"`
	MaxPerUser           *int                   `json:"max_per_user,omitempty"`
	MaxTotal             *int                   `json:"max_total,omitempty"`
	CurrentIssued        int                    `json:"current_issued"`
	IsActive             bool                   `json:"is_active"`
	IconURL              *string                `json:"icon_url,omitempty"`
	BadgeColor           *string                `json:"badge_color,omitempty"`
	CreatedAt            time.Time              `json:"created_at"`
}

RewardDefinition represents a reward configuration

type RewardsClient

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

RewardsClient provides reward operations

func NewRewardsClient

func NewRewardsClient(http *HTTPClient) *RewardsClient

NewRewardsClient creates a new rewards client

func (*RewardsClient) ActivateDefinition

func (r *RewardsClient) ActivateDefinition(ctx context.Context, definitionID string) (*RewardDefinition, error)

ActivateDefinition activates a reward definition

func (*RewardsClient) AwardManual

func (r *RewardsClient) AwardManual(ctx context.Context, req *ManualRewardRequest) ([]EarnedReward, error)

AwardManual manually awards rewards to users

func (*RewardsClient) CreateDefinition

CreateDefinition creates a reward definition

func (*RewardsClient) DeactivateDefinition

func (r *RewardsClient) DeactivateDefinition(ctx context.Context, definitionID string) (*RewardDefinition, error)

DeactivateDefinition deactivates a reward definition

func (*RewardsClient) DeleteDefinition

func (r *RewardsClient) DeleteDefinition(ctx context.Context, definitionID string) error

DeleteDefinition deletes a reward definition

func (*RewardsClient) DistributePending

func (r *RewardsClient) DistributePending(ctx context.Context, earnedRewardID string) (*EarnedReward, error)

DistributePending distributes a pending reward

func (*RewardsClient) GetDefinition

func (r *RewardsClient) GetDefinition(ctx context.Context, definitionID string) (*RewardDefinition, error)

GetDefinition returns a reward definition by ID

func (*RewardsClient) GetUserRewards

func (r *RewardsClient) GetUserRewards(ctx context.Context, userID string) ([]EarnedReward, error)

GetUserRewards returns earned rewards for a user

func (*RewardsClient) ListAssets

func (r *RewardsClient) ListAssets(ctx context.Context, definitionID string) ([]RewardAsset, error)

ListAssets returns assets for a reward definition

func (*RewardsClient) ListDefinitions

func (r *RewardsClient) ListDefinitions(ctx context.Context, opts *ListRewardsOptions) ([]RewardDefinition, error)

ListDefinitions returns reward definitions

func (*RewardsClient) ListEarned

func (r *RewardsClient) ListEarned(ctx context.Context, userID, definitionID, status string, limit, offset int) ([]EarnedReward, error)

ListEarned returns earned rewards

func (*RewardsClient) UpdateDefinition

func (r *RewardsClient) UpdateDefinition(ctx context.Context, definitionID string, req *CreateRewardDefinitionRequest) (*RewardDefinition, error)

UpdateDefinition updates a reward definition

type Schema

type Schema struct {
	ID          string     `json:"id"`
	Name        string     `json:"name"`
	Version     string     `json:"version"`
	DisplayName *string    `json:"display_name,omitempty"`
	Description *string    `json:"description,omitempty"`
	Status      string     `json:"status"`
	IsDefault   bool       `json:"is_default"`
	UsageCount  int        `json:"usage_count"`
	CreatedAt   *time.Time `json:"created_at,omitempty"`
	UpdatedAt   *time.Time `json:"updated_at,omitempty"`
}

Schema represents an event schema

type SchemaDetail

type SchemaDetail struct {
	Schema
	SchemaDefinition map[string]interface{} `json:"schema_definition"`
	YAMLContent      string                 `json:"yaml_content"`
}

SchemaDetail includes the full schema definition

type SchemaField

type SchemaField struct {
	Name        string   `json:"name"`
	Type        string   `json:"type"`
	Required    bool     `json:"required,omitempty"`
	Description *string  `json:"description,omitempty"`
	Default     any      `json:"default,omitempty"`
	Min         *float64 `json:"min,omitempty"`
	Max         *float64 `json:"max,omitempty"`
	Pattern     *string  `json:"pattern,omitempty"`
	Values      []string `json:"values,omitempty"`
}

SchemaField represents a field in a schema

type SchemaListResponse

type SchemaListResponse struct {
	Schemas []Schema `json:"schemas"`
	Total   int      `json:"total"`
}

SchemaListResponse is a paginated list of schemas

type SchemaUsageStats

type SchemaUsageStats struct {
	TotalValidations      int        `json:"total_validations"`
	SuccessfulValidations int        `json:"successful_validations"`
	FailedValidations     int        `json:"failed_validations"`
	LastUsedAt            *time.Time `json:"last_used_at,omitempty"`
}

SchemaUsageStats represents schema usage statistics

type SchemaValidationErrorItem

type SchemaValidationErrorItem struct {
	Field   string `json:"field"`
	Message string `json:"message"`
	Value   any    `json:"value,omitempty"`
}

SchemaValidationErrorItem represents a single validation error

type SchemaValidationResult

type SchemaValidationResult struct {
	Valid         bool                        `json:"valid"`
	SchemaName    string                      `json:"schema_name"`
	SchemaVersion *string                     `json:"schema_version,omitempty"`
	Errors        []SchemaValidationErrorItem `json:"errors"`
}

SchemaValidationResult represents validation results

type SchemasClient

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

SchemasClient provides schema operations

func NewSchemasClient

func NewSchemasClient(http *HTTPClient) *SchemasClient

NewSchemasClient creates a new schemas client

func (*SchemasClient) Activate

func (s *SchemasClient) Activate(ctx context.Context, name string, version *string) (*Schema, error)

Activate activates a schema

func (*SchemasClient) Clone

func (s *SchemasClient) Clone(ctx context.Context, sourceName, newName string, newVersion *string) (*SchemaDetail, error)

Clone clones a schema with a new name

func (*SchemasClient) Create

func (s *SchemasClient) Create(ctx context.Context, yamlContent string) (*SchemaDetail, error)

Create creates a schema from YAML content

func (*SchemasClient) Delete

func (s *SchemasClient) Delete(ctx context.Context, name string, version *string) error

Delete deletes a schema

func (*SchemasClient) Deprecate

func (s *SchemasClient) Deprecate(ctx context.Context, name string, version *string) (*Schema, error)

Deprecate deprecates a schema

func (*SchemasClient) Get

func (s *SchemasClient) Get(ctx context.Context, name string, version *string) (*SchemaDetail, error)

Get returns a schema by name and optional version

func (*SchemasClient) GetUsageStats

func (s *SchemasClient) GetUsageStats(ctx context.Context, name string) (*SchemaUsageStats, error)

GetUsageStats returns schema usage statistics

func (*SchemasClient) List

List returns schemas

func (*SchemasClient) SetDefault

func (s *SchemasClient) SetDefault(ctx context.Context, name, version string) (*Schema, error)

SetDefault sets a schema as the default for its name

func (*SchemasClient) Update

func (s *SchemasClient) Update(ctx context.Context, name string, yamlContent string) (*SchemaDetail, error)

Update updates a schema (creates new version)

func (*SchemasClient) Validate

Validate validates data against a schema

func (*SchemasClient) ValidateMultiple

func (s *SchemasClient) ValidateMultiple(ctx context.Context, schemaNames []string, data map[string]interface{}) ([]SchemaValidationResult, error)

ValidateMultiple validates data against multiple schemas

type SearchEventResult

type SearchEventResult struct {
	ID                 string                 `json:"id"`
	CertificateID      *string                `json:"certificate_id,omitempty"`
	EventType          string                 `json:"event_type"`
	EventSource        string                 `json:"event_source"`
	UserID             string                 `json:"user_id"`
	Status             string                 `json:"status"`
	Timestamp          Timestamp              `json:"timestamp"`
	IPFSHash           *string                `json:"ipfs_hash,omitempty"`
	DocumentName       *string                `json:"document_name,omitempty"`
	DocumentType       *string                `json:"document_type,omitempty"`
	DocumentSize       *int64                 `json:"document_size,omitempty"`
	HasBlockchainProof bool                   `json:"has_blockchain_proof"`
	BlockchainTxHash   *string                `json:"blockchain_tx_hash,omitempty"`
	Data               map[string]interface{} `json:"data,omitempty"`
}

SearchEventResult is a single event in search results.

type SearchFilters

type SearchFilters struct {
	Query              string                 `json:"query,omitempty"`
	EventTypes         []string               `json:"event_types,omitempty"`
	EventSources       []string               `json:"event_sources,omitempty"`
	UserIDs            []string               `json:"user_ids,omitempty"`
	CertificateIDs     []string               `json:"certificate_ids,omitempty"`
	Status             string                 `json:"status,omitempty"`
	HasDocument        *bool                  `json:"has_document,omitempty"`
	HasBlockchainProof *bool                  `json:"has_blockchain_proof,omitempty"`
	FromDate           *Timestamp             `json:"from_date,omitempty"`
	ToDate             *Timestamp             `json:"to_date,omitempty"`
	DataFilters        map[string]interface{} `json:"data_filters,omitempty"`
}

SearchFilters contains search filter criteria.

type SearchQueryRequest

type SearchQueryRequest struct {
	Filters     *SearchFilters `json:"filters,omitempty"`
	Offset      int            `json:"offset,omitempty"`
	Limit       int            `json:"limit,omitempty"`
	IncludeData bool           `json:"include_data,omitempty"`
}

SearchRequest contains parameters for searching events.

type SearchRequest

type SearchRequest struct {
	Query     string `json:"query"`
	UserID    string `json:"user_id,omitempty"`
	EventType string `json:"event_type,omitempty"`
	StartDate string `json:"start_date,omitempty"`
	EndDate   string `json:"end_date,omitempty"`
	Limit     int    `json:"limit,omitempty"`
	Page      int    `json:"page,omitempty"`
}

SearchRequest is the request for searching events.

type SearchResource

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

SearchResource handles search operations.

func (*SearchResource) ByCertificate

func (r *SearchResource) ByCertificate(ctx context.Context, certificateID string) (*SearchEventResult, error)

ByCertificate gets an event by certificate ID.

func (*SearchResource) ByUser

func (r *SearchResource) ByUser(ctx context.Context, userID string, limit, offset int) (*SearchResponse, error)

ByUser gets all events for a specific user.

func (*SearchResource) Facets

func (r *SearchResource) Facets(ctx context.Context, fromDate, toDate *Timestamp) (*FacetsResponse, error)

Facets gets faceted aggregations for building filter UIs.

func (*SearchResource) Query

Query searches events with filters.

func (*SearchResource) Quick

func (r *SearchResource) Quick(ctx context.Context, query string, limit int) (*SearchResponse, error)

Quick performs a quick search across all fields.

func (*SearchResource) Stats

func (r *SearchResource) Stats(ctx context.Context) (*SearchStats, error)

Stats gets search statistics.

type SearchResponse

type SearchResponse struct {
	Results     []SearchEventResult    `json:"results"`
	Total       int                    `json:"total"`
	Offset      int                    `json:"offset"`
	Limit       int                    `json:"limit"`
	QueryTimeMs int                    `json:"query_time_ms"`
	Facets      map[string]interface{} `json:"facets,omitempty"`
}

SearchResponse is the response from a search query.

type SearchResult

type SearchResult struct {
	Total  int     `json:"total"`
	Page   int     `json:"page"`
	Limit  int     `json:"limit"`
	Events []Event `json:"events"`
}

SearchResult is the result of searching events.

type SearchStats

type SearchStats struct {
	PeriodDays        int                      `json:"period_days"`
	TotalEvents       int                      `json:"total_events"`
	UniqueUsers       int                      `json:"unique_users"`
	EventsPerDay      float64                  `json:"events_per_day"`
	TopUsers          []map[string]interface{} `json:"top_users"`
	TopEventTypes     []map[string]interface{} `json:"top_event_types"`
	TotalStorageBytes int64                    `json:"total_storage_bytes"`
}

SearchStats contains search statistics.

type ServerError

type ServerError struct {
	APIError
}

ServerError is returned when the server returns an error (5xx).

func NewServerError

func NewServerError(message string, statusCode int) *ServerError

NewServerError creates a new ServerError.

type Settlement

type Settlement struct {
	ChannelID   string    `json:"channel_id"`
	TxHash      string    `json:"tx_hash"`
	MerkleRoot  string    `json:"merkle_root"`
	EventCount  int       `json:"event_count"`
	BlockNumber int64     `json:"block_number"`
	GasUsed     int64     `json:"gas_used"`
	SettledAt   Timestamp `json:"settled_at"`
}

Settlement is the result of settling a state channel on-chain.

type StepProgress

type StepProgress struct {
	StepID      string     `json:"step_id"`
	StepName    string     `json:"step_name"`
	Order       int        `json:"order"`
	Status      string     `json:"status"`
	CompletedAt *time.Time `json:"completed_at,omitempty"`
	EventID     *string    `json:"event_id,omitempty"`
}

StepProgress represents progress on a single step

type StreamAck

type StreamAck struct {
	Sequence  int64  `json:"sequence"`
	ChannelID string `json:"channel_id"`
	Received  bool   `json:"received"`
}

StreamAck is the acknowledgment for a streamed event.

type StreamBatchRequest

type StreamBatchRequest struct {
	Events []StreamEventRequest `json:"events"`
}

StreamBatchRequest is the request for streaming multiple events.

type StreamEventRequest

type StreamEventRequest struct {
	EventType string                 `json:"event_type"`
	UserID    string                 `json:"user_id"`
	Data      map[string]interface{} `json:"data,omitempty"`
	Source    string                 `json:"event_source,omitempty"`
}

StreamEventRequest is the request for streaming an event to a channel.

type StreamStats

type StreamStats struct {
	TotalSent     int64
	TotalSuccess  int64
	TotalFailed   int64
	TotalDropped  int64 // Events dropped due to buffer full (only for TrySend)
	Duration      time.Duration
	EventsPerSec  float64
	ActiveStreams int
}

StreamStats contains statistics about a streaming session.

type SwapQuote

type SwapQuote struct {
	FromToken          string `json:"from_token"`
	ToToken            string `json:"to_token"`
	FromAmount         string `json:"from_amount"`
	ToAmount           string `json:"to_amount"`
	MinToAmount        string `json:"min_to_amount"`
	ExchangeRate       string `json:"exchange_rate"`
	QuoteID            string `json:"quote_id"`
	SlippageBps        int    `json:"slippage_bps"`
	Network            string `json:"network"`
	LiquidityAvailable bool   `json:"liquidity_available"`
	ExpiresAt          string `json:"expires_at"`
}

SwapQuote represents a token swap quote

type SwapQuoteRequest

type SwapQuoteRequest struct {
	FromToken   string `json:"from_token"`
	ToToken     string `json:"to_token"`
	FromAmount  string `json:"from_amount"`
	Network     string `json:"network,omitempty"`
	SlippageBps int    `json:"slippage_bps,omitempty"`
}

type SwapResult

type SwapResult struct {
	TransactionHash string `json:"transaction_hash"`
	Status          string `json:"status"`
	FromToken       string `json:"from_token"`
	ToToken         string `json:"to_token"`
	FromAmount      string `json:"from_amount"`
	ToAmount        string `json:"to_amount"`
	GasUsed         string `json:"gas_used"`
}

SwapResult represents a completed swap

type TemplateField

type TemplateField struct {
	ID            string                 `json:"id"`
	TemplateID    string                 `json:"template_id"`
	Name          string                 `json:"name"`
	FieldKey      string                 `json:"field_key"`
	Description   *string                `json:"description,omitempty"`
	DataType      string                 `json:"data_type"`
	DefaultValue  interface{}            `json:"default_value,omitempty"`
	Formula       *string                `json:"formula,omitempty"`
	FormulaType   *string                `json:"formula_type,omitempty"`
	Aggregation   *string                `json:"aggregation,omitempty"`
	EventFilter   map[string]interface{} `json:"event_filter,omitempty"`
	DisplayFormat *string                `json:"display_format,omitempty"`
	Icon          *string                `json:"icon,omitempty"`
	Color         *string                `json:"color,omitempty"`
	SortOrder     int                    `json:"sort_order"`
	IsVisible     bool                   `json:"is_visible"`
	IsComputed    bool                   `json:"is_computed"`
	CreatedAt     time.Time              `json:"created_at"`
}

TemplateField defines a field within a template

type TenantInfo

type TenantInfo struct {
	TenantID           string  `json:"tenant_id"`
	Name               string  `json:"name"`
	Slug               string  `json:"slug,omitempty"`
	ClientID           string  `json:"client_id,omitempty"`
	Tier               string  `json:"tier,omitempty"`
	Status             string  `json:"status,omitempty"`
	ContractAddress    *string `json:"contract_address,omitempty"`
	ChainID            int     `json:"chain_id,omitempty"`
	MaxEventsPerMonth  int     `json:"max_events_per_month,omitempty"`
	EventsThisMonth    int     `json:"events_this_month,omitempty"`
	EncryptionEnabled  bool    `json:"encryption_enabled,omitempty"`
	OnchainSyncEnabled bool    `json:"onchain_sync_enabled,omitempty"`
}

TenantInfo contains tenant account information.

type TenantResource

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

TenantResource handles tenant management operations.

func (*TenantResource) BlockchainCertificates

func (r *TenantResource) BlockchainCertificates(ctx context.Context, limit, offset int) (map[string]interface{}, error)

BlockchainCertificates lists blockchain-attested certificates.

func (*TenantResource) BlockchainExport

func (r *TenantResource) BlockchainExport(ctx context.Context, format string) (map[string]interface{}, error)

BlockchainExport exports blockchain attestation data.

func (*TenantResource) BlockchainStats

func (r *TenantResource) BlockchainStats(ctx context.Context) (*BlockchainStats, error)

BlockchainStats gets blockchain statistics for the tenant.

func (*TenantResource) BlockchainVerify

func (r *TenantResource) BlockchainVerify(ctx context.Context, certificateID string) (*BlockchainProof, error)

BlockchainVerify verifies a certificate on the blockchain.

func (*TenantResource) Context

func (r *TenantResource) Context(ctx context.Context) (map[string]interface{}, error)

Context gets tenant context information.

func (*TenantResource) CreateAPIKey

func (r *TenantResource) CreateAPIKey(ctx context.Context, req *CreateAPIKeyRequest) (*APIKey, error)

CreateAPIKey creates a new API key.

func (*TenantResource) DeleteAPIKey

func (r *TenantResource) DeleteAPIKey(ctx context.Context, keyID string) error

DeleteAPIKey deletes an API key.

func (*TenantResource) ForceBatch

func (r *TenantResource) ForceBatch(ctx context.Context) (map[string]interface{}, error)

ForceBatch triggers immediate batch settlement.

func (*TenantResource) ListAPIKeys

func (r *TenantResource) ListAPIKeys(ctx context.Context) ([]APIKey, error)

ListAPIKeys lists all API keys for the tenant.

func (*TenantResource) SettleAll

func (r *TenantResource) SettleAll(ctx context.Context) (map[string]interface{}, error)

SettleAll settles all pending events.

func (*TenantResource) SettleEvent

func (r *TenantResource) SettleEvent(ctx context.Context, eventID string) (map[string]interface{}, error)

SettleEvent settles a specific event immediately.

func (*TenantResource) UsageDetailed

func (r *TenantResource) UsageDetailed(ctx context.Context, fromDate, toDate string) (map[string]interface{}, error)

UsageDetailed gets detailed usage statistics.

type TierDefinition

type TierDefinition struct {
	Name string  `json:"name"`
	Min  float64 `json:"min"`
	Max  float64 `json:"max"`
}

TierDefinition defines a tier within a computation.

type TimeoutError

type TimeoutError struct {
	APIError
}

TimeoutError is returned when a request times out.

func NewTimeoutError

func NewTimeoutError() *TimeoutError

NewTimeoutError creates a new TimeoutError.

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp is a custom time type that handles various timestamp formats.

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON handles parsing timestamps with or without timezone.

type Token

type Token struct {
	ID              string  `json:"id"`
	ContractAddress string  `json:"contract_address"`
	Network         string  `json:"network"`
	Symbol          string  `json:"symbol"`
	Name            string  `json:"name"`
	Decimals        int     `json:"decimals"`
	LogoURL         *string `json:"logo_url,omitempty"`
	Color           *string `json:"color,omitempty"`
	CoingeckoID     *string `json:"coingecko_id,omitempty"`
	CoinmarketcapID *string `json:"coinmarketcap_id,omitempty"`
	TokenStandard   string  `json:"token_standard"`
	IsNativeWrapper bool    `json:"is_native_wrapper"`
	IsVerified      bool    `json:"is_verified"`
	IsActive        bool    `json:"is_active"`
	IsHidden        *bool   `json:"is_hidden,omitempty"`
	DisplayOrder    int     `json:"display_order"`
	IsGlobal        bool    `json:"is_global"`
}

Token represents a registered token (native, ERC-20, or custom)

type TokenBalance

type TokenBalance struct {
	Token    string   `json:"token"`
	Symbol   string   `json:"symbol"`
	Balance  string   `json:"balance"`
	Decimals int      `json:"decimals"`
	USDValue *float64 `json:"usd_value,omitempty"`
}

TokenBalance represents a single token balance

type Transaction

type Transaction struct {
	Hash      string `json:"hash"`
	Type      string `json:"type"` // "sent" or "received"
	From      string `json:"from"`
	To        string `json:"to"`
	Value     string `json:"value"`
	Asset     string `json:"asset"`
	Category  string `json:"category"`
	BlockNum  string `json:"block_num"`
	Timestamp string `json:"timestamp"`
}

Transaction represents a single blockchain transaction

type TransactionHistory

type TransactionHistory struct {
	Address       string        `json:"address"`
	Network       string        `json:"network"`
	TotalSent     int           `json:"total_sent"`
	TotalReceived int           `json:"total_received"`
	Transactions  []Transaction `json:"transactions"`
	Error         *string       `json:"error,omitempty"`
}

TransactionHistory contains transaction history for a wallet

type TransferRequest

type TransferRequest struct {
	FromAddress string `json:"from_address"`
	ToAddress   string `json:"to_address"`
	Amount      string `json:"amount"`
	Token       string `json:"token,omitempty"`
	Network     string `json:"network,omitempty"`
}

TransferRequest represents a token transfer request

type TransferResult

type TransferResult struct {
	TxHash  string `json:"tx_hash"`
	From    string `json:"from"`
	To      string `json:"to"`
	Amount  string `json:"amount"`
	Token   string `json:"token"`
	Network string `json:"network"`
	Status  string `json:"status"`
}

TransferResult represents the result of a token transfer

type UpdateDataViewRequest

type UpdateDataViewRequest struct {
	DisplayName      *string     `json:"display_name,omitempty"`
	Description      *string     `json:"description,omitempty"`
	Computation      interface{} `json:"computation,omitempty"`
	SourceCategories []string    `json:"source_categories,omitempty"`
	IsPublic         *bool       `json:"is_public,omitempty"`
}

UpdateDataViewRequest updates an existing data view.

type UpdateEndUserRequest

type UpdateEndUserRequest struct {
	Email       *string                `json:"email,omitempty"`
	FirstName   *string                `json:"first_name,omitempty"`
	LastName    *string                `json:"last_name,omitempty"`
	DisplayName *string                `json:"display_name,omitempty"`
	AvatarURL   *string                `json:"avatar_url,omitempty"`
	Phone       *string                `json:"phone,omitempty"`
	DateOfBirth *time.Time             `json:"date_of_birth,omitempty"`
	Country     *string                `json:"country,omitempty"`
	City        *string                `json:"city,omitempty"`
	Timezone    *string                `json:"timezone,omitempty"`
	Language    *string                `json:"language,omitempty"`
	Bio         *string                `json:"bio,omitempty"`
	Segments    []string               `json:"segments,omitempty"`
	Tags        map[string]interface{} `json:"tags,omitempty"`
	Attributes  map[string]interface{} `json:"attributes,omitempty"`
}

UpdateEndUserRequest updates an end-user profile.

type UpdatePassportRequest

type UpdatePassportRequest struct {
	WalletAddress  *string                `json:"wallet_address,omitempty"`
	Level          *int                   `json:"level,omitempty"`
	Points         *int                   `json:"points,omitempty"`
	Experience     *int                   `json:"experience,omitempty"`
	Traits         map[string]interface{} `json:"traits,omitempty"`
	CustomMetadata map[string]interface{} `json:"custom_metadata,omitempty"`
}

UpdatePassportRequest is the request to update a passport

type UpdateTokenRequest

type UpdateTokenRequest struct {
	Symbol             *string `json:"symbol,omitempty"`
	Name               *string `json:"name,omitempty"`
	Decimals           *int    `json:"decimals,omitempty"`
	LogoURL            *string `json:"logo_url,omitempty"`
	Color              *string `json:"color,omitempty"`
	CoingeckoID        *string `json:"coingecko_id,omitempty"`
	CoinmarketcapID    *string `json:"coinmarketcap_id,omitempty"`
	CustomPriceFeedURL *string `json:"custom_price_feed_url,omitempty"`
	IsActive           *bool   `json:"is_active,omitempty"`
	IsHidden           *bool   `json:"is_hidden,omitempty"`
	DisplayOrder       *int    `json:"display_order,omitempty"`
}

UpdateTokenRequest updates a custom token

type UpdateWebhookRequest

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

UpdateWebhookRequest is the request for updating a webhook.

type UsageStats

type UsageStats struct {
	TenantID          string  `json:"tenant_id,omitempty"`
	EventsThisMonth   int     `json:"events_this_month,omitempty"`
	MaxEventsPerMonth int     `json:"max_events_per_month,omitempty"`
	UsagePercentage   float64 `json:"usage_percentage,omitempty"`
	StorageUsedBytes  int64   `json:"storage_used_bytes,omitempty"`
	MaxStorageGB      int     `json:"max_storage_gb,omitempty"`
	LastEventAt       string  `json:"last_event_at,omitempty"`
	// Legacy fields
	PeriodStart       *Timestamp `json:"period_start,omitempty"`
	PeriodEnd         *Timestamp `json:"period_end,omitempty"`
	EventsCreated     int        `json:"events_created,omitempty"`
	DocumentsAttested int        `json:"documents_attested,omitempty"`
	Verifications     int        `json:"verifications,omitempty"`
	APICalls          int        `json:"api_calls,omitempty"`
	StorageBytes      int64      `json:"storage_bytes,omitempty"`
	ChannelsCreated   int        `json:"channels_created,omitempty"`
	Settlements       int        `json:"settlements,omitempty"`
}

UsageStats contains API usage statistics.

type UserAchievement

type UserAchievement struct {
	ID            string       `json:"id"`
	PassportID    string       `json:"passport_id"`
	AchievementID string       `json:"achievement_id"`
	Achievement   *Achievement `json:"achievement,omitempty"`
	EarnedAt      time.Time    `json:"earned_at"`
	Progress      float64      `json:"progress"`
	Completed     bool         `json:"completed"`
}

UserAchievement represents an achievement earned by a user

type UserActivityResponse

type UserActivityResponse struct {
	UserID         string                   `json:"user_id"`
	ExternalID     string                   `json:"external_id"`
	TotalEvents    int                      `json:"total_events"`
	EventsByType   map[string]int           `json:"events_by_type"`
	EventsByDay    []map[string]interface{} `json:"events_by_day"`
	RecentEvents   []map[string]interface{} `json:"recent_events"`
	RewardsEarned  int                      `json:"rewards_earned"`
	RewardsPending int                      `json:"rewards_pending"`
}

UserActivityResponse is the activity summary for a user.

type UserBadge

type UserBadge struct {
	ID         string                 `json:"id"`
	PassportID string                 `json:"passport_id"`
	BadgeID    string                 `json:"badge_id"`
	Badge      *Badge                 `json:"badge,omitempty"`
	EarnedAt   time.Time              `json:"earned_at"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

UserBadge represents a badge earned by a user

type UserBreakdownResponse

type UserBreakdownResponse struct {
	UserID  string                     `json:"user_id"`
	Filter  map[string]interface{}     `json:"filter"`
	Cohorts []UserCohortBreakdownEntry `json:"cohorts"`
}

UserBreakdownResponse contains a user's breakdown across all cohorts.

type UserCohortBreakdownEntry

type UserCohortBreakdownEntry struct {
	CohortID                   string   `json:"cohort_id"`
	CohortSlug                 string   `json:"cohort_slug"`
	CohortName                 string   `json:"cohort_name"`
	Icon                       *string  `json:"icon,omitempty"`
	Color                      *string  `json:"color,omitempty"`
	UserPercentile             float64  `json:"user_percentile"`
	FilteredGroupAvgPercentile *float64 `json:"filtered_group_avg_percentile,omitempty"`
	GlobalGroupAvgPercentile   float64  `json:"global_group_avg_percentile"`
}

UserCohortBreakdownEntry is a single cohort entry in a user breakdown.

type UserQuestProgress

type UserQuestProgress struct {
	ID               string         `json:"id"`
	UserID           string         `json:"user_id"`
	QuestID          string         `json:"quest_id"`
	QuestName        string         `json:"quest_name"`
	Status           string         `json:"status"`
	StartedAt        *time.Time     `json:"started_at,omitempty"`
	CompletedAt      *time.Time     `json:"completed_at,omitempty"`
	ExpiresAt        *time.Time     `json:"expires_at,omitempty"`
	CompletionCount  int            `json:"completion_count"`
	CurrentStepOrder int            `json:"current_step_order"`
	StepProgress     []StepProgress `json:"step_progress"`
	PointsEarned     int            `json:"points_earned"`
	RewardEarned     bool           `json:"reward_earned"`
}

UserQuestProgress represents a user's progress on a quest

type UserReward

type UserReward struct {
	ID            string   `json:"id"`
	RewardName    string   `json:"reward_name"`
	RewardType    string   `json:"reward_type"`
	Value         *float64 `json:"value,omitempty"`
	ValueCurrency *string  `json:"value_currency,omitempty"`
	Status        string   `json:"status"`
	EarnedAt      *string  `json:"earned_at,omitempty"`
	DistributedAt *string  `json:"distributed_at,omitempty"`
	NFTTokenID    *int     `json:"nft_token_id,omitempty"`
	NFTTxHash     *string  `json:"nft_tx_hash,omitempty"`
}

UserReward represents a single earned reward.

type UserRewardsResponse

type UserRewardsResponse struct {
	UserID   string       `json:"user_id"`
	Rewards  []UserReward `json:"rewards"`
	Total    int          `json:"total"`
	Page     int          `json:"page"`
	PageSize int          `json:"page_size"`
	HasMore  bool         `json:"has_more"`
}

UserRewardsResponse is a paginated list of user rewards.

type UserWalletSummary

type UserWalletSummary struct {
	UserID       string              `json:"user_id"`
	TotalWallets int                 `json:"total_wallets"`
	TotalNFTs    int                 `json:"total_nfts"`
	TotalSwaps   int                 `json:"total_swaps"`
	Wallets      []WalletSummaryItem `json:"wallets"`
}

UserWalletSummary contains summary of all user wallets

type UserWithWallets

type UserWithWallets struct {
	UserID  string   `json:"user_id"`
	Wallets []Wallet `json:"wallets"`
}

UserWithWallets represents a user and their wallets

type UsersWithWalletsResponse

type UsersWithWalletsResponse struct {
	Users  []UserWithWallets `json:"users"`
	Total  int               `json:"total"`
	Limit  int               `json:"limit"`
	Offset int               `json:"offset"`
}

UsersWithWalletsResponse is a paginated list of users with wallets

type ValidateDataRequest

type ValidateDataRequest struct {
	SchemaName    string                 `json:"schema_name"`
	SchemaVersion *string                `json:"schema_version,omitempty"`
	Data          map[string]interface{} `json:"data"`
}

type ValidationError

type ValidationError struct {
	APIError
	Errors []ValidationErrorDetail `json:"errors,omitempty"`
}

ValidationError is returned when request validation fails (400/422).

func NewValidationError

func NewValidationError(message string, errors []ValidationErrorDetail) *ValidationError

NewValidationError creates a new ValidationError.

type ValidationErrorDetail

type ValidationErrorDetail struct {
	Field   string `json:"field"`
	Message string `json:"message"`
}

ValidationErrorDetail contains details about a validation error.

type VaultFile

type VaultFile struct {
	ID            string     `json:"id"`
	Name          string     `json:"name"`
	Size          int64      `json:"size"`
	MimeType      string     `json:"mime_type"`
	FolderID      *string    `json:"folder_id,omitempty"`
	IPFSHash      string     `json:"ipfs_hash"`
	CertificateID *string    `json:"certificate_id,omitempty"`
	TxHash        *string    `json:"tx_hash,omitempty"`
	Status        string     `json:"status"`
	AccessMode    string     `json:"access_mode"`
	CreatedAt     Timestamp  `json:"created_at"`
	UpdatedAt     *Timestamp `json:"updated_at,omitempty"`
}

VaultFile represents a file stored in the vault.

type VaultFolder

type VaultFolder struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	ParentID  *string   `json:"parent_id,omitempty"`
	CreatedAt Timestamp `json:"created_at"`
}

VaultFolder represents a folder in the vault.

type VaultListResponse

type VaultListResponse struct {
	Files      []VaultFile   `json:"files"`
	Folders    []VaultFolder `json:"folders"`
	TotalFiles int           `json:"total_files"`
	TotalSize  int64         `json:"total_size"`
}

VaultListResponse is the response from listing vault contents.

type VaultResource

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

VaultResource handles file vault operations.

func (*VaultResource) CreateFolder

func (r *VaultResource) CreateFolder(ctx context.Context, name string, parentID string) (*VaultFolder, error)

CreateFolder creates a new folder.

func (*VaultResource) Delete

func (r *VaultResource) Delete(ctx context.Context, fileID string) error

Delete deletes a file from the vault.

func (*VaultResource) DeleteFolder

func (r *VaultResource) DeleteFolder(ctx context.Context, folderID string) error

DeleteFolder deletes a folder.

func (*VaultResource) Download

func (r *VaultResource) Download(ctx context.Context, fileID string) ([]byte, error)

Download downloads a file's content.

func (*VaultResource) Get

func (r *VaultResource) Get(ctx context.Context, fileID string) (*VaultFile, error)

Get retrieves file details by ID.

func (*VaultResource) List

func (r *VaultResource) List(ctx context.Context, folderID string) (*VaultListResponse, error)

List lists all files and folders in the vault.

func (*VaultResource) Move

func (r *VaultResource) Move(ctx context.Context, fileID, folderID string) (*VaultFile, error)

Move moves a file to a different folder.

func (*VaultResource) Share

func (r *VaultResource) Share(ctx context.Context, fileID string, expiresInHours int) (map[string]interface{}, error)

Share creates a shareable link for a file.

func (*VaultResource) Stats

func (r *VaultResource) Stats(ctx context.Context) (*VaultStats, error)

Stats returns vault storage statistics.

func (*VaultResource) Upload

Upload uploads a file from disk to the vault.

func (*VaultResource) UploadBytes

func (r *VaultResource) UploadBytes(ctx context.Context, req *VaultUploadBytesRequest) (*VaultFile, error)

UploadBytes uploads raw bytes to the vault.

type VaultStats

type VaultStats struct {
	TotalFiles   int   `json:"total_files"`
	TotalFolders int   `json:"total_folders"`
	TotalSize    int64 `json:"total_size"`
	UsedQuota    int64 `json:"used_quota"`
	MaxQuota     int64 `json:"max_quota"`
}

VaultStats contains vault storage statistics.

type VaultUploadBytesRequest

type VaultUploadBytesRequest struct {
	Content    []byte
	Filename   string
	MimeType   string
	UserID     string
	FolderID   string
	AccessMode string
	Encrypt    bool
}

VaultUploadBytesRequest contains parameters for uploading raw bytes.

type VaultUploadRequest

type VaultUploadRequest struct {
	FilePath   string
	UserID     string
	FolderID   string
	AccessMode string // "private" or "public"
	Encrypt    bool
}

VaultUploadRequest contains parameters for uploading a file.

type VerificationResult

type VerificationResult struct {
	Valid           bool             `json:"valid"`
	IPFSHash        string           `json:"ipfs_hash"`
	DocumentHash    *string          `json:"document_hash,omitempty"`
	Timestamp       *Timestamp       `json:"timestamp,omitempty"`
	CertificateID   *string          `json:"certificate_id,omitempty"`
	BlockchainTx    *string          `json:"blockchain_tx,omitempty"`
	BlockNumber     *int64           `json:"block_number,omitempty"`
	AttestationMode *AttestationMode `json:"attestation_mode,omitempty"`
	ProofVerified   bool             `json:"proof_verified"`
	Message         string           `json:"message"`
}

VerificationResult is the result of verifying a document or event.

type VerifyResource

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

VerifyResource handles public verification operations.

func (*VerifyResource) Batch

func (r *VerifyResource) Batch(ctx context.Context, batchID string) (*BatchVerifyResult, error)

Batch verifies a batch by ID.

func (*VerifyResource) BatchVerify

func (r *VerifyResource) BatchVerify(ctx context.Context, items []BatchVerifyItem) (map[string]interface{}, error)

BatchVerify verifies multiple items in a single request.

func (*VerifyResource) Certificate

func (r *VerifyResource) Certificate(ctx context.Context, certificateID string) (*CertificateVerifyResult, error)

Certificate verifies a certificate by ID.

func (*VerifyResource) Document

func (r *VerifyResource) Document(ctx context.Context, filePath string, ipfsHash string) (map[string]interface{}, error)

Document verifies a document by uploading it.

func (*VerifyResource) Event

func (r *VerifyResource) Event(ctx context.Context, ipfsHash string) (map[string]interface{}, error)

Event verifies an event by its IPFS hash.

func (*VerifyResource) EventBatchProof

func (r *VerifyResource) EventBatchProof(ctx context.Context, eventID string) (*EventBatchProof, error)

EventBatchProof gets the batch proof for a specific event.

func (*VerifyResource) Proof

Proof verifies a Merkle proof cryptographically.

type ViewTemplate

type ViewTemplate struct {
	ID          string              `json:"id"`
	Name        string              `json:"name"`
	Description string              `json:"description"`
	Computation DataViewComputation `json:"computation"`
}

ViewTemplate is a pre-configured computation pattern.

type Wallet

type Wallet struct {
	WalletID       string                 `json:"wallet_id"`
	Address        string                 `json:"address"`
	UserID         string                 `json:"user_id"`
	WalletType     string                 `json:"wallet_type"`
	Network        string                 `json:"network"`
	Name           *string                `json:"name,omitempty"`
	Status         string                 `json:"status"`
	CreatedAt      string                 `json:"created_at"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
	SupportsExport *bool                  `json:"supports_export,omitempty"`
	OwnerWalletID  *string                `json:"owner_wallet_id,omitempty"`
	IsDeployed     *bool                  `json:"is_deployed,omitempty"`
}

Wallet represents a CDP wallet

type WalletActivityInfo

type WalletActivityInfo struct {
	RecentSwaps []SwapResult `json:"recent_swaps"`
	TotalSwaps  int          `json:"total_swaps"`
}

WalletActivityInfo contains recent activity

type WalletBalance

type WalletBalance struct {
	WalletID string         `json:"wallet_id"`
	Address  string         `json:"address"`
	Network  string         `json:"network"`
	Balances []TokenBalance `json:"balances"`
}

WalletBalance represents wallet token balances

type WalletBalanceInfo

type WalletBalanceInfo struct {
	Address   string         `json:"address"`
	Network   string         `json:"network"`
	Tokens    []TokenBalance `json:"tokens"`
	FetchedAt string         `json:"fetched_at"`
}

WalletBalanceInfo contains token balance data

type WalletClient

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

WalletClient provides wallet operations

func NewWalletClient

func NewWalletClient(http *HTTPClient) *WalletClient

NewWalletClient creates a new wallet client

func (*WalletClient) AddNFT

func (w *WalletClient) AddNFT(ctx context.Context, walletID string, req *AddNFTRequest) (*NFT, error)

AddNFT adds an NFT to wallet tracking

func (*WalletClient) Create

func (w *WalletClient) Create(ctx context.Context, req *CreateWalletRequest) (*Wallet, error)

Create creates a single wallet

func (*WalletClient) CreateDual

CreateDual creates dual wallets (EOA + Smart Account)

func (*WalletClient) CreateDualBulk

func (w *WalletClient) CreateDualBulk(ctx context.Context, userIDs []string, network string) ([]DualWallets, error)

CreateDualBulk creates dual wallets for multiple users

func (*WalletClient) CreateToken

func (w *WalletClient) CreateToken(ctx context.Context, req *CreateTokenRequest) (*Token, error)

CreateToken registers a custom token for the tenant.

func (*WalletClient) DeleteToken

func (w *WalletClient) DeleteToken(ctx context.Context, tokenID string) error

DeleteToken soft-deletes a custom token.

func (*WalletClient) ExecuteSwap

func (w *WalletClient) ExecuteSwap(ctx context.Context, req *ExecuteSwapRequest) (*SwapResult, error)

ExecuteSwap executes a token swap

func (*WalletClient) ExportKey

func (w *WalletClient) ExportKey(ctx context.Context, walletID string) (string, error)

ExportKey exports private key for an EOA wallet

func (*WalletClient) Get

func (w *WalletClient) Get(ctx context.Context, walletID string) (*Wallet, error)

Get returns a wallet by ID

func (*WalletClient) GetBalance

func (w *WalletClient) GetBalance(ctx context.Context, walletID string) (*WalletBalance, error)

GetBalance returns wallet balance

func (*WalletClient) GetInfo

func (w *WalletClient) GetInfo(ctx context.Context, walletID string, opts *GetInfoOptions) (*ComprehensiveWalletInfo, error)

GetInfo returns comprehensive wallet information in a single call. Returns everything about a wallet: details, balances, NFTs, and activity.

func (*WalletClient) GetNFTs

func (w *WalletClient) GetNFTs(ctx context.Context, walletID string) ([]NFT, error)

GetNFTs returns NFTs for a wallet

func (*WalletClient) GetSwapQuote

func (w *WalletClient) GetSwapQuote(ctx context.Context, req *SwapQuoteRequest) (*SwapQuote, error)

GetSwapQuote gets a swap quote

func (*WalletClient) GetToken

func (w *WalletClient) GetToken(ctx context.Context, tokenID string) (*Token, error)

GetToken returns a specific token by ID.

func (*WalletClient) GetTokenByContract

func (w *WalletClient) GetTokenByContract(ctx context.Context, contractAddress, network string) (*Token, error)

GetTokenByContract returns a token by contract address and network.

func (*WalletClient) GetTransactions

func (w *WalletClient) GetTransactions(ctx context.Context, walletID string, limit, offset int) (*TransactionHistory, error)

GetTransactions returns transaction history for a wallet.

func (*WalletClient) GetUserNFTs

func (w *WalletClient) GetUserNFTs(ctx context.Context, userID string) ([]NFT, error)

GetUserNFTs returns all NFTs for a user

func (*WalletClient) GetUserSummary

func (w *WalletClient) GetUserSummary(ctx context.Context, userID string, includeBalances bool) (*UserWalletSummary, error)

GetUserSummary returns comprehensive summary of all wallets for a user. Aggregates data across all user's wallets (EOA + Smart).

func (*WalletClient) ListByUser

func (w *WalletClient) ListByUser(ctx context.Context, userID string) ([]Wallet, error)

ListByUser returns wallets for a user

func (*WalletClient) ListGlobalTokens

func (w *WalletClient) ListGlobalTokens(ctx context.Context, network string) ([]Token, error)

ListGlobalTokens returns well-known tokens available to all tenants.

func (*WalletClient) ListTokens

func (w *WalletClient) ListTokens(ctx context.Context, opts *ListTokensOptions) ([]Token, error)

ListTokens returns all tokens available to the tenant.

func (*WalletClient) ListUsersWithWallets

func (w *WalletClient) ListUsersWithWallets(ctx context.Context, limit, offset int) (*UsersWithWalletsResponse, error)

ListUsersWithWallets returns all users who have wallets, grouped by user_id.

func (*WalletClient) Stats

func (w *WalletClient) Stats(ctx context.Context) (*WalletStats, error)

Stats returns wallet statistics

func (*WalletClient) Transfer

func (w *WalletClient) Transfer(ctx context.Context, req *TransferRequest) (*TransferResult, error)

Transfer sends tokens from one address to another. Returns the transaction result with hash and status.

func (*WalletClient) UpdateToken

func (w *WalletClient) UpdateToken(ctx context.Context, tokenID string, req *UpdateTokenRequest) (*Token, error)

UpdateToken updates a custom token.

type WalletCreationResult

type WalletCreationResult struct {
	Success       bool    `json:"success"`
	UserID        string  `json:"user_id"`
	WalletAddress string  `json:"wallet_address"`
	WalletType    *string `json:"wallet_type,omitempty"`
	Network       *string `json:"network,omitempty"`
	Source        string  `json:"source"`
}

WalletCreationResult is the response from wallet creation/registration.

type WalletNFTInfo

type WalletNFTInfo struct {
	Total int   `json:"total"`
	Items []NFT `json:"items"`
}

WalletNFTInfo contains NFT holdings

type WalletStats

type WalletStats struct {
	TotalWallets int            `json:"total_wallets"`
	ByType       map[string]int `json:"by_type"`
	ByNetwork    map[string]int `json:"by_network"`
}

WalletStats represents wallet statistics

type WalletSummaryItem

type WalletSummaryItem struct {
	WalletID       string             `json:"wallet_id"`
	Address        string             `json:"address"`
	WalletType     string             `json:"wallet_type"`
	Network        string             `json:"network"`
	Name           *string            `json:"name,omitempty"`
	SupportsExport bool               `json:"supports_export"`
	CreatedAt      string             `json:"created_at"`
	OwnerWalletID  *string            `json:"owner_wallet_id,omitempty"`
	IsDeployed     *bool              `json:"is_deployed,omitempty"`
	Balances       *WalletBalanceInfo `json:"balances,omitempty"`
}

WalletSummaryItem represents a wallet in the user summary

type Webhook

type Webhook struct {
	ID            string     `json:"id"`
	URL           string     `json:"url"`
	Events        []string   `json:"events"`
	Active        bool       `json:"active"`
	CreatedAt     Timestamp  `json:"created_at"`
	LastTriggered *Timestamp `json:"last_triggered,omitempty"`
	FailureCount  int        `json:"failure_count"`
}

Webhook represents a registered webhook endpoint.

type WebhooksResource

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

WebhooksResource handles webhook operations.

func (*WebhooksResource) Create

Create creates a new webhook.

func (*WebhooksResource) Delete

func (r *WebhooksResource) Delete(ctx context.Context, webhookID string) error

Delete deletes a webhook.

func (*WebhooksResource) Get

func (r *WebhooksResource) Get(ctx context.Context, webhookID string) (*Webhook, error)

Get retrieves a webhook by ID.

func (*WebhooksResource) List

func (r *WebhooksResource) List(ctx context.Context) ([]Webhook, error)

List lists all webhooks.

func (*WebhooksResource) Test

func (r *WebhooksResource) Test(ctx context.Context, webhookID string) (map[string]interface{}, error)

Test sends a test event to a webhook.

func (*WebhooksResource) Update

func (r *WebhooksResource) Update(ctx context.Context, webhookID string, req *UpdateWebhookRequest) (*Webhook, error)

Update updates a webhook.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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