model

package
v0.0.0-...-122f59b Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminAPISecret

type AdminAPISecret struct {
	KeyID         string     `json:"keyID,omitempty"`
	CreatedAt     *time.Time `json:"createdAt,omitempty"`
	PublicKeyPEM  string     `json:"publicKeyPEM,omitempty"`
	PrivateKeyPEM *string    `json:"privateKeyPEM,omitempty"`
}

type App

type App struct {
	ID      string
	Context *config.AppContext
}

type AppListItem

type AppListItem struct {
	AppID        string `json:"appID,omitempty"`
	PublicOrigin string `json:"publicOrigin,omitempty"`
}

type AppResource

type AppResource struct {
	DescriptedPath resource.DescriptedPath
	Context        *config.AppContext
}

type Collaborator

type Collaborator struct {
	ID        string           `json:"id"`
	AppID     string           `json:"appID"`
	UserID    string           `json:"userID"`
	CreatedAt time.Time        `json:"createdAt"`
	Role      CollaboratorRole `json:"role"`
}

type CollaboratorInvitation

type CollaboratorInvitation struct {
	ID           string    `json:"id"`
	AppID        string    `json:"appID"`
	InvitedBy    string    `json:"invitedBy"`
	InviteeEmail string    `json:"inviteeEmail"`
	Code         string    `json:"-"`
	CreatedAt    time.Time `json:"createdAt"`
	ExpireAt     time.Time `json:"expireAt"`
}

type CollaboratorRole

type CollaboratorRole string
const (
	CollaboratorRoleOwner  CollaboratorRole = "owner"
	CollaboratorRoleEditor CollaboratorRole = "editor"
)

func (CollaboratorRole) Level

func (r CollaboratorRole) Level() int

type OAuthClientSecret

type OAuthClientSecret struct {
	ClientID string                 `json:"clientID,omitempty"`
	Keys     []OAuthClientSecretKey `json:"keys,omitempty"`
}

type OAuthClientSecretKey

type OAuthClientSecretKey struct {
	KeyID     string     `json:"keyID,omitempty"`
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	Key       string     `json:"key,omitempty"`
}

type OAuthSSOProviderClientSecret

type OAuthSSOProviderClientSecret struct {
	Alias        string  `json:"alias,omitempty"`
	ClientSecret *string `json:"clientSecret,omitempty"`
}

type OnboardEntry

type OnboardEntry struct {
	PhoneNumber string `json:"onboarding_survey_phone_number"`
}

type Plan

type Plan struct {
	ID               string
	Name             string
	RawFeatureConfig *config.FeatureConfig
}

func NewPlan

func NewPlan(name string) *Plan

type Price

type Price struct {
	StripePriceID             string                 `json:"stripePriceID"`
	StripeProductID           string                 `json:"stripeProductID"`
	Type                      PriceType              `json:"type"`
	UsageType                 UsageType              `json:"usageType,omitempty"`
	SMSRegion                 SMSRegion              `json:"smsRegion,omitempty"`
	WhatsappRegion            WhatsappRegion         `json:"whatsappRegion,omitempty"`
	Currency                  string                 `json:"currency"`
	UnitAmount                int                    `json:"unitAmount"`
	FreeQuantity              *int                   `json:"freeQuantity,omitempty"`
	TransformQuantityDivideBy *int                   `json:"transformQuantityDivideBy,omitempty"`
	TransformQuantityRound    TransformQuantityRound `json:"transformQuantityRound,omitempty"`
}

func (*Price) ShouldClearUsage

func (p *Price) ShouldClearUsage() bool

type PriceType

type PriceType string
const (
	PriceTypeFixed PriceType = "fixed"
	PriceTypeUsage PriceType = "usage"
)

func (PriceType) Valid

func (t PriceType) Valid() error

type SMSRegion

type SMSRegion string
const (
	SMSRegionNone         SMSRegion = ""
	SMSRegionNorthAmerica SMSRegion = "north-america"
	SMSRegionOtherRegions SMSRegion = "other-regions"
)

func (SMSRegion) Valid

func (r SMSRegion) Valid() error

type SMTPSecret

type SMTPSecret struct {
	Host     string  `json:"host,omitempty"`
	Port     int     `json:"port,omitempty"`
	Username string  `json:"username,omitempty"`
	Password *string `json:"password,omitempty"`
}

type SecretConfig

type SecretConfig struct {
	OAuthSSOProviderClientSecrets []OAuthSSOProviderClientSecret `json:"oauthSSOProviderClientSecrets,omitempty"`
	WebhookSecret                 *WebhookSecret                 `json:"webhookSecret,omitempty"`
	AdminAPISecrets               []AdminAPISecret               `json:"adminAPISecrets,omitempty"`
	SMTPSecret                    *SMTPSecret                    `json:"smtpSecret,omitempty"`
	OAuthClientSecrets            []OAuthClientSecret            `json:"oauthClientSecrets,omitempty"`
}

func NewSecretConfig

func NewSecretConfig(secretConfig *config.SecretConfig, unmaskedSecrets []config.SecretKey, now time.Time) (*SecretConfig, error)

type Subscription

type Subscription struct {
	ID                   string     `json:"id"`
	AppID                string     `json:"appID"`
	StripeSubscriptionID string     `json:"stripeSubscriptionID"`
	StripeCustomerID     string     `json:"stripeCustomerID"`
	CreatedAt            time.Time  `json:"createdAt"`
	UpdatedAt            time.Time  `json:"updatedAt"`
	CancelledAt          *time.Time `json:"cancelledAt"`
	EndedAt              *time.Time `json:"endedAt"`
}

Subscription represents an app subscription. The keys in JSON struct tags are in camel case because this struct is directly returned in the GraphQL endpoint. Making the keys in camel case saves us from writing boilerplate resolver code.

type SubscriptionCheckout

type SubscriptionCheckout struct {
	ID                      string
	AppID                   string
	StripeCheckoutSessionID string
	StripeCustomerID        *string
	Status                  SubscriptionCheckoutStatus
	CreatedAt               time.Time
	UpdatedAt               time.Time
	ExpireAt                time.Time
}

type SubscriptionCheckoutStatus

type SubscriptionCheckoutStatus string
const (
	// SubscriptionCheckoutStatusOpen is the initial status.
	SubscriptionCheckoutStatusOpen SubscriptionCheckoutStatus = "open"
	// SubscriptionCheckoutStatusCompleted represents the Stripe customer is created.
	SubscriptionCheckoutStatusCompleted SubscriptionCheckoutStatus = "completed"
	// SubscriptionCheckoutStatusSubscribed represents the Stripe subscription is active.
	SubscriptionCheckoutStatusSubscribed SubscriptionCheckoutStatus = "subscribed"
	// SubscriptionCheckoutStatusCancelled represents the Stripe subscription is cancelled.
	SubscriptionCheckoutStatusCancelled SubscriptionCheckoutStatus = "cancelled"
	// SubscriptionCheckoutStatusExpired represents the Stripe subscription is incomplete_expired.
	SubscriptionCheckoutStatusExpired SubscriptionCheckoutStatus = "expired"
)

type SubscriptionPlan

type SubscriptionPlan struct {
	Name   string   `json:"name"`
	Prices []*Price `json:"prices,omitempty"`
}

func NewSubscriptionPlan

func NewSubscriptionPlan(planName string) *SubscriptionPlan

type SubscriptionUpdatePreview

type SubscriptionUpdatePreview struct {
	Currency  string `json:"currency"`
	AmountDue int    `json:"amountDue"`
}

type SubscriptionUsage

type SubscriptionUsage struct {
	NextBillingDate time.Time                `json:"nextBillingDate"`
	Items           []*SubscriptionUsageItem `json:"items,omitempty"`
}

type SubscriptionUsageItem

type SubscriptionUsageItem struct {
	Type                      PriceType              `json:"type"`
	UsageType                 UsageType              `json:"usageType"`
	SMSRegion                 SMSRegion              `json:"smsRegion"`
	WhatsappRegion            WhatsappRegion         `json:"whatsappRegion"`
	Currency                  *string                `json:"currency"`
	UnitAmount                *int                   `json:"unitAmount"`
	FreeQuantity              *int                   `json:"freeQuantity,omitempty"`
	TransformQuantityDivideBy *int                   `json:"transformQuantityDivideBy,omitempty"`
	TransformQuantityRound    TransformQuantityRound `json:"transformQuantityRound,omitempty"`

	Quantity    int  `json:"quantity"`
	TotalAmount *int `json:"totalAmount"`
}

func (*SubscriptionUsageItem) FillFrom

func (*SubscriptionUsageItem) Match

func (i *SubscriptionUsageItem) Match(p *Price) bool

type SystemConfig

type SystemConfig struct {
	AuthgearClientID   string         `json:"authgearClientID"`
	AuthgearEndpoint   string         `json:"authgearEndpoint"`
	SentryDSN          string         `json:"sentryDSN,omitempty"`
	AppHostSuffix      string         `json:"appHostSuffix"`
	AvailableLanguages []string       `json:"availableLanguages"`
	BuiltinLanguages   []string       `json:"builtinLanguages"`
	Themes             interface{}    `json:"themes,omitempty"`
	Translations       interface{}    `json:"translations,omitempty"`
	SearchEnabled      bool           `json:"searchEnabled"`
	Web3Enabled        bool           `json:"web3Enabled"`
	AuditLogEnabled    bool           `json:"auditLogEnabled"`
	AnalyticEnabled    bool           `json:"analyticEnabled"`
	AnalyticEpoch      *timeutil.Date `json:"analyticEpoch,omitempty"`
	GitCommitHash      string         `json:"gitCommitHash,omitempty"`
	GTMContainerID     string         `json:"gtmContainerID,omitempty"`
}

type TransformQuantityRound

type TransformQuantityRound string
const (
	TransformQuantityRoundNone TransformQuantityRound = ""
	TransformQuantityRoundUp   TransformQuantityRound = "up"
	TransformQuantityRoundDown TransformQuantityRound = "down"
)

func (TransformQuantityRound) Valid

func (r TransformQuantityRound) Valid() error

type UsageType

type UsageType string
const (
	UsageTypeNone     UsageType = ""
	UsageTypeSMS      UsageType = "sms"
	UsageTypeWhatsapp UsageType = "whatsapp"
	UsageTypeMAU      UsageType = "mau"
)

func (UsageType) Valid

func (t UsageType) Valid() error

type User

type User struct {
	ID                string `json:"id"`
	Email             string `json:"email,omitempty"`
	FormattedName     string `json:"formattedName,omitempty"`
	ProjectQuota      *int   `json:"projectQuota,omitempty"`
	ProjectOwnerCount int    `json:"projectOwnerCount,"`
	GeoIPCountryCode  string `json:"geoIPCountryCode,omitempty"`
}

type WebhookSecret

type WebhookSecret struct {
	Secret *string `json:"secret,omitempty"`
}

type WhatsappRegion

type WhatsappRegion string
const (
	WhatsappRegionNone         WhatsappRegion = ""
	WhatsappRegionNorthAmerica WhatsappRegion = "north-america"
	WhatsappRegionOtherRegions WhatsappRegion = "other-regions"
)

func (WhatsappRegion) Valid

func (r WhatsappRegion) Valid() error

Jump to

Keyboard shortcuts

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