Documentation
¶
Index ¶
- func ValidateAddress(address Address) error
- func ValidateAddressCountry(country string) bool
- type Address
- type AggregatedEntitlement
- type AggregatedFeature
- type AssignTenantRequest
- type AuthResponse
- type BillingPeriodInfo
- type BulkIngestEventRequest
- type CreateAPIKeyRequest
- type CreateAPIKeyResponse
- type CreateCustomerRequest
- type CreateEntitlementRequest
- type CreateEnvironmentRequest
- type CreateFeatureRequest
- type CreateIntegrationRequest
- type CreateInvoiceLineItemRequest
- type CreateInvoiceRequest
- type CreateMeterRequest
- type CreatePaymentRequest
- type CreatePlanEntitlementRequest
- type CreatePlanPriceRequest
- type CreatePlanRequest
- type CreatePlanResponse
- type CreatePriceRequest
- type CreatePriceTier
- type CreateSubscriptionInvoiceRequest
- type CreateSubscriptionRequest
- type CreateTaskRequest
- type CreateTenantRequest
- type CreateWalletRequest
- type CustomerEntitlementsResponse
- type CustomerInvoiceSummary
- type CustomerMultiCurrencyInvoiceSummary
- type CustomerResponse
- type CustomerUsageSummaryResponse
- type EntitlementResponse
- type EntitlementSource
- type EnvironmentResponse
- type Event
- type ExpiredCreditsResponse
- type ExpiredCreditsResponseItem
- type FeatureResponse
- type FeatureUsageSummary
- type GetCustomerEntitlementsRequest
- type GetCustomerUsageSummaryRequest
- type GetEventsRequest
- type GetEventsResponse
- type GetPreviewInvoiceRequest
- type GetUsageByMeterRequest
- type GetUsageBySubscriptionRequest
- type GetUsageBySubscriptionResponse
- type GetUsageRequest
- type GetUsageResponse
- type IngestEventRequest
- type InvoiceLineItemResponse
- type InvoiceResponse
- type LinkedIntegrationsResponse
- type ListCustomersResponse
- type ListEntitlementsResponse
- type ListEnvironmentsResponse
- type ListFeaturesResponse
- type ListInvoicesResponse
- type ListMetersResponse
- type ListPaymentsResponse
- type ListPlansResponse
- type ListPricesResponse
- type ListSecretsResponse
- type ListSubscriptionPausesResponse
- type ListSubscriptionsResponse
- type ListTasksResponse
- type ListWalletTransactionsResponse
- type LoginRequest
- type MeterResponse
- type OnboardingEventsRequest
- type OnboardingEventsResponse
- type PauseSubscriptionRequest
- type PauseSubscriptionResponse
- type PaymentAttemptResponse
- type PaymentResponse
- type PlanResponse
- type PriceResponse
- type ResumeSubscriptionRequest
- type ResumeSubscriptionResponse
- type SecretResponse
- type SignUpRequest
- type SubscriptionLineItemRequest
- type SubscriptionLineItemResponse
- type SubscriptionPauseResponse
- type SubscriptionResponse
- type SubscriptionUpdatePeriodResponse
- type SubscriptionUpdatePeriodResponseItem
- type SubscriptionUsageByMetersResponse
- type SuccessResponse
- type TaskResponse
- type TenantBillingDetails
- type TenantBillingUsage
- type TenantResponse
- type TopUpWalletRequest
- type UpdateCustomerRequest
- type UpdateEntitlementRequest
- type UpdateEnvironmentRequest
- type UpdateFeatureRequest
- type UpdateInvoicePaymentRequest
- type UpdateMeterRequest
- type UpdatePaymentRequest
- type UpdatePaymentStatusRequest
- type UpdatePlanEntitlementRequest
- type UpdatePlanPriceRequest
- type UpdatePlanRequest
- type UpdatePriceRequest
- type UpdateSubscriptionRequest
- type UpdateTaskStatusRequest
- type UpdateTenantRequest
- type UpdateWalletRequest
- type UsageResult
- type UserResponse
- type WalletBalanceResponse
- type WalletResponse
- type WalletTransactionResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateAddress ¶ added in v1.0.0
ValidateAddress validates all address fields
func ValidateAddressCountry ¶ added in v1.0.0
ValidateAddressCountry validates the country code format
Types ¶
type Address ¶ added in v1.0.0
type Address struct {
Line1 string `json:"address_line1" validate:"omitempty,max=255"`
Line2 string `json:"address_line2" validate:"omitempty,max=255"`
City string `json:"address_city" validate:"omitempty,max=100"`
State string `json:"address_state" validate:"omitempty,max=100"`
PostalCode string `json:"address_postal_code" validate:"omitempty,max=20"`
Country string `json:"address_country" validate:"omitempty,len=2,iso3166_1_alpha2"`
}
Address represents a physical address
type AggregatedEntitlement ¶ added in v1.0.0
type AggregatedEntitlement struct {
IsEnabled bool `json:"is_enabled"`
UsageLimit *int64 `json:"usage_limit,omitempty"`
IsSoftLimit bool `json:"is_soft_limit"`
UsageResetPeriod types.BillingPeriod `json:"usage_reset_period,omitempty"`
StaticValues []string `json:"static_values,omitempty"` // For static/SLA features
}
AggregatedEntitlement contains the final calculated entitlement values
type AggregatedFeature ¶ added in v1.0.0
type AggregatedFeature struct {
Feature *FeatureResponse `json:"feature"`
Entitlement *AggregatedEntitlement `json:"entitlement"`
Sources []*EntitlementSource `json:"sources"`
}
AggregatedFeature represents a feature with its aggregated entitlements
type AssignTenantRequest ¶
type AuthResponse ¶
type BillingPeriodInfo ¶ added in v1.0.0
type BillingPeriodInfo struct {
StartTime time.Time `json:"start_time"`
EndTime time.Time `json:"end_time"`
Period string `json:"period"` // e.g., "monthly", "yearly"
}
BillingPeriodInfo represents information about a billing period
type BulkIngestEventRequest ¶ added in v1.0.0
type BulkIngestEventRequest struct {
Events []*IngestEventRequest `json:"events" validate:"required,min=1,max=1000"`
}
func (*BulkIngestEventRequest) Validate ¶ added in v1.0.0
func (r *BulkIngestEventRequest) Validate() error
type CreateAPIKeyRequest ¶
type CreateAPIKeyRequest struct {
Name string `json:"name" binding:"required" validate:"required"`
Type types.SecretType `json:"type" binding:"required" validate:"required"`
Permissions []string `json:"permissions"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
}
CreateAPIKeyRequest represents the request to create a new API key
func (*CreateAPIKeyRequest) Validate ¶
func (r *CreateAPIKeyRequest) Validate() error
type CreateAPIKeyResponse ¶
type CreateAPIKeyResponse struct {
Secret SecretResponse `json:"secret"`
APIKey string `json:"api_key,omitempty"`
}
CreateAPIKeyResponse represents the response when creating a new API key
type CreateCustomerRequest ¶
type CreateCustomerRequest struct {
ExternalID string `json:"external_id" validate:"required"`
Name string `json:"name"`
Email string `json:"email" validate:"omitempty,email"`
AddressLine1 string `json:"address_line1" validate:"omitempty,max=255"`
AddressLine2 string `json:"address_line2" validate:"omitempty,max=255"`
AddressCity string `json:"address_city" validate:"omitempty,max=100"`
AddressState string `json:"address_state" validate:"omitempty,max=100"`
AddressPostalCode string `json:"address_postal_code" validate:"omitempty,max=20"`
AddressCountry string `json:"address_country" validate:"omitempty,len=2,iso3166_1_alpha2"`
Metadata map[string]string `json:"metadata,omitempty"`
}
func (*CreateCustomerRequest) ToCustomer ¶
func (r *CreateCustomerRequest) ToCustomer(ctx context.Context) *customer.Customer
func (*CreateCustomerRequest) Validate ¶
func (r *CreateCustomerRequest) Validate() error
type CreateEntitlementRequest ¶
type CreateEntitlementRequest struct {
PlanID string `json:"plan_id,omitempty"`
FeatureID string `json:"feature_id" binding:"required"`
FeatureType types.FeatureType `json:"feature_type" binding:"required"`
IsEnabled bool `json:"is_enabled"`
UsageLimit *int64 `json:"usage_limit"`
UsageResetPeriod types.BillingPeriod `json:"usage_reset_period"`
IsSoftLimit bool `json:"is_soft_limit"`
StaticValue string `json:"static_value"`
}
CreateEntitlementRequest represents the request to create a new entitlement
func (*CreateEntitlementRequest) ToEntitlement ¶
func (r *CreateEntitlementRequest) ToEntitlement(ctx context.Context) *entitlement.Entitlement
func (*CreateEntitlementRequest) Validate ¶
func (r *CreateEntitlementRequest) Validate() error
type CreateEnvironmentRequest ¶
type CreateEnvironmentRequest struct {
Name string `json:"name" validate:"required"`
Type string `json:"type" validate:"required"`
}
func (*CreateEnvironmentRequest) ToEnvironment ¶
func (r *CreateEnvironmentRequest) ToEnvironment(ctx context.Context) *environment.Environment
func (*CreateEnvironmentRequest) Validate ¶
func (r *CreateEnvironmentRequest) Validate() error
type CreateFeatureRequest ¶
type CreateFeatureRequest struct {
Name string `json:"name" binding:"required"`
Description string `json:"description"`
LookupKey string `json:"lookup_key"`
Type types.FeatureType `json:"type" binding:"required"`
MeterID string `json:"meter_id,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
UnitSingular string `json:"unit_singular,omitempty"`
UnitPlural string `json:"unit_plural,omitempty"`
}
func (*CreateFeatureRequest) Validate ¶
func (r *CreateFeatureRequest) Validate() error
type CreateIntegrationRequest ¶
type CreateIntegrationRequest struct {
Name string `json:"name" binding:"required"`
Provider types.SecretProvider `json:"provider" binding:"required"`
Credentials map[string]string `json:"credentials" binding:"required"`
}
CreateIntegrationRequest represents the request to create/update an integration
func (*CreateIntegrationRequest) Validate ¶
func (r *CreateIntegrationRequest) Validate() error
type CreateInvoiceLineItemRequest ¶
type CreateInvoiceLineItemRequest struct {
PriceID string `json:"price_id" validate:"required"`
PlanID *string `json:"plan_id,omitempty"`
PlanDisplayName *string `json:"plan_display_name,omitempty"`
PriceType *string `json:"price_type,omitempty"`
MeterID *string `json:"meter_id,omitempty"`
MeterDisplayName *string `json:"meter_display_name,omitempty"`
DisplayName *string `json:"display_name,omitempty"`
Amount decimal.Decimal `json:"amount" validate:"required"`
Quantity decimal.Decimal `json:"quantity" validate:"required"`
PeriodStart *time.Time `json:"period_start,omitempty"`
PeriodEnd *time.Time `json:"period_end,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
}
CreateInvoiceLineItemRequest represents a request to create a line item
func (*CreateInvoiceLineItemRequest) ToInvoiceLineItem ¶
func (r *CreateInvoiceLineItemRequest) ToInvoiceLineItem(ctx context.Context, inv *invoice.Invoice) *invoice.InvoiceLineItem
func (*CreateInvoiceLineItemRequest) Validate ¶
func (r *CreateInvoiceLineItemRequest) Validate() error
type CreateInvoiceRequest ¶
type CreateInvoiceRequest struct {
CustomerID string `json:"customer_id" validate:"required"`
SubscriptionID *string `json:"subscription_id,omitempty"`
IdempotencyKey *string `json:"idempotency_key"`
InvoiceType types.InvoiceType `json:"invoice_type"`
Currency string `json:"currency" validate:"required"`
AmountDue decimal.Decimal `json:"amount_due" validate:"required"`
Description string `json:"description,omitempty"`
DueDate *time.Time `json:"due_date,omitempty"`
BillingPeriod *string `json:"billing_period,omitempty"`
PeriodStart *time.Time `json:"period_start,omitempty"`
PeriodEnd *time.Time `json:"period_end,omitempty"`
BillingReason types.InvoiceBillingReason `json:"billing_reason"`
InvoiceStatus *types.InvoiceStatus `json:"invoice_status,omitempty"`
PaymentStatus *types.PaymentStatus `json:"payment_status,omitempty"`
AmountPaid *decimal.Decimal `json:"amount_paid,omitempty"`
LineItems []CreateInvoiceLineItemRequest `json:"line_items,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
EnvironmentID string `json:"environment_id,omitempty"`
}
CreateInvoiceRequest represents the request to create a new invoice
func (*CreateInvoiceRequest) Validate ¶
func (r *CreateInvoiceRequest) Validate() error
type CreateMeterRequest ¶
type CreateMeterRequest struct {
Name string `json:"name" binding:"required" example:"API Usage Meter"`
EventName string `json:"event_name" binding:"required" example:"api_request"`
Aggregation meter.Aggregation `json:"aggregation" binding:"required"`
Filters []meter.Filter `json:"filters"`
ResetUsage types.ResetUsage `json:"reset_usage" binding:"required"`
}
CreateMeterRequest represents the request payload for creating a meter
func (*CreateMeterRequest) ToMeter ¶
func (r *CreateMeterRequest) ToMeter(tenantID, createdBy string) *meter.Meter
Convert CreateMeterRequest to domain Meter
func (*CreateMeterRequest) Validate ¶
func (r *CreateMeterRequest) Validate() error
Request validations
type CreatePaymentRequest ¶
type CreatePaymentRequest struct {
IdempotencyKey string `json:"idempotency_key,omitempty"`
DestinationType types.PaymentDestinationType `json:"destination_type" binding:"required"`
DestinationID string `json:"destination_id" binding:"required"`
PaymentMethodType types.PaymentMethodType `json:"payment_method_type" binding:"required"`
PaymentMethodID string `json:"payment_method_id"`
Amount decimal.Decimal `json:"amount" binding:"required"`
Currency string `json:"currency" binding:"required"`
Metadata types.Metadata `json:"metadata,omitempty"`
ProcessPayment bool `json:"process_payment" default:"true"`
}
CreatePaymentRequest represents a request to create a payment
type CreatePlanEntitlementRequest ¶
type CreatePlanEntitlementRequest struct {
*CreateEntitlementRequest
}
func (*CreatePlanEntitlementRequest) ToEntitlement ¶
func (r *CreatePlanEntitlementRequest) ToEntitlement(ctx context.Context, planID string) *entitlement.Entitlement
type CreatePlanPriceRequest ¶
type CreatePlanPriceRequest struct {
*CreatePriceRequest
}
type CreatePlanRequest ¶
type CreatePlanRequest struct {
Name string `json:"name" validate:"required"`
LookupKey string `json:"lookup_key"`
Description string `json:"description"`
Prices []CreatePlanPriceRequest `json:"prices"`
Entitlements []CreatePlanEntitlementRequest `json:"entitlements"`
}
func (*CreatePlanRequest) ToPlan ¶
func (r *CreatePlanRequest) ToPlan(ctx context.Context) *plan.Plan
func (*CreatePlanRequest) Validate ¶
func (r *CreatePlanRequest) Validate() error
type CreatePlanResponse ¶
type CreatePriceRequest ¶
type CreatePriceRequest struct {
Amount string `json:"amount"`
Currency string `json:"currency" validate:"required,len=3"`
PlanID string `json:"plan_id,omitempty"`
Type types.PriceType `json:"type" validate:"required"`
BillingPeriod types.BillingPeriod `json:"billing_period" validate:"required"`
BillingPeriodCount int `json:"billing_period_count" validate:"required,min=1"`
BillingModel types.BillingModel `json:"billing_model" validate:"required"`
BillingCadence types.BillingCadence `json:"billing_cadence" validate:"required"`
MeterID string `json:"meter_id,omitempty"`
FilterValues map[string][]string `json:"filter_values,omitempty"`
LookupKey string `json:"lookup_key,omitempty"`
InvoiceCadence types.InvoiceCadence `json:"invoice_cadence" validate:"required"`
TrialPeriod int `json:"trial_period"`
Description string `json:"description,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
TierMode types.BillingTier `json:"tier_mode,omitempty"`
Tiers []CreatePriceTier `json:"tiers,omitempty"`
TransformQuantity *price.TransformQuantity `json:"transform_quantity,omitempty"`
}
func (*CreatePriceRequest) Validate ¶
func (r *CreatePriceRequest) Validate() error
TODO : add all price validations
type CreatePriceTier ¶
type CreateSubscriptionInvoiceRequest ¶
type CreateSubscriptionInvoiceRequest struct {
SubscriptionID string `json:"subscription_id" binding:"required"`
PeriodStart time.Time `json:"period_start" binding:"required"`
PeriodEnd time.Time `json:"period_end" binding:"required"`
IsPreview bool `json:"is_preview"`
ReferencePoint types.InvoiceReferencePoint `json:"reference_point"`
}
CreateSubscriptionInvoiceRequest represents a request to create a subscription invoice
func (*CreateSubscriptionInvoiceRequest) Validate ¶ added in v1.0.0
func (r *CreateSubscriptionInvoiceRequest) Validate() error
type CreateSubscriptionRequest ¶
type CreateSubscriptionRequest struct {
CustomerID string `json:"customer_id" validate:"required"`
PlanID string `json:"plan_id" validate:"required"`
Currency string `json:"currency" validate:"required,len=3"`
LookupKey string `json:"lookup_key"`
StartDate time.Time `json:"start_date" validate:"required"`
EndDate *time.Time `json:"end_date,omitempty"`
TrialStart *time.Time `json:"trial_start,omitempty"`
TrialEnd *time.Time `json:"trial_end,omitempty"`
BillingCadence types.BillingCadence `json:"billing_cadence" validate:"required"`
BillingPeriod types.BillingPeriod `json:"billing_period" validate:"required"`
BillingPeriodCount int `json:"billing_period_count" validate:"required,min=1"`
Metadata map[string]string `json:"metadata,omitempty"`
}
func (*CreateSubscriptionRequest) ToSubscription ¶
func (r *CreateSubscriptionRequest) ToSubscription(ctx context.Context) *subscription.Subscription
func (*CreateSubscriptionRequest) Validate ¶
func (r *CreateSubscriptionRequest) Validate() error
type CreateTaskRequest ¶
type CreateTaskRequest struct {
TaskType types.TaskType `json:"task_type" binding:"required"`
EntityType types.EntityType `json:"entity_type" binding:"required"`
FileURL string `json:"file_url" binding:"required"`
FileName *string `json:"file_name,omitempty"`
FileType types.FileType `json:"file_type" binding:"required"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
}
CreateTaskRequest represents the request to create a new task
func (*CreateTaskRequest) ToTask ¶
func (r *CreateTaskRequest) ToTask(ctx context.Context) *task.Task
ToTask converts the request to a domain task
func (*CreateTaskRequest) Validate ¶
func (r *CreateTaskRequest) Validate() error
type CreateTenantRequest ¶
type CreateTenantRequest struct {
Name string `json:"name" validate:"required"`
BillingDetails *TenantBillingDetails `json:"billing_details,omitempty"`
}
func (*CreateTenantRequest) ToTenant ¶
func (r *CreateTenantRequest) ToTenant(ctx context.Context) *tenant.Tenant
func (*CreateTenantRequest) Validate ¶
func (r *CreateTenantRequest) Validate() error
type CreateWalletRequest ¶
type CreateWalletRequest struct {
CustomerID string `json:"customer_id" binding:"required"`
Name string `json:"name,omitempty"`
Currency string `json:"currency" binding:"required"`
Description string `json:"description,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
AutoTopupTrigger types.AutoTopupTrigger `json:"auto_topup_trigger,omitempty"`
AutoTopupMinBalance decimal.Decimal `json:"auto_topup_min_balance,omitempty"`
AutoTopupAmount decimal.Decimal `json:"auto_topup_amount,omitempty"`
WalletType types.WalletType `json:"wallet_type"`
Config *types.WalletConfig `json:"config,omitempty"`
ConversionRate decimal.Decimal `json:"conversion_rate" default:"1"`
}
CreateWalletRequest represents the request to create a wallet
func (*CreateWalletRequest) ToWallet ¶
func (r *CreateWalletRequest) ToWallet(ctx context.Context) *wallet.Wallet
ToWallet converts a create wallet request to a wallet
func (*CreateWalletRequest) Validate ¶
func (r *CreateWalletRequest) Validate() error
type CustomerEntitlementsResponse ¶ added in v1.0.0
type CustomerEntitlementsResponse struct {
CustomerID string `json:"customer_id"`
Features []*AggregatedFeature `json:"features"`
}
CustomerEntitlementsResponse represents the response for customer entitlements
type CustomerInvoiceSummary ¶
type CustomerInvoiceSummary struct {
CustomerID string `json:"customer_id"`
Currency string `json:"currency"`
TotalRevenueAmount decimal.Decimal `json:"total_revenue_amount"`
TotalUnpaidAmount decimal.Decimal `json:"total_unpaid_amount"`
TotalOverdueAmount decimal.Decimal `json:"total_overdue_amount"`
TotalInvoiceCount int `json:"total_invoice_count"`
UnpaidInvoiceCount int `json:"unpaid_invoice_count"`
OverdueInvoiceCount int `json:"overdue_invoice_count"`
UnpaidUsageCharges decimal.Decimal `json:"unpaid_usage_charges"`
UnpaidFixedCharges decimal.Decimal `json:"unpaid_fixed_charges"`
}
CustomerInvoiceSummary represents a summary of customer's invoice status
type CustomerMultiCurrencyInvoiceSummary ¶
type CustomerMultiCurrencyInvoiceSummary struct {
CustomerID string `json:"customer_id"`
DefaultCurrency string `json:"default_currency"`
Summaries []*CustomerInvoiceSummary `json:"summaries"`
}
CustomerMultiCurrencyInvoiceSummary represents invoice summaries across all currencies
type CustomerResponse ¶
type CustomerUsageSummaryResponse ¶ added in v1.0.0
type CustomerUsageSummaryResponse struct {
CustomerID string `json:"customer_id"`
Features []*FeatureUsageSummary `json:"features"`
Period *BillingPeriodInfo `json:"period"`
Pagination *types.PaginationResponse `json:"pagination,omitempty"`
}
CustomerUsageSummaryResponse represents the response for customer usage summary
type EntitlementResponse ¶
type EntitlementResponse struct {
*entitlement.Entitlement
Feature *FeatureResponse `json:"feature,omitempty"`
Plan *PlanResponse `json:"plan,omitempty"`
}
EntitlementResponse represents the response for an entitlement
func EntitlementToResponse ¶
func EntitlementToResponse(e *entitlement.Entitlement) *EntitlementResponse
EntitlementToResponse converts an entitlement to a response
func EntitlementsToResponse ¶
func EntitlementsToResponse(entitlements []*entitlement.Entitlement) []*EntitlementResponse
EntitlementsToResponse converts a slice of entitlements to responses
type EntitlementSource ¶ added in v1.0.0
type EntitlementSource struct {
SubscriptionID string `json:"subscription_id"`
PlanID string `json:"plan_id"`
Quantity int64 `json:"quantity"`
PlanName string `json:"plan_name"`
EntitlementID string `json:"entitlement_id"`
IsEnabled bool `json:"is_enabled"`
UsageLimit *int64 `json:"usage_limit,omitempty"`
StaticValue string `json:"static_value,omitempty"`
}
EntitlementSource tracks which subscription provided the entitlement
type EnvironmentResponse ¶
type EnvironmentResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
func NewEnvironmentResponse ¶
func NewEnvironmentResponse(e *environment.Environment) *EnvironmentResponse
type ExpiredCreditsResponse ¶
type ExpiredCreditsResponse struct {
Items []*ExpiredCreditsResponseItem `json:"items"`
Total int `json:"total"`
Success int `json:"success"`
Failed int `json:"failed"`
}
type FeatureResponse ¶
type FeatureResponse struct {
*feature.Feature
Meter *MeterResponse `json:"meter,omitempty"`
}
type FeatureUsageSummary ¶ added in v1.0.0
type FeatureUsageSummary struct {
Feature *FeatureResponse `json:"feature"`
TotalLimit *int64 `json:"total_limit"`
CurrentUsage decimal.Decimal `json:"current_usage"`
UsagePercent decimal.Decimal `json:"usage_percent"`
IsEnabled bool `json:"is_enabled"`
IsSoftLimit bool `json:"is_soft_limit"`
Sources []*EntitlementSource `json:"sources"`
}
FeatureUsageSummary represents usage for a single feature
type GetCustomerEntitlementsRequest ¶ added in v1.0.0
type GetCustomerEntitlementsRequest struct {
FeatureIDs []string `json:"feature_ids,omitempty" form:"feature_ids"`
SubscriptionIDs []string `json:"subscription_ids,omitempty" form:"subscription_ids"`
}
GetCustomerEntitlementsRequest represents the request for getting customer entitlements
func (*GetCustomerEntitlementsRequest) Validate ¶ added in v1.0.0
func (r *GetCustomerEntitlementsRequest) Validate() error
type GetCustomerUsageSummaryRequest ¶ added in v1.0.0
type GetCustomerUsageSummaryRequest struct {
FeatureIDs []string `json:"feature_ids,omitempty" form:"feature_ids"`
SubscriptionIDs []string `json:"subscription_ids,omitempty" form:"subscription_ids"`
}
GetCustomerUsageSummaryRequest represents the request for getting customer usage summary
func (*GetCustomerUsageSummaryRequest) Validate ¶ added in v1.0.0
func (r *GetCustomerUsageSummaryRequest) Validate() error
type GetEventsRequest ¶
type GetEventsRequest struct {
ExternalCustomerID string `json:"external_customer_id"`
EventName string `json:"event_name" binding:"required"`
EventID string `json:"event_id"`
StartTime time.Time `json:"start_time" example:"2024-11-09T00:00:00Z"`
EndTime time.Time `json:"end_time" example:"2024-12-09T00:00:00Z"`
IterFirstKey string `json:"iter_first_key"`
IterLastKey string `json:"iter_last_key"`
PageSize int `json:"page_size" default:"50"`
}
func (*GetEventsRequest) Validate ¶
func (r *GetEventsRequest) Validate() error
type GetEventsResponse ¶
type GetUsageByMeterRequest ¶
type GetUsageByMeterRequest struct {
MeterID string `form:"meter_id" json:"meter_id" binding:"required" example:"123"`
ExternalCustomerID string `form:"external_customer_id" json:"external_customer_id" example:"user_5"`
CustomerID string `form:"customer_id" json:"customer_id" example:"customer456"`
StartTime time.Time `form:"start_time" json:"start_time" example:"2024-11-09T00:00:00Z"`
EndTime time.Time `form:"end_time" json:"end_time" example:"2024-12-09T00:00:00Z"`
WindowSize types.WindowSize `form:"window_size" json:"window_size"`
Filters map[string][]string `form:"filters,omitempty" json:"filters,omitempty"`
}
func (*GetUsageByMeterRequest) Validate ¶
func (r *GetUsageByMeterRequest) Validate() error
type GetUsageBySubscriptionRequest ¶
type GetUsageBySubscriptionRequest struct {
SubscriptionID string `json:"subscription_id" binding:"required" example:"123"`
StartTime time.Time `json:"start_time" example:"2024-03-13T00:00:00Z"`
EndTime time.Time `json:"end_time" example:"2024-03-20T00:00:00Z"`
LifetimeUsage bool `json:"lifetime_usage" example:"false"`
}
type GetUsageRequest ¶
type GetUsageRequest struct {
ExternalCustomerID string `form:"external_customer_id" json:"external_customer_id" example:"customer456"`
CustomerID string `form:"customer_id" json:"customer_id" example:"customer456"`
EventName string `form:"event_name" json:"event_name" binding:"required" required:"true" example:"api_request"`
PropertyName string `form:"property_name" json:"property_name" example:"request_size"` // will be empty/ignored in case of COUNT
AggregationType types.AggregationType `form:"aggregation_type" json:"aggregation_type" binding:"required"`
StartTime time.Time `form:"start_time" json:"start_time" example:"2024-03-13T00:00:00Z"`
EndTime time.Time `form:"end_time" json:"end_time" example:"2024-03-20T00:00:00Z"`
WindowSize types.WindowSize `form:"window_size" json:"window_size"`
Filters map[string][]string `form:"filters,omitempty" json:"filters,omitempty"`
}
func (*GetUsageRequest) ToUsageParams ¶
func (r *GetUsageRequest) ToUsageParams() *events.UsageParams
func (*GetUsageRequest) Validate ¶
func (r *GetUsageRequest) Validate() error
type GetUsageResponse ¶
type GetUsageResponse struct {
Results []UsageResult `json:"results,omitempty"`
Value float64 `json:"value,omitempty"`
EventName string `json:"event_name"`
Type types.AggregationType `json:"type"`
}
func FromAggregationResult ¶
func FromAggregationResult(result *events.AggregationResult) *GetUsageResponse
type IngestEventRequest ¶
type IngestEventRequest struct {
EventName string `json:"event_name" validate:"required" binding:"required" example:"api_request" csv:"event_name"`
EventID string `json:"event_id" example:"event123" csv:"event_id"`
CustomerID string `json:"customer_id" example:"customer456" csv:"customer_id"`
ExternalCustomerID string `json:"external_customer_id" validate:"required" binding:"required" example:"customer456" csv:"external_customer_id"`
Timestamp time.Time `json:"timestamp" example:"2024-03-20T15:04:05Z" csv:"-"` // Handled separately due to parsing
TimestampStr string `json:"-" csv:"timestamp"` // Used for CSV parsing
Source string `json:"source" example:"api" csv:"source"`
Properties map[string]interface{} `json:"properties" swaggertype:"object,string,number" example:"{\"request_size\":100,\"response_status\":200}" csv:"-"` // Handled separately for dynamic columns
}
func (*IngestEventRequest) ToEvent ¶ added in v1.0.0
func (r *IngestEventRequest) ToEvent(ctx context.Context) *events.Event
func (*IngestEventRequest) Validate ¶
func (r *IngestEventRequest) Validate() error
type InvoiceLineItemResponse ¶
type InvoiceLineItemResponse struct {
ID string `json:"id"`
InvoiceID string `json:"invoice_id"`
CustomerID string `json:"customer_id"`
SubscriptionID *string `json:"subscription_id,omitempty"`
PriceID string `json:"price_id"`
PlanID *string `json:"plan_id,omitempty"`
PlanDisplayName *string `json:"plan_display_name,omitempty"`
PriceType *string `json:"price_type,omitempty"`
MeterID *string `json:"meter_id,omitempty"`
MeterDisplayName *string `json:"meter_display_name,omitempty"`
DisplayName *string `json:"display_name,omitempty"`
Amount decimal.Decimal `json:"amount"`
Quantity decimal.Decimal `json:"quantity"`
Currency string `json:"currency"`
PeriodStart *time.Time `json:"period_start,omitempty"`
PeriodEnd *time.Time `json:"period_end,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
TenantID string `json:"tenant_id"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy string `json:"created_by,omitempty"`
UpdatedBy string `json:"updated_by,omitempty"`
}
InvoiceLineItemResponse represents a line item in responses
func NewInvoiceLineItemResponse ¶
func NewInvoiceLineItemResponse(item *invoice.InvoiceLineItem) *InvoiceLineItemResponse
type InvoiceResponse ¶
type InvoiceResponse struct {
ID string `json:"id"`
CustomerID string `json:"customer_id"`
SubscriptionID *string `json:"subscription_id,omitempty"`
InvoiceType types.InvoiceType `json:"invoice_type"`
InvoiceStatus types.InvoiceStatus `json:"invoice_status"`
PaymentStatus types.PaymentStatus `json:"payment_status"`
Currency string `json:"currency"`
AmountDue decimal.Decimal `json:"amount_due"`
AmountPaid decimal.Decimal `json:"amount_paid"`
AmountRemaining decimal.Decimal `json:"amount_remaining"`
InvoiceNumber *string `json:"invoice_number,omitempty"`
IdempotencyKey *string `json:"idempotency_key,omitempty"`
BillingSequence *int `json:"billing_sequence,omitempty"`
Description string `json:"description,omitempty"`
DueDate *time.Time `json:"due_date,omitempty"`
BillingPeriod *string `json:"billing_period,omitempty"`
PeriodStart *time.Time `json:"period_start,omitempty"`
PeriodEnd *time.Time `json:"period_end,omitempty"`
PaidAt *time.Time `json:"paid_at,omitempty"`
VoidedAt *time.Time `json:"voided_at,omitempty"`
FinalizedAt *time.Time `json:"finalized_at,omitempty"`
InvoicePDFURL *string `json:"invoice_pdf_url,omitempty"`
BillingReason string `json:"billing_reason,omitempty"`
LineItems []*InvoiceLineItemResponse `json:"line_items,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
Version int `json:"version"`
TenantID string `json:"tenant_id"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy string `json:"created_by,omitempty"`
UpdatedBy string `json:"updated_by,omitempty"`
Subscription *SubscriptionResponse `json:"subscription,omitempty"`
Customer *CustomerResponse `json:"customer,omitempty"`
}
InvoiceResponse represents the response for invoice operations
func NewInvoiceResponse ¶
func NewInvoiceResponse(inv *invoice.Invoice) *InvoiceResponse
NewInvoiceResponse creates a new invoice response from domain invoice
func (*InvoiceResponse) WithCustomer ¶
func (r *InvoiceResponse) WithCustomer(customer *CustomerResponse) *InvoiceResponse
WithCustomer adds customer information to the invoice response
func (*InvoiceResponse) WithSubscription ¶
func (r *InvoiceResponse) WithSubscription(sub *SubscriptionResponse) *InvoiceResponse
type LinkedIntegrationsResponse ¶
type LinkedIntegrationsResponse struct {
Providers []string `json:"providers"`
}
LinkedIntegrationsResponse represents the response for listing linked integrations
type ListCustomersResponse ¶
type ListCustomersResponse = types.ListResponse[*CustomerResponse]
ListCustomersResponse represents the response for listing customers
type ListEntitlementsResponse ¶
type ListEntitlementsResponse = types.ListResponse[*EntitlementResponse]
ListEntitlementsResponse represents a paginated list of entitlements
type ListEnvironmentsResponse ¶
type ListEnvironmentsResponse struct {
Environments []EnvironmentResponse `json:"environments"`
Total int `json:"total"`
Offset int `json:"offset"`
Limit int `json:"limit"`
}
type ListFeaturesResponse ¶
type ListFeaturesResponse = types.ListResponse[*FeatureResponse]
ListFeaturesResponse represents a paginated list of features
type ListInvoicesResponse ¶
type ListInvoicesResponse = types.ListResponse[*InvoiceResponse]
ListInvoicesResponse represents the response for listing invoices
type ListMetersResponse ¶
type ListMetersResponse = types.ListResponse[*MeterResponse]
ListMetersResponse represents a paginated list of meters
type ListPaymentsResponse ¶
type ListPaymentsResponse struct {
Items []*PaymentResponse `json:"items"`
Pagination types.PaginationResponse `json:"pagination"`
}
ListPaymentsResponse represents a paginated list of payments
type ListPlansResponse ¶
type ListPlansResponse = types.ListResponse[*PlanResponse]
ListPlansResponse represents the response for listing plans
type ListPricesResponse ¶
type ListPricesResponse = types.ListResponse[*PriceResponse]
ListPricesResponse represents the response for listing prices
type ListSecretsResponse ¶
type ListSecretsResponse = types.ListResponse[*SecretResponse]
ListSecretsResponse represents the response for listing secrets
type ListSubscriptionPausesResponse ¶
type ListSubscriptionPausesResponse struct {
Items []*SubscriptionPauseResponse `json:"items"`
Total int `json:"total"`
}
ListSubscriptionPausesResponse represents a list of subscription pauses in API responses
func NewListSubscriptionPausesResponse ¶
func NewListSubscriptionPausesResponse(pauses []*subscription.SubscriptionPause) *ListSubscriptionPausesResponse
NewListSubscriptionPausesResponse creates a new list subscription pauses response
type ListSubscriptionsResponse ¶
type ListSubscriptionsResponse = types.ListResponse[*SubscriptionResponse]
ListSubscriptionsResponse represents the response for listing subscriptions
type ListTasksResponse ¶
type ListTasksResponse struct {
Items []*TaskResponse `json:"items"`
Pagination types.PaginationResponse `json:"pagination"`
}
ListTasksResponse represents the response for listing tasks
type ListWalletTransactionsResponse ¶
type ListWalletTransactionsResponse = types.ListResponse[*WalletTransactionResponse]
ListWalletTransactionsResponse represents the response for listing wallet transactions
type LoginRequest ¶
type LoginRequest struct {
Email string `json:"email" binding:"required,email" validate:"email"`
Password string `json:"password" binding:"required" validate:"min=8"`
Token string `json:"token" binding:"omitempty" validate:"omitempty"`
}
func (*LoginRequest) Validate ¶
func (r *LoginRequest) Validate() error
type MeterResponse ¶
type MeterResponse struct {
ID string `json:"id" example:"550e8400-e29b-41d4-a716-446655440000"`
Name string `json:"name" example:"API Usage Meter"`
TenantID string `json:"tenant_id" example:"tenant123"`
EventName string `json:"event_name" example:"api_request"`
Aggregation meter.Aggregation `json:"aggregation"`
Filters []meter.Filter `json:"filters"`
ResetUsage types.ResetUsage `json:"reset_usage"`
CreatedAt time.Time `json:"created_at" example:"2024-03-20T15:04:05Z"`
UpdatedAt time.Time `json:"updated_at" example:"2024-03-20T15:04:05Z"`
Status string `json:"status" example:"published"`
}
MeterResponse represents the meter response structure
func ToMeterResponse ¶
func ToMeterResponse(m *meter.Meter) *MeterResponse
Convert domain Meter to MeterResponse
type OnboardingEventsRequest ¶ added in v1.0.0
type OnboardingEventsRequest struct {
CustomerID string `json:"customer_id" validate:"omitempty" example:"cus_01HKG8QWERTY123"`
FeatureID string `json:"feature_id" validate:"omitempty" example:"feat_01HKG8QWERTY123"`
SubscriptionID string `json:"subscription_id" validate:"omitempty" example:"sub_01HKG8QWERTY123"`
Duration int `json:"duration" validate:"omitempty,min=1,max=600" default:"60" example:"60"`
}
OnboardingEventsRequest represents the request to generate events for onboarding
func (*OnboardingEventsRequest) Validate ¶ added in v1.0.0
func (r *OnboardingEventsRequest) Validate() error
Validate validates the OnboardingEventsRequest
type OnboardingEventsResponse ¶ added in v1.0.0
type OnboardingEventsResponse struct {
Message string `json:"message"`
StartedAt time.Time `json:"started_at"`
Duration int `json:"duration"`
Count int `json:"count"`
CustomerID string `json:"customer_id"`
FeatureID string `json:"feature_id,omitempty"`
SubscriptionID string `json:"subscription_id,omitempty"`
}
OnboardingEventsResponse represents the response for onboarding events generation
type PauseSubscriptionRequest ¶
type PauseSubscriptionRequest struct {
PauseMode types.PauseMode `json:"pause_mode" validate:"required"`
PauseStart *time.Time `json:"pause_start,omitempty" validate:"omitempty"`
PauseEnd *time.Time `json:"pause_end,omitempty" validate:"omitempty,gtfield=PauseStart"`
PauseDays *int `json:"pause_days,omitempty" validate:"omitempty,gt=0"`
Reason string `json:"reason,omitempty" validate:"omitempty,max=255"`
DryRun bool `json:"dry_run,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
PauseSubscriptionRequest represents a request to pause a subscription
func (*PauseSubscriptionRequest) Validate ¶
func (r *PauseSubscriptionRequest) Validate() error
Validate validates the pause subscription request
type PauseSubscriptionResponse ¶
type PauseSubscriptionResponse struct {
Subscription *SubscriptionResponse `json:"subscription,omitempty"`
Pause *SubscriptionPauseResponse `json:"pause,omitempty"`
BillingImpact *types.BillingImpactDetails `json:"billing_impact"`
DryRun bool `json:"dry_run"`
}
PauseSubscriptionResponse represents the response to a pause subscription request
func NewSubscriptionPauseResponse ¶
func NewSubscriptionPauseResponse(sub *subscription.Subscription, pause *subscription.SubscriptionPause) *PauseSubscriptionResponse
NewSubscriptionPauseResponse creates a new subscription pause response
type PaymentAttemptResponse ¶
type PaymentAttemptResponse struct {
ID string `json:"id"`
PaymentID string `json:"payment_id"`
AttemptNumber int `json:"attempt_number"`
ErrorMessage *string `json:"error_message,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
TenantID string `json:"tenant_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy string `json:"created_by"`
UpdatedBy string `json:"updated_by"`
}
PaymentAttemptResponse represents a payment attempt response
func NewPaymentAttemptResponse ¶
func NewPaymentAttemptResponse(a *payment.PaymentAttempt) *PaymentAttemptResponse
NewPaymentAttemptResponse creates a new payment attempt response from a payment attempt
type PaymentResponse ¶
type PaymentResponse struct {
ID string `json:"id"`
IdempotencyKey string `json:"idempotency_key"`
DestinationType types.PaymentDestinationType `json:"destination_type"`
DestinationID string `json:"destination_id"`
PaymentMethodType types.PaymentMethodType `json:"payment_method_type"`
PaymentMethodID string `json:"payment_method_id"`
Amount decimal.Decimal `json:"amount"`
Currency string `json:"currency"`
PaymentStatus types.PaymentStatus `json:"payment_status"`
TrackAttempts bool `json:"track_attempts"`
Metadata types.Metadata `json:"metadata,omitempty"`
SucceededAt *time.Time `json:"succeeded_at,omitempty"`
FailedAt *time.Time `json:"failed_at,omitempty"`
RefundedAt *time.Time `json:"refunded_at,omitempty"`
ErrorMessage *string `json:"error_message,omitempty"`
Attempts []*PaymentAttemptResponse `json:"attempts,omitempty"`
TenantID string `json:"tenant_id"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy string `json:"created_by"`
UpdatedBy string `json:"updated_by"`
}
PaymentResponse represents a payment response
func NewPaymentResponse ¶
func NewPaymentResponse(p *payment.Payment) *PaymentResponse
NewPaymentResponse creates a new payment response from a payment
type PlanResponse ¶
type PlanResponse struct {
*plan.Plan
Prices []*PriceResponse `json:"prices,omitempty"`
Entitlements []*EntitlementResponse `json:"entitlements,omitempty"`
}
type PriceResponse ¶
type PriceResponse struct {
*price.Price
Meter *MeterResponse `json:"meter,omitempty"`
}
type ResumeSubscriptionRequest ¶
type ResumeSubscriptionRequest struct {
ResumeMode types.ResumeMode `json:"resume_mode" validate:"required"`
DryRun bool `json:"dry_run,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
ResumeSubscriptionRequest represents a request to resume a subscription
func (*ResumeSubscriptionRequest) Validate ¶
func (r *ResumeSubscriptionRequest) Validate() error
Validate validates the resume subscription request
type ResumeSubscriptionResponse ¶
type ResumeSubscriptionResponse struct {
// Only included if not a dry run
Subscription *SubscriptionResponse `json:"subscription,omitempty"`
Pause *SubscriptionPauseResponse `json:"pause,omitempty"`
// Billing impact details
BillingImpact *types.BillingImpactDetails `json:"billing_impact"`
// Whether this was a dry run
DryRun bool `json:"dry_run"`
}
ResumeSubscriptionResponse represents the response to a resume subscription request
type SecretResponse ¶
type SecretResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Type types.SecretType `json:"type"`
Provider types.SecretProvider `json:"provider"`
DisplayID string `json:"display_id"`
Permissions []string `json:"permissions"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
LastUsedAt *time.Time `json:"last_used_at,omitempty"`
Status types.Status `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
SecretResponse represents a secret in responses
func ToSecretResponse ¶
func ToSecretResponse(s *secret.Secret) *SecretResponse
ToSecretResponse converts a domain Secret to a SecretResponse
func ToSecretResponseList ¶
func ToSecretResponseList(secrets []*secret.Secret) []*SecretResponse
ToSecretResponseList converts a list of domain Secrets to SecretResponses
type SignUpRequest ¶
type SignUpRequest struct {
Email string `json:"email" binding:"required,email" validate:"email"`
Password string `json:"password" binding:"omitempty,min=8" validate:"omitempty,min=8"`
TenantName string `json:"tenant_name" binding:"omitempty" validate:"omitempty"`
Token string `json:"token" binding:"omitempty" validate:"omitempty"`
}
func (*SignUpRequest) Validate ¶
func (r *SignUpRequest) Validate() error
type SubscriptionLineItemRequest ¶
type SubscriptionLineItemRequest struct {
PriceID string `json:"price_id" validate:"required"`
Quantity decimal.Decimal `json:"quantity" validate:"required"`
DisplayName string `json:"display_name,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
SubscriptionLineItemRequest represents the request to create a subscription line item
func (*SubscriptionLineItemRequest) ToSubscriptionLineItem ¶
func (r *SubscriptionLineItemRequest) ToSubscriptionLineItem(ctx context.Context) *subscription.SubscriptionLineItem
ToSubscriptionLineItem converts a request to a domain subscription line item
type SubscriptionLineItemResponse ¶
type SubscriptionLineItemResponse struct {
*subscription.SubscriptionLineItem
}
SubscriptionLineItemResponse represents the response for a subscription line item
type SubscriptionPauseResponse ¶
type SubscriptionPauseResponse struct {
*subscription.SubscriptionPause
}
SubscriptionPauseResponse represents a subscription pause in API responses
type SubscriptionResponse ¶
type SubscriptionResponse struct {
*subscription.Subscription
Plan *PlanResponse `json:"plan"`
Customer *CustomerResponse `json:"customer"`
}
type SubscriptionUpdatePeriodResponse ¶
type SubscriptionUpdatePeriodResponse struct {
TotalSuccess int `json:"total_success"`
TotalFailed int `json:"total_failed"`
Items []*SubscriptionUpdatePeriodResponseItem `json:"items"`
StartAt time.Time `json:"start_at"`
}
type SubscriptionUsageByMetersResponse ¶
type SubscriptionUsageByMetersResponse struct {
Amount float64 `json:"amount"`
Currency string `json:"currency"`
DisplayAmount string `json:"display_amount"`
Quantity float64 `json:"quantity"`
FilterValues price.JSONBFilters `json:"filter_values"`
MeterID string `json:"meter_id"`
MeterDisplayName string `json:"meter_display_name"`
Price *price.Price `json:"price"`
}
type SuccessResponse ¶
type SuccessResponse struct {
Message string `json:"message"`
}
SuccessResponse represents a generic success response
type TaskResponse ¶
type TaskResponse struct {
ID string `json:"id"`
TaskType types.TaskType `json:"task_type"`
EntityType types.EntityType `json:"entity_type"`
FileURL string `json:"file_url"`
FileName *string `json:"file_name,omitempty"`
FileType types.FileType `json:"file_type"`
TaskStatus types.TaskStatus `json:"task_status"`
TotalRecords *int `json:"total_records,omitempty"`
ProcessedRecords int `json:"processed_records"`
SuccessfulRecords int `json:"successful_records"`
FailedRecords int `json:"failed_records"`
ErrorSummary *string `json:"error_summary,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
FailedAt *time.Time `json:"failed_at,omitempty"`
TenantID string `json:"tenant_id"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CreatedBy string `json:"created_by,omitempty"`
UpdatedBy string `json:"updated_by,omitempty"`
}
TaskResponse represents a task in responses
func NewTaskResponse ¶
func NewTaskResponse(t *task.Task) *TaskResponse
NewTaskResponse creates a new task response from a domain task
type TenantBillingDetails ¶ added in v1.0.0
type TenantBillingDetails struct {
Email string `json:"email,omitempty"`
HelpEmail string `json:"help_email,omitempty"`
Phone string `json:"phone,omitempty"`
Address Address `json:"address,omitempty"`
}
func NewTenantBillingDetails ¶ added in v1.0.0
func NewTenantBillingDetails(b tenant.TenantBillingDetails) TenantBillingDetails
func (*TenantBillingDetails) ToDomain ¶ added in v1.0.0
func (r *TenantBillingDetails) ToDomain() tenant.TenantBillingDetails
type TenantBillingUsage ¶ added in v1.0.0
type TenantBillingUsage struct {
Usage *CustomerUsageSummaryResponse `json:"usage"`
Subscriptions []*SubscriptionResponse `json:"subscriptions"`
}
type TenantResponse ¶
type TenantResponse struct {
ID string `json:"id"`
Name string `json:"name"`
BillingDetails *TenantBillingDetails `json:"billing_details,omitempty"`
Status string `json:"status"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
func NewTenantResponse ¶
func NewTenantResponse(t *tenant.Tenant) *TenantResponse
type TopUpWalletRequest ¶
type TopUpWalletRequest struct {
// amount is the number of credits to add to the wallet
Amount decimal.Decimal `json:"amount" binding:"required"`
// description to add any specific details about the transaction
Description string `json:"description,omitempty"`
// purchased_credits when true, the credits are added as purchased credits
PurchasedCredits bool `json:"purchased_credits"`
// generate_invoice when true, an invoice will be generated for the transaction
GenerateInvoice bool `json:"generate_invoice"`
// expiry_date YYYYMMDD format in UTC timezone (optional to set nil means no expiry)
// for ex 20250101 means the credits will expire on 2025-01-01 00:00:00 UTC
// hence they will be available for use until 2024-12-31 23:59:59 UTC
ExpiryDate *int `json:"expiry_date,omitempty"`
// reference_type is the type of the reference ex payment, invoice, request
ReferenceType string `json:"reference_type,omitempty"`
// reference_id is the ID of the reference ex payment ID, invoice ID, request ID
ReferenceID string `json:"reference_id,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
}
TopUpWalletRequest represents a request to add credits to a wallet
func (*TopUpWalletRequest) Validate ¶
func (r *TopUpWalletRequest) Validate() error
type UpdateCustomerRequest ¶
type UpdateCustomerRequest struct {
ExternalID *string `json:"external_id"`
Name *string `json:"name"`
Email *string `json:"email" validate:"omitempty,email"`
AddressLine1 *string `json:"address_line1" validate:"omitempty,max=255"`
AddressLine2 *string `json:"address_line2" validate:"omitempty,max=255"`
AddressCity *string `json:"address_city" validate:"omitempty,max=100"`
AddressState *string `json:"address_state" validate:"omitempty,max=100"`
AddressPostalCode *string `json:"address_postal_code" validate:"omitempty,max=20"`
AddressCountry *string `json:"address_country" validate:"omitempty,len=2,iso3166_1_alpha2"`
Metadata map[string]string `json:"metadata,omitempty"`
}
func (*UpdateCustomerRequest) Validate ¶
func (r *UpdateCustomerRequest) Validate() error
type UpdateEntitlementRequest ¶
type UpdateEntitlementRequest struct {
IsEnabled *bool `json:"is_enabled"`
UsageLimit *int64 `json:"usage_limit"`
UsageResetPeriod types.BillingPeriod `json:"usage_reset_period"`
IsSoftLimit *bool `json:"is_soft_limit"`
StaticValue string `json:"static_value"`
}
UpdateEntitlementRequest represents the request to update an existing entitlement
type UpdateEnvironmentRequest ¶
func (*UpdateEnvironmentRequest) Validate ¶
func (r *UpdateEnvironmentRequest) Validate() error
type UpdateFeatureRequest ¶
type UpdateInvoicePaymentRequest ¶
type UpdateInvoicePaymentRequest struct {
PaymentStatus types.PaymentStatus `json:"payment_status" validate:"required"`
}
UpdateInvoicePaymentRequest represents the request to update invoice payment status
func (*UpdateInvoicePaymentRequest) Validate ¶
func (r *UpdateInvoicePaymentRequest) Validate() error
type UpdateMeterRequest ¶
UpdateMeterRequest represents the request payload for updating a meter
type UpdatePaymentRequest ¶
type UpdatePaymentRequest struct {
PaymentStatus *string `json:"payment_status,omitempty"`
Metadata *types.Metadata `json:"metadata,omitempty"`
}
UpdatePaymentRequest represents a request to update a payment
type UpdatePaymentStatusRequest ¶
type UpdatePaymentStatusRequest struct {
PaymentStatus types.PaymentStatus `json:"payment_status" binding:"required"`
Amount *decimal.Decimal `json:"amount,omitempty"`
}
UpdatePaymentStatusRequest represents a request to update an invoice's payment status
func (*UpdatePaymentStatusRequest) Validate ¶
func (r *UpdatePaymentStatusRequest) Validate() error
type UpdatePlanEntitlementRequest ¶
type UpdatePlanEntitlementRequest struct {
// The ID of the entitlement to update (present if the entitlement is being updated)
ID string `json:"id,omitempty"`
// The entitlement request to update existing entitlement or create new entitlement
*CreatePlanEntitlementRequest
}
type UpdatePlanPriceRequest ¶
type UpdatePlanPriceRequest struct {
// The ID of the price to update (present if the price is being updated)
ID string `json:"id,omitempty"`
// The price request to update existing price or create new price
*CreatePriceRequest
}
type UpdatePlanRequest ¶
type UpdatePlanRequest struct {
Name *string `json:"name,omitempty"`
LookupKey *string `json:"lookup_key,omitempty"`
Description *string `json:"description,omitempty"`
Prices []UpdatePlanPriceRequest `json:"prices,omitempty"`
Entitlements []UpdatePlanEntitlementRequest `json:"entitlements,omitempty"`
}
type UpdatePriceRequest ¶
type UpdateSubscriptionRequest ¶
type UpdateSubscriptionRequest struct {
Status types.SubscriptionStatus `json:"status"`
CancelAt *time.Time `json:"cancel_at,omitempty"`
CancelAtPeriodEnd bool `json:"cancel_at_period_end,omitempty"`
}
type UpdateTaskStatusRequest ¶
type UpdateTaskStatusRequest struct {
TaskStatus types.TaskStatus `json:"task_status" binding:"required"`
}
UpdateTaskStatusRequest represents a request to update a task's status
func (*UpdateTaskStatusRequest) Validate ¶
func (r *UpdateTaskStatusRequest) Validate() error
type UpdateTenantRequest ¶ added in v1.0.0
type UpdateTenantRequest struct {
BillingDetails *TenantBillingDetails `json:"billing_details,omitempty"`
}
func (*UpdateTenantRequest) Validate ¶ added in v1.0.0
func (r *UpdateTenantRequest) Validate() error
type UpdateWalletRequest ¶
type UpdateWalletRequest struct {
Name *string `json:"name,omitempty"`
Description *string `json:"description,omitempty"`
Metadata *types.Metadata `json:"metadata,omitempty"`
AutoTopupTrigger *types.AutoTopupTrigger `json:"auto_topup_trigger,omitempty"`
AutoTopupMinBalance *decimal.Decimal `json:"auto_topup_min_balance,omitempty"`
AutoTopupAmount *decimal.Decimal `json:"auto_topup_amount,omitempty"`
Config *types.WalletConfig `json:"config,omitempty"`
}
UpdateWalletRequest represents the request to update a wallet
func (*UpdateWalletRequest) Validate ¶
func (r *UpdateWalletRequest) Validate() error
type UsageResult ¶
type UserResponse ¶
type UserResponse struct {
ID string `json:"id"`
Email string `json:"email"`
Tenant *TenantResponse `json:"tenant"`
}
func NewUserResponse ¶
func NewUserResponse(user *user.User, tenant *tenant.Tenant) *UserResponse
type WalletBalanceResponse ¶
type WalletBalanceResponse struct {
*wallet.Wallet
RealTimeBalance decimal.Decimal `json:"real_time_balance"`
RealTimeCreditBalance decimal.Decimal `json:"real_time_credit_balance"`
BalanceUpdatedAt time.Time `json:"balance_updated_at"`
UnpaidInvoiceAmount decimal.Decimal `json:"unpaid_invoice_amount"`
CurrentPeriodUsage decimal.Decimal `json:"current_period_usage"`
}
WalletBalanceResponse represents the response for getting wallet balance
type WalletResponse ¶
type WalletResponse struct {
ID string `json:"id"`
CustomerID string `json:"customer_id"`
Name string `json:"name,omitempty"`
Currency string `json:"currency"`
Description string `json:"description,omitempty"`
Balance decimal.Decimal `json:"balance"`
CreditBalance decimal.Decimal `json:"credit_balance"`
WalletStatus types.WalletStatus `json:"wallet_status"`
Metadata types.Metadata `json:"metadata,omitempty"`
AutoTopupTrigger types.AutoTopupTrigger `json:"auto_topup_trigger"`
AutoTopupMinBalance decimal.Decimal `json:"auto_topup_min_balance"`
AutoTopupAmount decimal.Decimal `json:"auto_topup_amount"`
WalletType types.WalletType `json:"wallet_type"`
Config types.WalletConfig `json:"config,omitempty"`
ConversionRate decimal.Decimal `json:"conversion_rate"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
WalletResponse represents a wallet in API responses
func FromWallet ¶
func FromWallet(w *wallet.Wallet) *WalletResponse
ToWalletResponse converts domain Wallet to WalletResponse
type WalletTransactionResponse ¶
type WalletTransactionResponse struct {
ID string `json:"id"`
WalletID string `json:"wallet_id"`
Type string `json:"type"`
Amount decimal.Decimal `json:"amount"`
CreditAmount decimal.Decimal `json:"credit_amount"`
CreditBalanceBefore decimal.Decimal `json:"credit_balance_before"`
CreditBalanceAfter decimal.Decimal `json:"credit_balance_after"`
TransactionStatus types.TransactionStatus `json:"transaction_status"`
ExpiryDate *time.Time `json:"expiry_date,omitempty"`
CreditsAvailable decimal.Decimal `json:"credits_available,omitempty"`
TransactionReason types.TransactionReason `json:"transaction_reason,omitempty"`
ReferenceType types.WalletTxReferenceType `json:"reference_type,omitempty"`
ReferenceID string `json:"reference_id,omitempty"`
Description string `json:"description,omitempty"`
Metadata types.Metadata `json:"metadata,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
WalletTransactionResponse represents a wallet transaction in API responses
func FromWalletTransaction ¶
func FromWalletTransaction(t *wallet.Transaction) *WalletTransactionResponse
FromWalletTransaction converts a wallet transaction to a WalletTransactionResponse