model

package
v0.0.0-...-cab84a2 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: Apache-2.0 Imports: 8 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 BotProtectionProviderSecret

type BotProtectionProviderSecret struct {
	Type      config.BotProtectionProviderType `json:"type,omitempty"`
	SecretKey *string                          `json:"secretKey,omitempty"`
}

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 {
	SurveyJSON string `json:"onboarding_survey_json"`
}

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 SAMLIdpSigningCertificate

type SAMLIdpSigningCertificate struct {
	KeyID                  string `json:"keyID,omitempty"`
	CertificateFingerprint string `json:"certificateFingerprint,omitempty"`
	CertificatePEM         string `json:"certificatePEM,omitempty"`
}

type SAMLIdpSigningSecrets

type SAMLIdpSigningSecrets struct {
	Certificates []SAMLIdpSigningCertificate `json:"certificates,omitempty"`
}

type SAMLSpSigningCertificate

type SAMLSpSigningCertificate struct {
	CertificateFingerprint string `json:"certificateFingerprint,omitempty"`
	CertificatePEM         string `json:"certificatePEM,omitempty"`
}

type SAMLSpSigningSecrets

type SAMLSpSigningSecrets struct {
	ClientID     string                     `json:"clientID,omitempty"`
	Certificates []SAMLSpSigningCertificate `json:"certificates,omitempty"`
}

type SMSProviderConfigurationDenoInput

type SMSProviderConfigurationDenoInput struct {
	Script  string `json:"script,omitempty"`
	Timeout *int   `json:"timeout,omitempty"`
}

type SMSProviderConfigurationInput

type SMSProviderConfigurationInput struct {
	Twilio  *SMSProviderConfigurationTwilioInput  `json:"twilio,omitempty"`
	Webhook *SMSProviderConfigurationWebhookInput `json:"webhook,omitempty"`
	Deno    *SMSProviderConfigurationDenoInput    `json:"deno,omitempty"`
}

type SMSProviderConfigurationTwilioInput

type SMSProviderConfigurationTwilioInput struct {
	AccountSID          string  `json:"accountSID,omitempty"`
	AuthToken           string  `json:"authToken,omitempty"`
	MessagingServiceSID *string `json:"messagingServiceSID,omitempty"`
}

type SMSProviderConfigurationWebhookInput

type SMSProviderConfigurationWebhookInput struct {
	URL     string `json:"url,omitempty"`
	Timeout *int   `json:"timeout,omitempty"`
}

type SMSProviderCustomSMSProviderConfigs

type SMSProviderCustomSMSProviderConfigs struct {
	URL     string `json:"url,omitempty"`
	Timeout *int   `json:"timeout,omitempty"`
}

type SMSProviderSecrets

type SMSProviderSecrets struct {
	TwilioCredentials            *SMSProviderTwilioCredentials        `json:"twilioCredentials,omitempty"`
	CustomSMSProviderCredentials *SMSProviderCustomSMSProviderConfigs `json:"customSMSProviderCredentials,omitempty"`
}

type SMSProviderTwilioCredentials

type SMSProviderTwilioCredentials struct {
	AccountSID          string  `json:"accountSID,omitempty"`
	AuthToken           *string `json:"authToken,omitempty"`
	MessagingServiceSID string  `json:"messagingServiceSID,omitempty"`
}

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"`
	BotProtectionProviderSecret   *BotProtectionProviderSecret   `json:"botProtectionProviderSecret,omitempty"`
	SAMLIdpSigningSecrets         *SAMLIdpSigningSecrets         `json:"samlIdpSigningSecrets,omitempty"`
	SAMLSpSigningSecrets          []SAMLSpSigningSecrets         `json:"samlSpSigningSecrets,omitempty"`
	SMSProviderSecrets            *SMSProviderSecrets            `json:"smsProviderSecrets,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"`
	Version string   `json:"version"`
	Prices  []*Price `json:"prices,omitempty"`
}

func NewSubscriptionPlan

func NewSubscriptionPlan(planName string, version 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"`
	AuthgearWebSDKSessionType string         `json:"authgearWebSDKSessionType"`
	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"`
	AuditLogEnabled           bool           `json:"auditLogEnabled"`
	AnalyticEnabled           bool           `json:"analyticEnabled"`
	AnalyticEpoch             *timeutil.Date `json:"analyticEpoch,omitempty"`
	GitCommitHash             string         `json:"gitCommitHash,omitempty"`
	GTMContainerID            string         `json:"gtmContainerID,omitempty"`
	UIImplementation          string         `json:"uiImplementation,omitempty"`
	UISettingsImplementation  string         `json:"uiSettingsImplementation,omitempty"`
	ShowCustomSMSGateway      bool           `json:"showCustomSMSGateway,omitempty"`
}

type TransformQuantityRound

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

func (TransformQuantityRound) Valid

func (r TransformQuantityRound) Valid() error

type Usage

type Usage struct {
	Items []UsageItem `json:"items"`
}

type UsageItem

type UsageItem struct {
	UsageType      UsageType      `json:"usageType"`
	SMSRegion      SMSRegion      `json:"smsRegion"`
	WhatsappRegion WhatsappRegion `json:"whatsappRegion"`
	Quantity       int            `json:"quantity"`
}

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