graphql

package
v0.0.0-...-81dc835 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AccessDenied = apierrors.Forbidden.WithReason("AccessDenied")
View Source
var AppConfig = graphqlutil.NewJSONObjectScalar(
	"AppConfig",
	"The `AppConfig` scalar type represents an app config JSON object",
)
View Source
var DependencySet = wire.NewSet(
	NewLogger,
	wire.Struct(new(Context), "*"),
)
View Source
var FeatureConfig = graphqlutil.NewJSONObjectScalar(
	"FeatureConfig",
	"The `FeatureConfig` scalar type represents an feature config JSON object",
)
View Source
var QuotaExceeded = apierrors.Invalid.WithReason("QuotaExceeded")
View Source
var Schema *graphql.Schema
View Source
var StripeError = graphqlutil.NewJSONObjectScalar(
	"StripeError",
	"The `StripeError` scalar type represents Stripe error",
)
View Source
var TutorialStatusData = graphqlutil.NewJSONObjectScalar(
	"TutorialStatusData",
	"The `TutorialStatusData` scalar type represents tutorial status data",
)
View Source
var Unauthenticated = apierrors.Unauthorized.WithReason("Unauthenticated")

Functions

func WithContext

func WithContext(ctx context.Context, gqlContext *Context) context.Context

Types

type AnalyticChartService

type AnalyticChartService interface {
	GetActiveUserChart(ctx context.Context, appID string, periodical string, rangeFrom time.Time, rangeTo time.Time) (*analytic.Chart, error)
	GetTotalUserCountChart(ctx context.Context, appID string, rangeFrom time.Time, rangeTo time.Time) (*analytic.Chart, error)
	GetSignupConversionRate(ctx context.Context, appID string, rangeFrom time.Time, rangeTo time.Time) (*analytic.SignupConversionRateData, error)
	GetSignupByMethodsChart(ctx context.Context, appID string, rangeFrom time.Time, rangeTo time.Time) (*analytic.Chart, error)
}

type AppLoader

type AppLoader interface {
	graphqlutil.DataLoaderInterface
}

type AppResourceManagerFactory

type AppResourceManagerFactory interface {
	NewManagerWithAppContext(appContext *config.AppContext) *appresource.Manager
}

type AppSecretKey

type AppSecretKey string
const (
	AppSecretKeyOauthSSOProviderClientSecrets AppSecretKey = "oauthSSOProviderClientSecrets" // nolint:gosec
	AppSecretKeyWebhookSecret                 AppSecretKey = "webhookSecret"
	AppSecretKeyAdminAPISecrets               AppSecretKey = "adminAPISecrets"
	AppSecretKeySmtpSecret                    AppSecretKey = "smtpSecret"
	AppSecretKeyOauthClientSecrets            AppSecretKey = "oauthClientSecrets" // nolint:gosec
	AppSecretKeyBotProtectionProviderSecret   AppSecretKey = "botProtectionProviderSecret"
	AppSecretKeySAMLIdpSigningSecrets         AppSecretKey = "samlIdpSigningSecrets" // nolint:gosec
	AppSecretKeySAMLSpSigningSecrets          AppSecretKey = "samlSpSigningSecrets"  // nolint:gosec
)

type AppService

type AppService interface {
	LoadRawAppConfig(app *model.App) (*config.AppConfig, string, error)
	RenderSAMLEntityID(appID string) string

	Get(ctx context.Context, id string) (*model.App, error)
	GetAppList(ctx context.Context, userID string) ([]*model.AppListItem, error)
	Create(ctx context.Context, userID string, id string) (*model.App, error)
	UpdateResources(ctx context.Context, app *model.App, updates []appresource.Update) error
	UpdateResources0(ctx context.Context, app *model.App, updates []appresource.Update) error
	GetProjectQuota(ctx context.Context, userID string) (int, error)
	LoadAppSecretConfig(ctx context.Context, app *model.App, sessionInfo *apimodel.SessionInfo, token string) (*model.SecretConfig, string, error)
	GenerateSecretVisitToken(ctx context.Context,
		app *model.App,
		sessionInfo *apimodel.SessionInfo,
		visitingSecrets []config.SecretKey,
	) (*appsecret.AppSecretVisitToken, error)
	GenerateTesterToken(ctx context.Context,
		app *model.App,
		returnURI string,
	) (*tester.TesterToken, error)
}

type AuditService

type AuditService interface {
	Log(ctx context.Context, app *model.App, payload event.NonBlockingPayload) error
}

type AuthzService

type AuthzService interface {
	CheckAccessOfViewer(ctx context.Context, appID string) (userID string, err error)
}

type CollaboratorInvitationLoader

type CollaboratorInvitationLoader interface {
	graphqlutil.DataLoaderInterface
}

type CollaboratorLoader

type CollaboratorLoader interface {
	graphqlutil.DataLoaderInterface
}

type CollaboratorService

type CollaboratorService interface {
	GetCollaborator(ctx context.Context, id string) (*model.Collaborator, error)
	GetCollaboratorByAppAndUser(ctx context.Context, appID string, userID string) (*model.Collaborator, error)
	ListCollaborators(ctx context.Context, appID string) ([]*model.Collaborator, error)
	ListCollaboratorsByUser(ctx context.Context, userID string) ([]*model.Collaborator, error)
	DeleteCollaborator(ctx context.Context, c *model.Collaborator) error

	GetProjectOwnerCount(ctx context.Context, userID string) (int, error)

	GetInvitation(ctx context.Context, id string) (*model.CollaboratorInvitation, error)
	GetInvitationWithCode(ctx context.Context, id string) (*model.CollaboratorInvitation, error)
	ListInvitations(ctx context.Context, appID string) ([]*model.CollaboratorInvitation, error)
	DeleteInvitation(ctx context.Context, i *model.CollaboratorInvitation) error
	SendInvitation(ctx context.Context, appID string, inviteeEmail string) (*model.CollaboratorInvitation, error)
	AcceptInvitation(ctx context.Context, code string) (*model.Collaborator, error)
	CheckInviteeEmail(ctx context.Context, i *model.CollaboratorInvitation, actorID string) error
}

type Context

type Context struct {
	Request   *http.Request
	GQLLogger Logger

	GlobalDatabase *globaldb.Handle

	TrustProxy              config.TrustProxy
	Users                   UserLoader
	Apps                    AppLoader
	Domains                 DomainLoader
	Collaborators           CollaboratorLoader
	CollaboratorInvitations CollaboratorInvitationLoader

	AuthzService         AuthzService
	AppService           AppService
	DomainService        DomainService
	CollaboratorService  CollaboratorService
	SMTPService          SMTPService
	AppResMgrFactory     AppResourceManagerFactory
	AnalyticChartService AnalyticChartService
	TutorialService      TutorialService
	StripeService        StripeService
	SubscriptionService  SubscriptionService
	UsageService         UsageService
	DenoService          DenoService
	AuditService         AuditService
	OnboardService       OnboardService
}

func GQLContext

func GQLContext(ctx context.Context) *Context

func (*Context) Logger

func (c *Context) Logger() *log.Logger

type DenoService

type DenoService interface {
	Check(ctx context.Context, snippet string) error
}

type DomainLoader

type DomainLoader interface {
	graphqlutil.DataLoaderInterface
}

type DomainService

type DomainService interface {
	ListDomains(ctx context.Context, appID string) ([]*apimodel.Domain, error)
	CreateCustomDomain(ctx context.Context, appID string, domain string) (*apimodel.Domain, error)
	DeleteDomain(ctx context.Context, appID string, id string) error
	VerifyDomain(ctx context.Context, appID string, id string) (*apimodel.Domain, error)
}

type Logger

type Logger struct{ *log.Logger }

func NewLogger

func NewLogger(lf *log.Factory) Logger

type NodeResolver

type NodeResolver func(ctx context.Context, id string) (interface{}, error)

type OnboardService

type OnboardService interface {
	SubmitOnboardEntry(ctx context.Context, entry model.OnboardEntry, actorID string) error
	CheckOnboardingSurveyCompletion(ctx context.Context, actorID string) (bool, error)
}

type SMTPService

type SMTPService interface {
	SendTestEmail(ctx context.Context, app *model.App, options smtp.SendTestEmailOptions) (err error)
}

type StripeService

type StripeService interface {
	GenerateCustomerPortalSession(appID string, customerID string) (*stripe.BillingPortalSession, error)
	SetSubscriptionCancelAtPeriodEnd(stripeSubscriptionID string, cancelAtPeriodEnd bool) (*time.Time, error)

	FetchSubscriptionPlans(ctx context.Context) ([]*model.SubscriptionPlan, error)
	CreateCheckoutSession(ctx context.Context, appID string, customerEmail string, subscriptionPlan *model.SubscriptionPlan) (*libstripe.CheckoutSession, error)
	FetchCheckoutSession(ctx context.Context, checkoutSessionID string) (*libstripe.CheckoutSession, error)
	GetSubscriptionPlan(ctx context.Context, planName string) (*model.SubscriptionPlan, error)
	UpdateSubscription(ctx context.Context, stripeSubscriptionID string, subscriptionPlan *model.SubscriptionPlan) error
	PreviewUpdateSubscription(ctx context.Context, stripeSubscriptionID string, subscriptionPlan *model.SubscriptionPlan) (*model.SubscriptionUpdatePreview, error)
	GetLastPaymentError(ctx context.Context, stripeCustomerID string) (*stripe.Error, error)
	GetSubscription(ctx context.Context, stripeCustomerID string) (*stripe.Subscription, error)
	CancelSubscriptionImmediately(ctx context.Context, subscriptionID string) error
}

type SubscriptionService

type SubscriptionService interface {
	GetSubscription(ctx context.Context, appID string) (*model.Subscription, error)
	CreateSubscriptionCheckout(ctx context.Context, stripeCheckoutSession *libstripe.CheckoutSession) (*model.SubscriptionCheckout, error)
	MarkCheckoutCompleted(ctx context.Context, appID string, stripCheckoutSessionID string, customerID string) error
	GetSubscriptionUsage(ctx context.Context,
		appID string,
		planName string,
		date time.Time,
		subscriptionPlans []*model.SubscriptionPlan,
	) (*model.SubscriptionUsage, error)
	UpdateAppPlan(ctx context.Context, appID string, planName string) error
	SetSubscriptionCancelledStatus(ctx context.Context, id string, cancelled bool, endedAt *time.Time) error
	GetLastProcessingCustomerID(ctx context.Context, appID string) (*string, error)
	MarkCheckoutExpired(ctx context.Context, appID string, customerID string) error
}

type TutorialService

type TutorialService interface {
	Get(ctx context.Context, appID string) (*tutorial.Entry, error)
	RecordProgresses(ctx context.Context, appID string, ps []tutorial.Progress) (err error)
	Skip(ctx context.Context, appID string) (err error)
}

type UsageService

type UsageService interface {
	GetUsage(ctx context.Context,
		appID string,
		date time.Time,
	) (*model.Usage, error)
}

type UserLoader

type UserLoader interface {
	graphqlutil.DataLoaderInterface
}

Jump to

Keyboard shortcuts

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