Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
77 lines
1.8 KiB
Go
77 lines
1.8 KiB
Go
package commerce
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"time"
|
|
)
|
|
|
|
type RequestAuthorizer interface {
|
|
Authorize(*http.Request) error
|
|
}
|
|
|
|
type RequestAuthorizerFunc func(*http.Request) error
|
|
|
|
func (f RequestAuthorizerFunc) Authorize(request *http.Request) error {
|
|
return f(request)
|
|
}
|
|
|
|
type MembershipAccessState string
|
|
|
|
const (
|
|
MembershipAccessFree MembershipAccessState = "free"
|
|
MembershipAccessActive MembershipAccessState = "active"
|
|
MembershipAccessInactive MembershipAccessState = "inactive"
|
|
MembershipAccessUnknown MembershipAccessState = "unknown"
|
|
)
|
|
|
|
type MembershipSummary struct {
|
|
TierKey string
|
|
DisplayName string
|
|
BillingPeriod string
|
|
Status string
|
|
AccessStatus string
|
|
CurrentPeriodEnd string
|
|
CancelAtPeriodEnd *bool
|
|
}
|
|
|
|
type CreditsSummary struct {
|
|
AvailableCredits *string
|
|
ExpiringCreditsWithin24h *string
|
|
NextExpireAt string
|
|
RefreshedAt string
|
|
}
|
|
|
|
type ProductSummaryPartialError struct {
|
|
Scope string
|
|
Code string
|
|
Message string
|
|
}
|
|
|
|
type RegistrationCreditsReward struct {
|
|
ID string
|
|
UserID string
|
|
GrantNo string
|
|
Credits int64
|
|
CreatedAt time.Time
|
|
}
|
|
|
|
type ProductSummary struct {
|
|
Membership *MembershipSummary
|
|
MembershipAccess MembershipAccessState
|
|
Credits *CreditsSummary
|
|
RegistrationCreditsReward *RegistrationCreditsReward
|
|
PartialError *ProductSummaryPartialError
|
|
}
|
|
|
|
type RewardReceiptState struct {
|
|
Pending *RegistrationCreditsReward `json:"pending,omitempty"`
|
|
Shown map[string]int64 `json:"shown,omitempty"`
|
|
Attempted map[string]int64 `json:"attempted,omitempty"`
|
|
}
|
|
|
|
type RewardReceiptStore interface {
|
|
Load(context.Context) (RewardReceiptState, error)
|
|
Save(context.Context, RewardReceiptState) error
|
|
}
|