Documentation
¶
Index ¶
- Constants
- Variables
- func FormatTime(t time.Time) string
- func FromNillableString(s *string) string
- func FromNillableTime(t *time.Time) time.Time
- func GenerateUUID() string
- func GenerateUUIDWithPrefix(prefix string) string
- func GetCurrencyPrecision(code string) int32
- func GetCurrencySymbol(code string) string
- func GetEnvironmentID(ctx context.Context) string
- func GetJWT(ctx context.Context) string
- func GetRequestID(ctx context.Context) string
- func GetTenantID(ctx context.Context) string
- func GetUserID(ctx context.Context) string
- func IsMatchingCurrency(a, b string) bool
- func IsValidEmail(email string) bool
- func NextBillingDate(currentPeriodStart, billingAnchor time.Time, unit int, period BillingPeriod) (time.Time, error)
- func ParseTime(t string) (time.Time, error)
- func ToNillableString(s string) *string
- func ToNillableTime(t time.Time) *time.Time
- type AggregationType
- type AuthProvider
- type BaseFilter
- type BaseModel
- type BillingCadence
- type BillingModel
- type BillingPeriod
- type BillingTier
- type ContextKey
- type CurrencyConfig
- type CustomerFilter
- func (f *CustomerFilter) GetExpand() Expand
- func (f *CustomerFilter) GetLimit() int
- func (f *CustomerFilter) GetOffset() int
- func (f *CustomerFilter) GetOrder() string
- func (f *CustomerFilter) GetSort() string
- func (f *CustomerFilter) GetStatus() string
- func (f *CustomerFilter) IsUnlimited() bool
- func (f CustomerFilter) Validate() error
- type EntitlementFilter
- func (f *EntitlementFilter) GetExpand() Expand
- func (f *EntitlementFilter) GetLimit() int
- func (f *EntitlementFilter) GetOffset() int
- func (f *EntitlementFilter) GetOrder() string
- func (f *EntitlementFilter) GetSort() string
- func (f *EntitlementFilter) GetStatus() string
- func (f *EntitlementFilter) IsUnlimited() bool
- func (f EntitlementFilter) Validate() error
- func (f *EntitlementFilter) WithExpand(expand string) *EntitlementFilter
- func (f *EntitlementFilter) WithFeatureID(featureID string) *EntitlementFilter
- func (f *EntitlementFilter) WithFeatureType(featureType FeatureType) *EntitlementFilter
- func (f *EntitlementFilter) WithIsEnabled(isEnabled bool) *EntitlementFilter
- func (f *EntitlementFilter) WithPlanIDs(planIDs []string) *EntitlementFilter
- func (f *EntitlementFilter) WithStatus(status Status) *EntitlementFilter
- type EnvironmentType
- type Expand
- type ExpandConfig
- type ExpandableField
- type FeatureFilter
- func (f *FeatureFilter) GetExpand() Expand
- func (f *FeatureFilter) GetLimit() int
- func (f *FeatureFilter) GetOffset() int
- func (f *FeatureFilter) GetOrder() string
- func (f *FeatureFilter) GetSort() string
- func (f *FeatureFilter) GetStatus() string
- func (f *FeatureFilter) IsUnlimited() bool
- func (f *FeatureFilter) Validate() error
- type FeatureType
- type Filter
- type InvoiceBillingReason
- type InvoiceCadence
- type InvoiceFilter
- func (f *InvoiceFilter) GetExpand() Expand
- func (f *InvoiceFilter) GetLimit() int
- func (f *InvoiceFilter) GetOffset() int
- func (f *InvoiceFilter) GetOrder() string
- func (f *InvoiceFilter) GetSort() string
- func (f *InvoiceFilter) GetStatus() string
- func (f *InvoiceFilter) IsUnlimited() bool
- func (f *InvoiceFilter) Validate() error
- type InvoicePaymentStatus
- type InvoiceStatus
- type InvoiceType
- type ListResponse
- type LogLevel
- type Metadata
- type MeterFilter
- func (f *MeterFilter) GetExpand() Expand
- func (f *MeterFilter) GetLimit() int
- func (f *MeterFilter) GetOffset() int
- func (f *MeterFilter) GetOrder() string
- func (f *MeterFilter) GetSort() string
- func (f *MeterFilter) GetStatus() string
- func (f *MeterFilter) IsUnlimited() bool
- func (f *MeterFilter) Validate() error
- type MeterSortField
- type PaginationResponse
- type PlanFilter
- func (f *PlanFilter) GetExpand() Expand
- func (f *PlanFilter) GetLimit() int
- func (f *PlanFilter) GetOffset() int
- func (f *PlanFilter) GetOrder() string
- func (f *PlanFilter) GetSort() string
- func (f *PlanFilter) GetStatus() string
- func (f *PlanFilter) IsUnlimited() bool
- func (f *PlanFilter) Validate() error
- type PriceFilter
- func (f *PriceFilter) GetExpand() Expand
- func (f *PriceFilter) GetLimit() int
- func (f *PriceFilter) GetOffset() int
- func (f *PriceFilter) GetOrder() string
- func (f *PriceFilter) GetSort() string
- func (f *PriceFilter) GetStatus() string
- func (f *PriceFilter) IsUnlimited() bool
- func (f PriceFilter) Validate() error
- func (f *PriceFilter) WithExpand(expand string) *PriceFilter
- func (f *PriceFilter) WithPlanIDs(planIDs []string) *PriceFilter
- func (f *PriceFilter) WithPriceIDs(priceIDs []string) *PriceFilter
- func (f *PriceFilter) WithStatus(status Status) *PriceFilter
- type PriceType
- type PubSubType
- type PublishDestination
- type QueryFilter
- func (f QueryFilter) GetExpand() Expand
- func (f QueryFilter) GetLimit() int
- func (f QueryFilter) GetOffset() int
- func (f QueryFilter) GetOrder() string
- func (f QueryFilter) GetSort() string
- func (f QueryFilter) GetStatus() string
- func (f QueryFilter) IsUnlimited() bool
- func (f *QueryFilter) Merge(other QueryFilter)
- func (f QueryFilter) Validate() error
- type ResetUsage
- type RunMode
- type Status
- type SubscriptionFilter
- func (f *SubscriptionFilter) GetExpand() Expand
- func (f *SubscriptionFilter) GetLimit() int
- func (f *SubscriptionFilter) GetOffset() int
- func (f *SubscriptionFilter) GetOrder() string
- func (f *SubscriptionFilter) GetSort() string
- func (f *SubscriptionFilter) GetStatus() string
- func (f *SubscriptionFilter) IsUnlimited() bool
- func (f SubscriptionFilter) Validate() error
- type SubscriptionLineItemFilter
- type SubscriptionStatus
- type TimeRangeFilter
- type TransactionStatus
- type TransactionType
- type WalletStatus
- type WalletTransactionFilter
- func (f *WalletTransactionFilter) GetExpand() Expand
- func (f *WalletTransactionFilter) GetLimit() int
- func (f *WalletTransactionFilter) GetOffset() int
- func (f *WalletTransactionFilter) GetOrder() string
- func (f *WalletTransactionFilter) GetSort() string
- func (f *WalletTransactionFilter) GetStatus() string
- func (f *WalletTransactionFilter) IsUnlimited() bool
- func (f WalletTransactionFilter) Validate() error
- type WebhookEvent
- type WindowSize
Constants ¶
const ( USD = "usd" EUR = "eur" GBP = "gbp" AUD = "aud" CAD = "cad" JPY = "jpy" INR = "inr" DEFAULT_PRECISION = 2 )
const ( FILTER_DEFAULT_LIMIT = 50 FILTER_DEFAULT_STATUS = string(StatusPublished) FILTER_DEFAULT_SORT = "created_at" FILTER_DEFAULT_ORDER = "desc" OrderDesc = "desc" OrderAsc = "asc" )
const ( HeaderEnvironment = "X-Environment-ID" HeaderRequestID = "X-Request-ID" HeaderAuthorization = "Authorization" )
const ( PRICE_TYPE_USAGE PriceType = "USAGE" PRICE_TYPE_FIXED PriceType = "FIXED" // Billing model for a flat fee per unit BILLING_MODEL_FLAT_FEE BillingModel = "FLAT_FEE" // Billing model for a package of units ex 1000 emails for $100 BILLING_MODEL_PACKAGE BillingModel = "PACKAGE" // Billing model for a tiered pricing model // ex 1-100 emails for $100, 101-1000 emails for $90 BILLING_MODEL_TIERED BillingModel = "TIERED" // For BILLING_CADENCE_RECURRING BILLING_PERIOD_MONTHLY BillingPeriod = "MONTHLY" BILLING_PERIOD_ANNUAL BillingPeriod = "ANNUAL" BILLING_PERIOD_WEEKLY BillingPeriod = "WEEKLY" BILLING_PERIOD_DAILY BillingPeriod = "DAILY" BILLING_CADENCE_RECURRING BillingCadence = "RECURRING" BILLING_CADENCE_ONETIME BillingCadence = "ONETIME" // BILLING_TIER_VOLUME means all units price based on final tier reached. BILLING_TIER_VOLUME BillingTier = "VOLUME" // BILLING_TIER_SLAB means Tiers apply progressively as quantity increases BILLING_TIER_SLAB BillingTier = "SLAB" // MAX_BILLING_AMOUNT is the maximum allowed billing amount (as a safeguard) MAX_BILLING_AMOUNT = 1000000000000 // 1 trillion // ROUND_UP rounds to the ceiling value ex 1.99 -> 2.00 ROUND_UP = "up" // ROUND_DOWN rounds to the floor value ex 1.99 -> 1.00 ROUND_DOWN = "down" // ROUND_NEAREST rounds to the nearest value ex ROUND_NEAREST = "nearest" // DEFAULT_FLOATING_PRECISION is the default floating point precision DEFAULT_FLOATING_PRECISION = 2 )
const ( UUID_PREFIX_EVENT = "event" UUID_PREFIX_METER = "meter" UUID_PREFIX_PLAN = "plan" UUID_PREFIX_PRICE = "price" UUID_PREFIX_INVOICE = "inv" UUID_PREFIX_INVOICE_LINE_ITEM = "inv_line" UUID_PREFIX_SUBSCRIPTION = "subs" UUID_PREFIX_SUBSCRIPTION_LINE_ITEM = "subs_line" UUID_PREFIX_CUSTOMER = "cust" UUID_PREFIX_WALLET = "wallet" UUID_PREFIX_ENVIRONMENT = "env" UUID_PREFIX_USER = "user" UUID_PREFIX_TENANT = "tenant" UUID_PREFIX_FEATURE = "feat" UUID_PREFIX_ENTITLEMENT = "ent" )
const ( WebhookEventInvoiceCreateDraft = "invoice.create.drafted" WebhookEventInvoiceUpdateFinalized = "invoice.update.finalized" WebhookEventInvoiceUpdatePayment = "invoice.updated.payment" WebhookEventInvoiceUpdateVoided = "invoice.update.voided" )
Common webhook event names
const (
InvoiceDefaultDueDays = 1
)
Variables ¶
var ( // PlanExpandConfig defines what can be expanded on a plan PlanExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandPrices, ExpandMeters, ExpandEntitlements}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandPrices: {ExpandMeters}, ExpandEntitlements: {ExpandFeatures}, }, } // PriceExpandConfig defines what can be expanded on a price PriceExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandMeters}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandMeters: {}}, } // SubscriptionExpandConfig defines what can be expanded on a subscription SubscriptionExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandPlan, ExpandPrices, ExpandMeters}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandPlan: {ExpandPrices}, ExpandPrices: {ExpandMeters}, }, } // EntitlementExpandConfig defines what can be expanded on an entitlement EntitlementExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandFeatures}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandFeatures: {}}, } )
Common expand configurations
var CURRENCY_CONFIG = map[string]CurrencyConfig{
USD: {Symbol: "$", Precision: 2},
EUR: {Symbol: "€", Precision: 2},
GBP: {Symbol: "£", Precision: 2},
AUD: {Symbol: "AUS", Precision: 2},
CAD: {Symbol: "CAD", Precision: 2},
JPY: {Symbol: "¥", Precision: 0},
INR: {Symbol: "₹", Precision: 2},
}
CurrencyConfig holds configuration for different currencies and their symbols
var FeatureExpandConfig = ExpandConfig{ AllowedFields: []ExpandableField{ExpandMeters}, NestedExpands: map[ExpandableField][]ExpandableField{ ExpandMeters: {}, }, }
FeatureExpandConfig defines the allowed expand fields for features
Functions ¶
func FormatTime ¶
func FromNillableString ¶
FromNillableString returns the string value or empty string if nil
func FromNillableTime ¶
FromNillableTime returns the time value or zero time if nil
func GenerateUUIDWithPrefix ¶
GenerateUUIDWithPrefix returns a k-sortable unique identifier with a prefix ex inv_0ujsswThIGTUYm2K8FjOOfXtY1K
func GetCurrencyPrecision ¶
GetCurrencyPrecision returns the precision for a given currency code if the code is not found, it returns the default precision of 2
func GetCurrencySymbol ¶
GetCurrencySymbol returns the symbol for a given currency code if the code is not found, it returns the code itself
func GetEnvironmentID ¶
func GetRequestID ¶
func GetTenantID ¶
func IsMatchingCurrency ¶
func IsValidEmail ¶
func NextBillingDate ¶
func NextBillingDate(currentPeriodStart, billingAnchor time.Time, unit int, period BillingPeriod) (time.Time, error)
NextBillingDate calculates the next billing date based on the current period start, billing anchor, billing period, and billing period unit. The billing anchor determines the reference point for billing cycles: - For MONTHLY periods, it sets the day of the month - For ANNUAL periods, it sets the month and day of the year - For WEEKLY/DAILY periods, it's used only for validation
func ToNillableString ¶
ToNillableString returns a pointer to the string if not empty, nil otherwise
Types ¶
type AggregationType ¶
type AggregationType string
AggregationType is a type for the type of aggregation to be performed on a meter This is used to determine which aggregator to use when querying the database
const ( AggregationCount AggregationType = "COUNT" AggregationSum AggregationType = "SUM" AggregationAvg AggregationType = "AVG" )
func (AggregationType) RequiresField ¶
func (t AggregationType) RequiresField() bool
RequiresField returns true if the aggregation type requires a field
func (AggregationType) Validate ¶
func (t AggregationType) Validate() bool
type AuthProvider ¶
type AuthProvider string
const ( AuthProviderFlexprice AuthProvider = "flexprice" AuthProviderSupabase AuthProvider = "supabase" )
type BaseFilter ¶
type BaseFilter interface { GetLimit() int GetOffset() int GetStatus() string GetSort() string GetOrder() string GetExpand() Expand Validate() error IsUnlimited() bool }
BaseFilter defines common filtering capabilities
type BaseModel ¶
type BaseModel struct { TenantID string `db:"tenant_id" json:"tenant_id"` Status Status `db:"status" json:"status"` CreatedAt time.Time `db:"created_at" json:"created_at"` UpdatedAt time.Time `db:"updated_at" json:"updated_at"` CreatedBy string `db:"created_by" json:"created_by"` UpdatedBy string `db:"updated_by" json:"updated_by"` }
BaseModel is a base model for all domain models that need to be persisted in the database Any changes to this model should be reflected in the database schema by running migrations
func GetDefaultBaseModel ¶
type BillingCadence ¶
type BillingCadence string
BillingCadence is the billing cadence for the price ex RECURRING, ONETIME
func (BillingCadence) Validate ¶
func (b BillingCadence) Validate() error
type BillingModel ¶
type BillingModel string
BillingModel is the billing model for the price ex FLAT_FEE, PACKAGE, TIERED
func (BillingModel) Validate ¶
func (b BillingModel) Validate() error
type BillingPeriod ¶
type BillingPeriod string
BillingPeriod is the billing period for the price ex MONTHLY, ANNUAL, WEEKLY, DAILY
func (BillingPeriod) Validate ¶
func (b BillingPeriod) Validate() error
type BillingTier ¶
type BillingTier string
BillingTier when Billing model is TIERED defines how to calculate the price for a given quantity
func (BillingTier) Validate ¶
func (b BillingTier) Validate() error
type ContextKey ¶
type ContextKey string
ContextKey is a type for the keys of values stored in the context
const ( CtxRequestID ContextKey = "ctx_request_id" CtxTenantID ContextKey = "ctx_tenant_id" CtxUserID ContextKey = "ctx_user_id" CtxJWT ContextKey = "ctx_jwt" CtxEnvironmentID ContextKey = "ctx_environment_id" CtxDBTransaction ContextKey = "ctx_db_transaction" // Default values DefaultTenantID = "00000000-0000-0000-0000-000000000000" DefaultUserID = "00000000-0000-0000-0000-000000000000" )
type CurrencyConfig ¶
func GetCurrencyConfig ¶
func GetCurrencyConfig(code string) CurrencyConfig
type CustomerFilter ¶
type CustomerFilter struct { *QueryFilter *TimeRangeFilter CustomerIDs []string `json:"customer_ids,omitempty" form:"customer_ids" validate:"omitempty"` ExternalID string `json:"external_id,omitempty" form:"external_id" validate:"omitempty"` Email string `json:"email,omitempty" form:"email" validate:"omitempty,email"` }
CustomerFilter represents filters for customer queries
func NewCustomerFilter ¶
func NewCustomerFilter() *CustomerFilter
NewCustomerFilter creates a new CustomerFilter with default values
func NewNoLimitCustomerFilter ¶
func NewNoLimitCustomerFilter() *CustomerFilter
NewNoLimitCustomerFilter creates a new CustomerFilter with no pagination limits
func (*CustomerFilter) GetExpand ¶
func (f *CustomerFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*CustomerFilter) GetLimit ¶
func (f *CustomerFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*CustomerFilter) GetOffset ¶
func (f *CustomerFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*CustomerFilter) GetOrder ¶
func (f *CustomerFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*CustomerFilter) GetSort ¶
func (f *CustomerFilter) GetSort() string
GetSort implements BaseFilter interface
func (*CustomerFilter) GetStatus ¶
func (f *CustomerFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*CustomerFilter) IsUnlimited ¶
func (f *CustomerFilter) IsUnlimited() bool
func (CustomerFilter) Validate ¶
func (f CustomerFilter) Validate() error
Validate validates the customer filter
type EntitlementFilter ¶
type EntitlementFilter struct { *QueryFilter *TimeRangeFilter // Specific filters for entitlements PlanIDs []string `form:"plan_ids" json:"plan_ids,omitempty"` FeatureIDs []string `form:"feature_ids" json:"feature_ids,omitempty"` FeatureType *FeatureType `form:"feature_type" json:"feature_type,omitempty"` IsEnabled *bool `form:"is_enabled" json:"is_enabled,omitempty"` }
EntitlementFilter defines filters for querying entitlements
func NewDefaultEntitlementFilter ¶
func NewDefaultEntitlementFilter() *EntitlementFilter
NewDefaultEntitlementFilter creates a new EntitlementFilter with default values
func NewNoLimitEntitlementFilter ¶
func NewNoLimitEntitlementFilter() *EntitlementFilter
NewNoLimitEntitlementFilter creates a new EntitlementFilter with no pagination limits
func (*EntitlementFilter) GetExpand ¶
func (f *EntitlementFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*EntitlementFilter) GetLimit ¶
func (f *EntitlementFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*EntitlementFilter) GetOffset ¶
func (f *EntitlementFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*EntitlementFilter) GetOrder ¶
func (f *EntitlementFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*EntitlementFilter) GetSort ¶
func (f *EntitlementFilter) GetSort() string
GetSort implements BaseFilter interface
func (*EntitlementFilter) GetStatus ¶
func (f *EntitlementFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*EntitlementFilter) IsUnlimited ¶
func (f *EntitlementFilter) IsUnlimited() bool
IsUnlimited returns true if this is an unlimited query
func (EntitlementFilter) Validate ¶
func (f EntitlementFilter) Validate() error
Validate validates the filter fields
func (*EntitlementFilter) WithExpand ¶
func (f *EntitlementFilter) WithExpand(expand string) *EntitlementFilter
WithExpand sets the expand on the filter
func (*EntitlementFilter) WithFeatureID ¶
func (f *EntitlementFilter) WithFeatureID(featureID string) *EntitlementFilter
WithFeatureID adds feature ID to the filter
func (*EntitlementFilter) WithFeatureType ¶
func (f *EntitlementFilter) WithFeatureType(featureType FeatureType) *EntitlementFilter
WithFeatureType adds feature type to the filter
func (*EntitlementFilter) WithIsEnabled ¶
func (f *EntitlementFilter) WithIsEnabled(isEnabled bool) *EntitlementFilter
WithIsEnabled adds is_enabled to the filter
func (*EntitlementFilter) WithPlanIDs ¶
func (f *EntitlementFilter) WithPlanIDs(planIDs []string) *EntitlementFilter
WithPlanIDs adds plan IDs to the filter
func (*EntitlementFilter) WithStatus ¶
func (f *EntitlementFilter) WithStatus(status Status) *EntitlementFilter
WithStatus sets the status on the filter
type EnvironmentType ¶
type EnvironmentType string
EnvironmentType defines the type of environment.
const ( EnvironmentDevelopment EnvironmentType = "development" EnvironmentTesting EnvironmentType = "testing" EnvironmentProduction EnvironmentType = "production" )
type Expand ¶
type Expand struct { Fields map[ExpandableField]bool NestedExpands map[ExpandableField]Expand }
Expand represents the expand parameter in API requests
func (Expand) GetNested ¶
func (e Expand) GetNested(field ExpandableField) Expand
GetNested returns the nested expands for a field
func (Expand) Has ¶
func (e Expand) Has(field ExpandableField) bool
Has checks if a field should be expanded
func (Expand) Validate ¶
func (e Expand) Validate(config ExpandConfig) error
Validate checks if the expand request is valid according to the config
type ExpandConfig ¶
type ExpandConfig struct { // AllowedFields are the fields that can be expanded at this level AllowedFields []ExpandableField // NestedExpands defines which fields can be expanded within an expanded field NestedExpands map[ExpandableField][]ExpandableField }
ExpandConfig defines which fields can be expanded and their nested expansions
type ExpandableField ¶
type ExpandableField string
ExpandableField represents a field that can be expanded in API responses
const ( ExpandPrices ExpandableField = "prices" ExpandPlan ExpandableField = "plan" ExpandMeters ExpandableField = "meters" ExpandFeatures ExpandableField = "features" ExpandPlans ExpandableField = "plans" ExpandEntitlements ExpandableField = "entitlements" )
Common expandable fields
type FeatureFilter ¶
type FeatureFilter struct { *QueryFilter *TimeRangeFilter // Feature specific filters FeatureIDs []string `form:"feature_ids" json:"feature_ids"` LookupKey string `form:"lookup_key" json:"lookup_key"` }
func NewDefaultFeatureFilter ¶
func NewDefaultFeatureFilter() *FeatureFilter
func NewNoLimitFeatureFilter ¶
func NewNoLimitFeatureFilter() *FeatureFilter
func (*FeatureFilter) GetExpand ¶
func (f *FeatureFilter) GetExpand() Expand
GetExpand returns the expand filter
func (*FeatureFilter) GetLimit ¶
func (f *FeatureFilter) GetLimit() int
func (*FeatureFilter) GetOffset ¶
func (f *FeatureFilter) GetOffset() int
func (*FeatureFilter) GetOrder ¶
func (f *FeatureFilter) GetOrder() string
func (*FeatureFilter) GetSort ¶
func (f *FeatureFilter) GetSort() string
func (*FeatureFilter) GetStatus ¶
func (f *FeatureFilter) GetStatus() string
func (*FeatureFilter) IsUnlimited ¶
func (f *FeatureFilter) IsUnlimited() bool
func (*FeatureFilter) Validate ¶
func (f *FeatureFilter) Validate() error
type FeatureType ¶
type FeatureType string
const ( FeatureTypeMetered FeatureType = "metered" FeatureTypeBoolean FeatureType = "boolean" FeatureTypeStatic FeatureType = "static" )
func (FeatureType) String ¶
func (f FeatureType) String() string
func (FeatureType) Validate ¶
func (f FeatureType) Validate() error
type Filter ¶
type Filter struct { Limit int `form:"limit,default=50"` Offset int `form:"offset,default=0"` Status Status `form:"status,default=published"` Sort string `form:"sort,default=created_at"` Order string `form:"order,default=desc"` Expand string `form:"expand"` }
TODO : deprecate
type InvoiceBillingReason ¶
type InvoiceBillingReason string
const ( // InvoiceBillingReasonSubscriptionCreate indicates invoice is for subscription creation InvoiceBillingReasonSubscriptionCreate InvoiceBillingReason = "SUBSCRIPTION_CREATE" // InvoiceBillingReasonSubscriptionCycle indicates invoice is for subscription renewal InvoiceBillingReasonSubscriptionCycle InvoiceBillingReason = "SUBSCRIPTION_CYCLE" // InvoiceBillingReasonSubscriptionUpdate indicates invoice is for subscription update InvoiceBillingReasonSubscriptionUpdate InvoiceBillingReason = "SUBSCRIPTION_UPDATE" // InvoiceBillingReasonManual indicates invoice is created manually InvoiceBillingReasonManual InvoiceBillingReason = "MANUAL" )
func (InvoiceBillingReason) String ¶
func (r InvoiceBillingReason) String() string
func (InvoiceBillingReason) Validate ¶
func (r InvoiceBillingReason) Validate() error
type InvoiceCadence ¶
type InvoiceCadence string
const ( // InvoiceCadenceArrear raises an invoice at the end of each billing period (in arrears) InvoiceCadenceArrear InvoiceCadence = "ARREAR" // InvoiceCadenceAdvance raises an invoice at the beginning of each billing period (in advance) InvoiceCadenceAdvance InvoiceCadence = "ADVANCE" )
func (InvoiceCadence) String ¶
func (c InvoiceCadence) String() string
func (InvoiceCadence) Validate ¶
func (c InvoiceCadence) Validate() error
type InvoiceFilter ¶
type InvoiceFilter struct { *QueryFilter *TimeRangeFilter CustomerID string `json:"customer_id,omitempty" form:"customer_id"` SubscriptionID string `json:"subscription_id,omitempty" form:"subscription_id"` InvoiceType InvoiceType `json:"invoice_type,omitempty" form:"invoice_type"` InvoiceStatus []InvoiceStatus `json:"invoice_status,omitempty" form:"invoice_status"` PaymentStatus []InvoicePaymentStatus `json:"payment_status,omitempty" form:"payment_status"` }
InvoiceFilter represents the filter options for listing invoices
func NewInvoiceFilter ¶
func NewInvoiceFilter() *InvoiceFilter
NewInvoiceFilter creates a new invoice filter with default options
func NewNoLimitInvoiceFilter ¶
func NewNoLimitInvoiceFilter() *InvoiceFilter
NewNoLimitInvoiceFilter creates a new invoice filter without pagination
func (*InvoiceFilter) GetExpand ¶
func (f *InvoiceFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*InvoiceFilter) GetLimit ¶
func (f *InvoiceFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*InvoiceFilter) GetOffset ¶
func (f *InvoiceFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*InvoiceFilter) GetOrder ¶
func (f *InvoiceFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*InvoiceFilter) GetSort ¶
func (f *InvoiceFilter) GetSort() string
GetSort implements BaseFilter interface
func (*InvoiceFilter) GetStatus ¶
func (f *InvoiceFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*InvoiceFilter) IsUnlimited ¶
func (f *InvoiceFilter) IsUnlimited() bool
func (*InvoiceFilter) Validate ¶
func (f *InvoiceFilter) Validate() error
Validate validates the invoice filter
type InvoicePaymentStatus ¶
type InvoicePaymentStatus string
const ( // InvoicePaymentStatusPending indicates payment is pending InvoicePaymentStatusPending InvoicePaymentStatus = "PENDING" // InvoicePaymentStatusSucceeded indicates payment was successful InvoicePaymentStatusSucceeded InvoicePaymentStatus = "SUCCEEDED" // InvoicePaymentStatusFailed indicates payment failed InvoicePaymentStatusFailed InvoicePaymentStatus = "FAILED" )
func (InvoicePaymentStatus) String ¶
func (s InvoicePaymentStatus) String() string
func (InvoicePaymentStatus) Validate ¶
func (s InvoicePaymentStatus) Validate() error
type InvoiceStatus ¶
type InvoiceStatus string
const ( // InvoiceStatusDraft indicates invoice is in draft state and can be modified InvoiceStatusDraft InvoiceStatus = "DRAFT" // InvoiceStatusFinalized indicates invoice is finalized and ready for payment InvoiceStatusFinalized InvoiceStatus = "FINALIZED" // InvoiceStatusVoided indicates invoice has been voided InvoiceStatusVoided InvoiceStatus = "VOIDED" )
func (InvoiceStatus) String ¶
func (s InvoiceStatus) String() string
func (InvoiceStatus) Validate ¶
func (s InvoiceStatus) Validate() error
type InvoiceType ¶
type InvoiceType string
const ( // InvoiceTypeSubscription indicates invoice is for subscription charges InvoiceTypeSubscription InvoiceType = "SUBSCRIPTION" // InvoiceTypeOneOff indicates invoice is for one-time charges InvoiceTypeOneOff InvoiceType = "ONE_OFF" // InvoiceTypeCredit indicates invoice is for credit adjustments InvoiceTypeCredit InvoiceType = "CREDIT" )
func (InvoiceType) String ¶
func (t InvoiceType) String() string
func (InvoiceType) Validate ¶
func (t InvoiceType) Validate() error
type ListResponse ¶
type ListResponse[T any] struct { Items []T `json:"items"` Pagination PaginationResponse `json:"pagination"` }
ListResponse represents a paginated response with items
func NewListResponse ¶
func NewListResponse[T any](items []T, total, limit, offset int) ListResponse[T]
NewListResponse creates a new list response with pagination
type Metadata ¶
Metadata represents a JSONB field for storing key-value pairs
type MeterFilter ¶
type MeterFilter struct { *QueryFilter *TimeRangeFilter EventName string `json:"event_name,omitempty"` MeterIDs []string `json:"meter_ids,omitempty"` }
MeterFilter represents the filter options for meter queries
func NewMeterFilter ¶
func NewMeterFilter() *MeterFilter
NewMeterFilter creates a new MeterFilter with default values
func NewNoLimitMeterFilter ¶
func NewNoLimitMeterFilter() *MeterFilter
NewNoLimitMeterFilter creates a new MeterFilter with no pagination limits
func (*MeterFilter) GetExpand ¶
func (f *MeterFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*MeterFilter) GetLimit ¶
func (f *MeterFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*MeterFilter) GetOffset ¶
func (f *MeterFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*MeterFilter) GetOrder ¶
func (f *MeterFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*MeterFilter) GetSort ¶
func (f *MeterFilter) GetSort() string
GetSort implements BaseFilter interface
func (*MeterFilter) GetStatus ¶
func (f *MeterFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*MeterFilter) IsUnlimited ¶
func (f *MeterFilter) IsUnlimited() bool
func (*MeterFilter) Validate ¶
func (f *MeterFilter) Validate() error
Validate validates the meter filter
type MeterSortField ¶
type MeterSortField string
MeterSortField represents the available fields for sorting meters
const ( MeterSortFieldCreatedAt MeterSortField = "created_at" MeterSortFieldName MeterSortField = "name" MeterSortFieldEventName MeterSortField = "event_name" )
type PaginationResponse ¶
type PaginationResponse struct { Total int `json:"total"` Limit int `json:"limit"` Offset int `json:"offset"` }
PaginationResponse represents standardized pagination metadata
func NewPaginationResponse ¶
func NewPaginationResponse(total, limit, offset int) PaginationResponse
NewPaginationResponse creates a new pagination response
type PlanFilter ¶
type PlanFilter struct { *QueryFilter *TimeRangeFilter PlanIDs []string `json:"plan_ids,omitempty" form:"plan_ids"` }
PlanFilter represents the filter options for plans
func NewNoLimitPlanFilter ¶
func NewNoLimitPlanFilter() *PlanFilter
NewNoLimitPlanFilter creates a new plan filter without pagination
func NewPlanFilter ¶
func NewPlanFilter() *PlanFilter
NewPlanFilter creates a new plan filter with default options
func (*PlanFilter) GetExpand ¶
func (f *PlanFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*PlanFilter) GetLimit ¶
func (f *PlanFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*PlanFilter) GetOffset ¶
func (f *PlanFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*PlanFilter) GetOrder ¶
func (f *PlanFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*PlanFilter) GetSort ¶
func (f *PlanFilter) GetSort() string
GetSort implements BaseFilter interface
func (*PlanFilter) GetStatus ¶
func (f *PlanFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*PlanFilter) IsUnlimited ¶
func (f *PlanFilter) IsUnlimited() bool
func (*PlanFilter) Validate ¶
func (f *PlanFilter) Validate() error
Validate validates the filter options
type PriceFilter ¶
type PriceFilter struct { *QueryFilter *TimeRangeFilter PlanIDs []string `json:"plan_ids,omitempty" form:"plan_ids"` PriceIDs []string `json:"price_ids,omitempty" form:"price_ids"` }
PriceFilter represents filters for price queries
func NewNoLimitPriceFilter ¶
func NewNoLimitPriceFilter() *PriceFilter
NewNoLimitPriceFilter creates a new PriceFilter with no pagination limits
func NewPriceFilter ¶
func NewPriceFilter() *PriceFilter
NewPriceFilter creates a new PriceFilter with default values
func (*PriceFilter) GetExpand ¶
func (f *PriceFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*PriceFilter) GetLimit ¶
func (f *PriceFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*PriceFilter) GetOffset ¶
func (f *PriceFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*PriceFilter) GetOrder ¶
func (f *PriceFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*PriceFilter) GetSort ¶
func (f *PriceFilter) GetSort() string
GetSort implements BaseFilter interface
func (*PriceFilter) GetStatus ¶
func (f *PriceFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*PriceFilter) IsUnlimited ¶
func (f *PriceFilter) IsUnlimited() bool
func (PriceFilter) Validate ¶
func (f PriceFilter) Validate() error
func (*PriceFilter) WithExpand ¶
func (f *PriceFilter) WithExpand(expand string) *PriceFilter
WithExpand sets the expand field on the filter
func (*PriceFilter) WithPlanIDs ¶
func (f *PriceFilter) WithPlanIDs(planIDs []string) *PriceFilter
WithPlanIDs adds plan IDs to the filter
func (*PriceFilter) WithPriceIDs ¶
func (f *PriceFilter) WithPriceIDs(priceIDs []string) *PriceFilter
WithPriceIDs adds price IDs to the filter
func (*PriceFilter) WithStatus ¶
func (f *PriceFilter) WithStatus(status Status) *PriceFilter
WithStatus sets the status on the filter
type PubSubType ¶
type PubSubType string
PubSubType represents the type of pubsub system
const ( MemoryPubSub PubSubType = "memory" KafkaPubSub PubSubType = "kafka" )
type PublishDestination ¶
type PublishDestination string
PublishDestination determines where to publish events
const ( PublishToKafka PublishDestination = "kafka" PublishToDynamoDB PublishDestination = "dynamodb" PublishToAll PublishDestination = "all" )
type QueryFilter ¶
type QueryFilter struct { Limit *int `json:"limit,omitempty" form:"limit" validate:"omitempty,min=1,max=1000"` Offset *int `json:"offset,omitempty" form:"offset" validate:"omitempty,min=0"` Status *Status `json:"status,omitempty" form:"status"` Sort *string `json:"sort,omitempty" form:"sort"` Order *string `json:"order,omitempty" form:"order" validate:"omitempty,oneof=asc desc"` Expand *string `json:"expand,omitempty" form:"expand"` }
QueryFilter represents a generic query filter with optional fields
func NewDefaultQueryFilter ¶
func NewDefaultQueryFilter() *QueryFilter
DefaultQueryFilter defines default values for query filters
func NewNoLimitQueryFilter ¶
func NewNoLimitQueryFilter() *QueryFilter
NoLimitQueryFilter returns a filter with no pagination limits
func (QueryFilter) GetExpand ¶
func (f QueryFilter) GetExpand() Expand
GetExpand returns the parsed Expand object from the filter
func (QueryFilter) GetLimit ¶
func (f QueryFilter) GetLimit() int
GetLimit returns the limit value or default if not set
func (QueryFilter) GetOffset ¶
func (f QueryFilter) GetOffset() int
GetOffset returns the offset value or default if not set
func (QueryFilter) GetOrder ¶
func (f QueryFilter) GetOrder() string
GetOrder returns the order value or default if not set
func (QueryFilter) GetSort ¶
func (f QueryFilter) GetSort() string
GetSort returns the sort value or default if not set
func (QueryFilter) GetStatus ¶
func (f QueryFilter) GetStatus() string
GetStatus returns the status value or default if not set
func (QueryFilter) IsUnlimited ¶
func (f QueryFilter) IsUnlimited() bool
IsUnlimited returns true if this is an unlimited query
func (*QueryFilter) Merge ¶
func (f *QueryFilter) Merge(other QueryFilter)
Merge merges another filter into this one, taking values from other if they are set
func (QueryFilter) Validate ¶
func (f QueryFilter) Validate() error
Validate validates the filter fields
type ResetUsage ¶
type ResetUsage string
const ( ResetUsageBillingPeriod ResetUsage = "BILLING_PERIOD" ResetUsageNever ResetUsage = "NEVER" )
type RunMode ¶
type RunMode string
const ( // ModeLocal is the mode for running both the API server and the consumer locally ModeLocal RunMode = "local" // ModeAPI is the mode for running just the API server ModeAPI RunMode = "api" // ModeConsumer is the mode for running just the consumer ModeConsumer RunMode = "consumer" // ModeAWSLambdaAPI is the mode for running the API server in AWS Lambda ModeAWSLambdaAPI RunMode = "aws_lambda_api" // ModeAWSLambdaConsumer is the mode for running the consumer in AWS Lambda ModeAWSLambdaConsumer RunMode = "aws_lambda_consumer" )
type Status ¶
type Status string
Status is a type for the status of a resource (e.g. meter, event) in the Database This is used to track the lifecycle of a resource and to determine if it should be included in queries Any changes to this type should be reflected in the database schema by running migrations
const ( // StatusPublished is the status of a resource that is published and visible to users StatusPublished Status = "published" // StatusDeleted is the status of a resource that is deleted and not in use // This is typically used for data that is no longer in use and should be removed from the database // These rows should not be returned in queries and should not be visible to users StatusDeleted Status = "deleted" // StatusArchived is the status of a resource that is archived and not in use // This is typically used for data that is no longer in use but we want to keep for historical purposes // These rows might be returned in queries and might be visible to users in some cases only StatusArchived Status = "archived" )
type SubscriptionFilter ¶
type SubscriptionFilter struct { *QueryFilter *TimeRangeFilter // CustomerID filters by customer ID CustomerID string `json:"customer_id,omitempty" form:"customer_id"` // PlanID filters by plan ID PlanID string `json:"plan_id,omitempty" form:"plan_id"` // SubscriptionStatus filters by subscription status SubscriptionStatus []SubscriptionStatus `json:"subscription_status,omitempty" form:"subscription_status"` // InvoiceCadence filters by invoice cadence InvoiceCadence []InvoiceCadence `json:"invoice_cadence,omitempty" form:"invoice_cadence"` // BillingCadence filters by billing cadence BillingCadence []BillingCadence `json:"billing_cadence,omitempty" form:"billing_cadence"` // BillingPeriod filters by billing period BillingPeriod []BillingPeriod `json:"billing_period,omitempty" form:"billing_period"` // IncludeCanceled includes canceled subscriptions if true IncludeCanceled bool `json:"include_canceled,omitempty" form:"include_canceled"` // ActiveAt filters subscriptions that are active at the given time ActiveAt *time.Time `json:"active_at,omitempty" form:"active_at"` }
SubscriptionFilter represents filters for subscription queries
func NewNoLimitSubscriptionFilter ¶
func NewNoLimitSubscriptionFilter() *SubscriptionFilter
NewNoLimitSubscriptionFilter creates a new SubscriptionFilter with no pagination limits
func NewSubscriptionFilter ¶
func NewSubscriptionFilter() *SubscriptionFilter
NewSubscriptionFilter creates a new SubscriptionFilter with default values
func (*SubscriptionFilter) GetExpand ¶
func (f *SubscriptionFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*SubscriptionFilter) GetLimit ¶
func (f *SubscriptionFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*SubscriptionFilter) GetOffset ¶
func (f *SubscriptionFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*SubscriptionFilter) GetOrder ¶
func (f *SubscriptionFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*SubscriptionFilter) GetSort ¶
func (f *SubscriptionFilter) GetSort() string
GetSort implements BaseFilter interface
func (*SubscriptionFilter) GetStatus ¶
func (f *SubscriptionFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*SubscriptionFilter) IsUnlimited ¶
func (f *SubscriptionFilter) IsUnlimited() bool
func (SubscriptionFilter) Validate ¶
func (f SubscriptionFilter) Validate() error
Validate validates the subscription filter
type SubscriptionLineItemFilter ¶
type SubscriptionLineItemFilter struct { *QueryFilter *TimeRangeFilter // Specific filters SubscriptionIDs []string CustomerIDs []string PlanIDs []string PriceIDs []string MeterIDs []string Currencies []string BillingPeriods []string }
SubscriptionLineItemFilter defines filters for querying subscription line items
type SubscriptionStatus ¶
type SubscriptionStatus string
SubscriptionStatus is the status of a subscription For now taking inspiration from Stripe's subscription statuses https://stripe.com/docs/api/subscriptions/object#subscription_object-status
const ( SubscriptionStatusActive SubscriptionStatus = "active" SubscriptionStatusPaused SubscriptionStatus = "paused" SubscriptionStatusCancelled SubscriptionStatus = "cancelled" SubscriptionStatusIncomplete SubscriptionStatus = "incomplete" SubscriptionStatusIncompleteExpired SubscriptionStatus = "incomplete_expired" SubscriptionStatusPastDue SubscriptionStatus = "past_due" SubscriptionStatusTrialing SubscriptionStatus = "trialing" SubscriptionStatusUnpaid SubscriptionStatus = "unpaid" )
func (SubscriptionStatus) String ¶
func (s SubscriptionStatus) String() string
func (SubscriptionStatus) Validate ¶
func (s SubscriptionStatus) Validate() error
type TimeRangeFilter ¶
type TimeRangeFilter struct { StartTime *time.Time `json:"start_time,omitempty" form:"start_time" validate:"omitempty,time_rfc3339"` EndTime *time.Time `json:"end_time,omitempty" form:"end_time" validate:"omitempty,time_rfc3339"` }
TimeRangeFilter adds time range filtering capabilities
func (TimeRangeFilter) Validate ¶
func (f TimeRangeFilter) Validate() error
Validate validates the time range filter
type TransactionStatus ¶
type TransactionStatus string
TransactionStatus represents the status of a wallet transaction
const ( TransactionStatusPending TransactionStatus = "pending" TransactionStatusCompleted TransactionStatus = "completed" TransactionStatusFailed TransactionStatus = "failed" )
func (TransactionStatus) String ¶
func (t TransactionStatus) String() string
func (TransactionStatus) Validate ¶
func (t TransactionStatus) Validate() error
type TransactionType ¶
type TransactionType string
TransactionType represents the type of wallet transaction
const ( TransactionTypeCredit TransactionType = "credit" TransactionTypeDebit TransactionType = "debit" )
func (TransactionType) String ¶
func (t TransactionType) String() string
func (TransactionType) Validate ¶
func (t TransactionType) Validate() error
type WalletStatus ¶
type WalletStatus string
WalletStatus represents the current state of a wallet
const ( WalletStatusActive WalletStatus = "active" WalletStatusFrozen WalletStatus = "frozen" WalletStatusClosed WalletStatus = "closed" )
type WalletTransactionFilter ¶
type WalletTransactionFilter struct { *QueryFilter *TimeRangeFilter WalletID *string `json:"wallet_id,omitempty"` Type *TransactionType `json:"type,omitempty"` TransactionStatus *TransactionStatus `json:"transaction_status,omitempty"` ReferenceType *string `json:"reference_type,omitempty"` ReferenceID *string `json:"reference_id,omitempty"` }
func NewNoLimitWalletTransactionFilter ¶
func NewNoLimitWalletTransactionFilter() *WalletTransactionFilter
func NewWalletTransactionFilter ¶
func NewWalletTransactionFilter() *WalletTransactionFilter
func (*WalletTransactionFilter) GetExpand ¶
func (f *WalletTransactionFilter) GetExpand() Expand
GetExpand implements BaseFilter interface
func (*WalletTransactionFilter) GetLimit ¶
func (f *WalletTransactionFilter) GetLimit() int
GetLimit implements BaseFilter interface
func (*WalletTransactionFilter) GetOffset ¶
func (f *WalletTransactionFilter) GetOffset() int
GetOffset implements BaseFilter interface
func (*WalletTransactionFilter) GetOrder ¶
func (f *WalletTransactionFilter) GetOrder() string
GetOrder implements BaseFilter interface
func (*WalletTransactionFilter) GetSort ¶
func (f *WalletTransactionFilter) GetSort() string
GetSort implements BaseFilter interface
func (*WalletTransactionFilter) GetStatus ¶
func (f *WalletTransactionFilter) GetStatus() string
GetStatus implements BaseFilter interface
func (*WalletTransactionFilter) IsUnlimited ¶
func (f *WalletTransactionFilter) IsUnlimited() bool
func (WalletTransactionFilter) Validate ¶
func (f WalletTransactionFilter) Validate() error
type WebhookEvent ¶
type WebhookEvent struct { ID string `json:"id"` EventName string `json:"event_name"` TenantID string `json:"tenant_id"` Timestamp time.Time `json:"timestamp"` Payload json.RawMessage `json:"payload"` }
WebhookEvent represents a webhook event to be delivered
type WindowSize ¶
type WindowSize string
const ( WindowSizeMinute WindowSize = "MINUTE" WindowSizeHour WindowSize = "HOUR" WindowSizeDay WindowSize = "DAY" )
Note: keep values up to date in the meter package
func (WindowSize) Validate ¶
func (w WindowSize) Validate() error
Source Files
¶
- aggregation.go
- auth.go
- basemodel.go
- config.go
- context.go
- currency.go
- customer.go
- date.go
- email.go
- entitlement.go
- environment.go
- expand.go
- feature.go
- filter.go
- header.go
- helpers.go
- invoice.go
- metadata.go
- meter.go
- pagination.go
- plan.go
- price.go
- publisher.go
- pubsub.go
- reset_usage.go
- status.go
- subscription.go
- subscription_line_item_filter.go
- time.go
- transaction.go
- uuid.go
- wallet.go
- webhook.go
- window_size.go