types

package
v0.0.0-...-98cd694 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Unlicense Imports: 19 Imported by: 1

Documentation

Overview

Package types provides the core data types for the service

Index

Constants

View Source
const (
	// AccountInvitationCreatedCustomerEventType indicates a account invitation was created.
	AccountInvitationCreatedCustomerEventType ServiceEventType = "account_invitation_created"
	// AccountInvitationCanceledCustomerEventType indicates a account invitation was created.
	AccountInvitationCanceledCustomerEventType ServiceEventType = "account_invitation_canceled"
	// AccountInvitationAcceptedCustomerEventType indicates a account invitation was created.
	AccountInvitationAcceptedCustomerEventType ServiceEventType = "account_invitation_accepted"
	// AccountInvitationRejectedCustomerEventType indicates a account invitation was created.
	AccountInvitationRejectedCustomerEventType ServiceEventType = "account_invitation_rejected"

	// PendingAccountInvitationStatus indicates a account invitation is pending.
	PendingAccountInvitationStatus AccountInvitationStatus = "pending"
	// CancelledAccountInvitationStatus indicates a account invitation was accepted.
	CancelledAccountInvitationStatus AccountInvitationStatus = "cancelled"
	// AcceptedAccountInvitationStatus indicates a account invitation was accepted.
	AcceptedAccountInvitationStatus AccountInvitationStatus = "accepted"
	// RejectedAccountInvitationStatus indicates a account invitation was rejected.
	RejectedAccountInvitationStatus AccountInvitationStatus = "rejected"
)
View Source
const (
	AuditLogEventTypeOther    = "other"
	AuditLogEventTypeCreated  = "created"
	AuditLogEventTypeUpdated  = "updated"
	AuditLogEventTypeArchived = "archived"

	AuditLogResourceTypesQueryParamKey = "resources"
)
View Source
const (
	// SessionContextDataKey is the non-string type we use for referencing SessionContextData structs.
	SessionContextDataKey ContextKey = "session_context_data"
	// UserIDContextKey is the non-string type we use for referencing SessionContextData structs.
	UserIDContextKey ContextKey = "user_id"
	// AccountIDContextKey is the non-string type we use for referencing SessionContextData structs.
	AccountIDContextKey ContextKey = "account_id"
	// UserRegistrationInputContextKey is the non-string type we use for referencing SessionContextData structs.
	UserRegistrationInputContextKey ContextKey = "user_registration_input"

	// TwoFactorSecretVerifiedCustomerEventType indicates a user's two factor secret was verified.
	/* #nosec G101 */
	TwoFactorSecretVerifiedCustomerEventType ServiceEventType = "two_factor_secret_verified"
	// TwoFactorDeactivatedCustomerEventType indicates a user's two factor secret was changed and verified_at timestamp was reset.
	/* #nosec G101 */
	TwoFactorDeactivatedCustomerEventType ServiceEventType = "two_factor_deactivated"
	// TwoFactorSecretChangedCustomerEventType indicates a user's two factor secret was changed and verified_at timestamp was reset.
	/* #nosec G101 */
	TwoFactorSecretChangedCustomerEventType ServiceEventType = "two_factor_secret_changed"
	// PasswordResetTokenCreatedEventType indicates a user created a password reset token.
	PasswordResetTokenCreatedEventType ServiceEventType = "password_reset_token_created"
	// PasswordResetTokenRedeemedEventType indicates a user created a password reset token.
	PasswordResetTokenRedeemedEventType ServiceEventType = "password_reset_token_redeemed"
	// PasswordChangedEventType indicates a user changed their password.
	PasswordChangedEventType ServiceEventType = "password_changed"
	// EmailAddressChangedEventType indicates a user changed their email address.
	EmailAddressChangedEventType ServiceEventType = "email_address_changed"
	// UsernameChangedEventType indicates a user changed their username.
	UsernameChangedEventType ServiceEventType = "username_changed"
	// UserDetailsChangedEventType indicates a user changed their information.
	UserDetailsChangedEventType ServiceEventType = "user_details_changed"
	// UsernameReminderRequestedEventType indicates a user requested a username reminder.
	UsernameReminderRequestedEventType ServiceEventType = "username_reminder_requested"
	// UserLoggedInCustomerEventType indicates a user has logged in.
	UserLoggedInCustomerEventType ServiceEventType = "user_logged_in"
	// UserLoggedOutCustomerEventType indicates a user has logged in.
	UserLoggedOutCustomerEventType ServiceEventType = "user_logged_out"
	// UserChangedActiveAccountCustomerEventType indicates a user has logged in.
	UserChangedActiveAccountCustomerEventType ServiceEventType = "changed_active_account"
	// UserEmailAddressVerifiedEventType indicates a user created a password reset token.
	UserEmailAddressVerifiedEventType ServiceEventType = "user_email_address_verified"
	// UserEmailAddressVerificationEmailRequestedEventType indicates a user created a password reset token.
	UserEmailAddressVerificationEmailRequestedEventType ServiceEventType = "user_email_address_verification_email_requested"
)
View Source
const (
	// MaxLimit is the maximum value for list queries.
	MaxLimit = 250
	// DefaultLimit represents how many results we return in a response by default.
	DefaultLimit = 50

	// SearchQueryKey is the query param key to find search queries in requests.
	SearchQueryKey = "q"
	// SearchWithDatabaseQueryKey is the query param key to find search queries in requests.
	SearchWithDatabaseQueryKey = "useDB"
	// LimitQueryKey is the query param key to specify a limit in a query.
	LimitQueryKey = "limit"
)
View Source
const (
	// UserSignedUpCustomerEventType indicates a user signed up.
	UserSignedUpCustomerEventType ServiceEventType = "user_signed_up"
	// UserArchivedCustomerEventType indicates a user deleted their account.
	UserArchivedCustomerEventType ServiceEventType = "user_archived"

	// GoodStandingUserAccountStatus indicates a User's account is in good standing.
	GoodStandingUserAccountStatus userAccountStatus = "good"
	// UnverifiedAccountStatus indicates a User's account requires two factor secret verification.
	UnverifiedAccountStatus userAccountStatus = "unverified"
	// BannedUserAccountStatus indicates a User's account is banned.
	BannedUserAccountStatus userAccountStatus = "banned"
	// TerminatedUserAccountStatus indicates a User's account is banned.
	TerminatedUserAccountStatus userAccountStatus = "terminated"
)
View Source
const (
	// UserNotificationCreatedCustomerEventType indicates a user notification was created.
	UserNotificationCreatedCustomerEventType ServiceEventType = "user_notification_created"
	// UserNotificationUpdatedCustomerEventType indicates a user notification was updated.
	UserNotificationUpdatedCustomerEventType ServiceEventType = "user_notification_updated"
	// UserNotificationArchivedCustomerEventType indicates a user notification was archived.
	UserNotificationArchivedCustomerEventType ServiceEventType = "user_notification_archived"

	// UserNotificationStatusTypeUnread represents the user notification status type for unread.
	UserNotificationStatusTypeUnread = "unread"
	// UserNotificationStatusTypeRead represents the user notification status type for read.
	UserNotificationStatusTypeRead = "read"
	// UserNotificationStatusTypeDismissed represents the user notification status type for dismissed.
	UserNotificationStatusTypeDismissed = "dismissed"
)

Variables

View Source
var (
	// SortAscending is the pre-determined Ascending string for external use.
	SortAscending = func(x string) *string { return &x }(sortAscendingString)
	// SortDescending is the pre-determined Descending string for external use.
	SortDescending = func(x string) *string { return &x }(sortDescendingString)
)

Functions

func Merge

func Merge(into, from any) error

Merge will copy fields from the second variable into the first.

Types

type APIError

type APIError struct {
	Message string    `json:"message"`
	Code    ErrorCode `json:"code"`
	// contains filtered or unexported fields
}

APIError represents a response we might send to the User in the event of an error.

func (*APIError) AsError

func (e *APIError) AsError() error

AsError returns the error message.

func (*APIError) Error

func (e *APIError) Error() string

Error returns the error message.

type APIResponse

type APIResponse[T any] struct {
	Data       T               `json:"data,omitempty"`
	Pagination *Pagination     `json:"pagination,omitempty"`
	Error      *APIError       `json:"error,omitempty"`
	Details    ResponseDetails `json:"details"`
	// contains filtered or unexported fields
}

APIResponse represents a response we might send to the user.

func NewAPIErrorResponse

func NewAPIErrorResponse(issue string, code ErrorCode, details ResponseDetails) *APIResponse[any]

NewAPIErrorResponse returns a new APIResponse with an error field.

type Account

type Account struct {
	CreatedAt                  time.Time                        `json:"createdAt"`
	SubscriptionPlanID         *string                          `json:"subscriptionPlanID"`
	LastUpdatedAt              *time.Time                       `json:"lastUpdatedAt"`
	ArchivedAt                 *time.Time                       `json:"archivedAt"`
	Longitude                  *float64                         `json:"longitude"`
	Latitude                   *float64                         `json:"latitude"`
	State                      string                           `json:"state"`
	ContactPhone               string                           `json:"contactPhone"`
	City                       string                           `json:"city"`
	AddressLine1               string                           `json:"addressLine1"`
	ZipCode                    string                           `json:"zipCode"`
	Country                    string                           `json:"country"`
	BillingStatus              string                           `json:"billingStatus"`
	AddressLine2               string                           `json:"addressLine2"`
	PaymentProcessorCustomerID string                           `json:"paymentProcessorCustomer"`
	BelongsToUser              string                           `json:"belongsToUser"`
	ID                         string                           `json:"id"`
	Name                       string                           `json:"name"`
	WebhookEncryptionKey       string                           `json:"-"`
	Members                    []*AccountUserMembershipWithUser `json:"members"`
	// contains filtered or unexported fields
}

Account represents a account.

func (*Account) Update

func (x *Account) Update(input *AccountUpdateRequestInput)

Update merges a AccountUpdateRequestInput with a account.

type AccountCreationRequestInput

type AccountCreationRequestInput struct {
	Latitude     *float64 `json:"latitude"`
	Longitude    *float64 `json:"longitude"`
	Name         string   `json:"name"`
	ContactPhone string   `json:"contactPhone"`
	AddressLine1 string   `json:"addressLine1"`
	AddressLine2 string   `json:"addressLine2"`
	City         string   `json:"city"`
	State        string   `json:"state"`
	ZipCode      string   `json:"zipCode"`
	Country      string   `json:"country"`
	// contains filtered or unexported fields
}

AccountCreationRequestInput represents what a User could set as input for creating accounts.

func (*AccountCreationRequestInput) ValidateWithContext

func (x *AccountCreationRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a AccountCreationRequestInput.

type AccountDataManager

type AccountDataManager interface {
	GetAccount(ctx context.Context, accountID string) (*Account, error)
	GetAccounts(ctx context.Context, userID string, filter *QueryFilter) (*QueryFilteredResult[Account], error)
	CreateAccount(ctx context.Context, input *AccountDatabaseCreationInput) (*Account, error)
	UpdateAccount(ctx context.Context, updated *Account) error
	ArchiveAccount(ctx context.Context, accountID string, userID string) error
}

AccountDataManager describes a structure capable of storing accounts permanently.

type AccountDataService

type AccountDataService interface {
	ListHandler(http.ResponseWriter, *http.Request)
	CreateHandler(http.ResponseWriter, *http.Request)
	CurrentInfoHandler(http.ResponseWriter, *http.Request)
	ReadHandler(http.ResponseWriter, *http.Request)
	UpdateHandler(http.ResponseWriter, *http.Request)
	ArchiveHandler(http.ResponseWriter, *http.Request)
	RemoveMemberHandler(http.ResponseWriter, *http.Request)
	MarkAsDefaultAccountHandler(http.ResponseWriter, *http.Request)
	ModifyMemberPermissionsHandler(http.ResponseWriter, *http.Request)
	TransferAccountOwnershipHandler(http.ResponseWriter, *http.Request)
}

AccountDataService describes a structure capable of serving traffic related to accounts.

type AccountDatabaseCreationInput

type AccountDatabaseCreationInput struct {
	ID                   string
	Name                 string
	AddressLine1         string
	AddressLine2         string
	City                 string
	State                string
	ZipCode              string
	Country              string
	Latitude             *float64
	Longitude            *float64
	ContactPhone         string
	BelongsToUser        string
	WebhookEncryptionKey string
	// contains filtered or unexported fields
}

AccountDatabaseCreationInput represents what a User could set as input for creating accounts.

func AccountCreationInputForNewUser

func AccountCreationInputForNewUser(u *User) *AccountDatabaseCreationInput

AccountCreationInputForNewUser creates a new AccountInputCreation struct for a given user.

type AccountInvitation

type AccountInvitation struct {
	CreatedAt          time.Time  `json:"createdAt"`
	LastUpdatedAt      *time.Time `json:"lastUpdatedAt"`
	ArchivedAt         *time.Time `json:"archivedAt"`
	ToUser             *string    `json:"toUser"`
	Status             string     `json:"status"`
	ToEmail            string     `json:"toEmail"`
	StatusNote         string     `json:"statusNote"`
	Token              string     `json:"token"`
	ID                 string     `json:"id"`
	Note               string     `json:"note"`
	ToName             string     `json:"toName"`
	ExpiresAt          time.Time  `json:"expiresAt"`
	DestinationAccount Account    `json:"destinationAccount"`
	FromUser           User       `json:"fromUser"`
	// contains filtered or unexported fields
}

AccountInvitation represents a account invitation.

type AccountInvitationCreationRequestInput

type AccountInvitationCreationRequestInput struct {
	ExpiresAt *time.Time `json:"expiresAt"`
	Note      string     `json:"note"`
	ToEmail   string     `json:"toEmail"`
	ToName    string     `json:"toName"`
	// contains filtered or unexported fields
}

AccountInvitationCreationRequestInput represents what a User could set as input for creating account invitations.

func (*AccountInvitationCreationRequestInput) ValidateWithContext

func (x *AccountInvitationCreationRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a AccountCreationRequestInput.

type AccountInvitationDataManager

type AccountInvitationDataManager interface {
	AccountInvitationExists(ctx context.Context, accountInvitationID string) (bool, error)
	GetAccountInvitationByAccountAndID(ctx context.Context, accountID, accountInvitationID string) (*AccountInvitation, error)
	GetAccountInvitationByTokenAndID(ctx context.Context, token, invitationID string) (*AccountInvitation, error)
	GetAccountInvitationByEmailAndToken(ctx context.Context, emailAddress, token string) (*AccountInvitation, error)
	GetPendingAccountInvitationsFromUser(ctx context.Context, userID string, filter *QueryFilter) (*QueryFilteredResult[AccountInvitation], error)
	GetPendingAccountInvitationsForUser(ctx context.Context, userID string, filter *QueryFilter) (*QueryFilteredResult[AccountInvitation], error)
	CreateAccountInvitation(ctx context.Context, input *AccountInvitationDatabaseCreationInput) (*AccountInvitation, error)
	CancelAccountInvitation(ctx context.Context, accountInvitationID, note string) error
	AcceptAccountInvitation(ctx context.Context, accountInvitationID, token, note string) error
	RejectAccountInvitation(ctx context.Context, accountInvitationID, note string) error
}

AccountInvitationDataManager describes a structure capable of storing account invitations permanently.

type AccountInvitationDataService

type AccountInvitationDataService interface {
	ReadHandler(http.ResponseWriter, *http.Request)
	InboundInvitesHandler(http.ResponseWriter, *http.Request)
	OutboundInvitesHandler(http.ResponseWriter, *http.Request)
	InviteMemberHandler(http.ResponseWriter, *http.Request)
	CancelInviteHandler(http.ResponseWriter, *http.Request)
	AcceptInviteHandler(http.ResponseWriter, *http.Request)
	RejectInviteHandler(http.ResponseWriter, *http.Request)
}

AccountInvitationDataService describes a structure capable of serving traffic related to account invitations.

type AccountInvitationDatabaseCreationInput

type AccountInvitationDatabaseCreationInput struct {
	ID                   string
	FromUser             string
	ToUser               *string
	Note                 string
	ToEmail              string
	Token                string
	ToName               string
	ExpiresAt            time.Time
	DestinationAccountID string
	// contains filtered or unexported fields
}

AccountInvitationDatabaseCreationInput represents what a User could set as input for creating account invitations.

type AccountInvitationStatus

type AccountInvitationStatus string

AccountInvitationStatus is the type to use/compare against when checking invitation status.

type AccountInvitationUpdateRequestInput

type AccountInvitationUpdateRequestInput struct {
	Token string `json:"token"`
	Note  string `json:"note"`
}

AccountInvitationUpdateRequestInput is used by users to update the status of a given account invitation.

func (*AccountInvitationUpdateRequestInput) ValidateWithContext

func (x *AccountInvitationUpdateRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a AccountInvitationUpdateRequestInput.

type AccountOwnershipTransferInput

type AccountOwnershipTransferInput struct {
	Reason       string `json:"reason"`
	CurrentOwner string `json:"currentOwner"`
	NewOwner     string `json:"newOwner"`
	// contains filtered or unexported fields
}

AccountOwnershipTransferInput represents what a User could set as input for updating account user memberships.

func (*AccountOwnershipTransferInput) ValidateWithContext

func (x *AccountOwnershipTransferInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a AccountOwnershipTransferInput.

type AccountUpdateRequestInput

type AccountUpdateRequestInput struct {
	Name          *string  `json:"name,omitempty"`
	ContactPhone  *string  `json:"contactPhone,omitempty"`
	AddressLine1  *string  `json:"addressLine1"`
	AddressLine2  *string  `json:"addressLine2"`
	City          *string  `json:"city"`
	State         *string  `json:"state"`
	ZipCode       *string  `json:"zipCode"`
	Country       *string  `json:"country"`
	Latitude      *float64 `json:"latitude"`
	Longitude     *float64 `json:"longitude"`
	BelongsToUser string   `json:"-"`
	// contains filtered or unexported fields
}

AccountUpdateRequestInput represents what a User could set as input for updating accounts.

func (*AccountUpdateRequestInput) ValidateWithContext

func (x *AccountUpdateRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a AccountUpdateRequestInput.

type AccountUserMembership

type AccountUserMembership struct {
	CreatedAt        time.Time  `json:"createdAt"`
	LastUpdatedAt    *time.Time `json:"lastUpdatedAt"`
	ArchivedAt       *time.Time `json:"archivedAt"`
	ID               string     `json:"id"`
	BelongsToUser    string     `json:"belongsToUser"`
	BelongsToAccount string     `json:"belongsToAccount"`
	AccountRole      string     `json:"accountRoles"`
	DefaultAccount   bool       `json:"defaultAccount"`
	// contains filtered or unexported fields
}

AccountUserMembership defines a relationship between a user and a account.

type AccountUserMembershipCreationRequestInput

type AccountUserMembershipCreationRequestInput struct {
	Reason string `json:"reason"`
	UserID string `json:"userID"`
	// contains filtered or unexported fields
}

AccountUserMembershipCreationRequestInput represents what a User could set as input for updating account user memberships.

func (*AccountUserMembershipCreationRequestInput) ValidateWithContext

func (x *AccountUserMembershipCreationRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates an AccountUserMembershipCreationRequestInput.

type AccountUserMembershipDataManager

type AccountUserMembershipDataManager interface {
	BuildSessionContextDataForUser(ctx context.Context, userID string) (*SessionContextData, error)
	GetDefaultAccountIDForUser(ctx context.Context, userID string) (string, error)
	MarkAccountAsUserDefault(ctx context.Context, userID, accountID string) error
	UserIsMemberOfAccount(ctx context.Context, userID, accountID string) (bool, error)
	ModifyUserPermissions(ctx context.Context, accountID, userID string, input *ModifyUserPermissionsInput) error
	TransferAccountOwnership(ctx context.Context, accountID string, input *AccountOwnershipTransferInput) error
	RemoveUserFromAccount(ctx context.Context, userID, accountID string) error
}

AccountUserMembershipDataManager describes a structure capable of storing accountUserMemberships permanently.

type AccountUserMembershipDatabaseCreationInput

type AccountUserMembershipDatabaseCreationInput struct {
	ID          string
	Reason      string
	UserID      string
	AccountID   string
	AccountRole string
	// contains filtered or unexported fields
}

AccountUserMembershipDatabaseCreationInput represents what a User could set as input for updating account user memberships.

type AccountUserMembershipWithUser

type AccountUserMembershipWithUser struct {
	CreatedAt        time.Time  `json:"createdAt"`
	LastUpdatedAt    *time.Time `json:"lastUpdatedAt"`
	BelongsToUser    *User      `json:"belongsToUser"`
	ArchivedAt       *time.Time `json:"archivedAt"`
	ID               string     `json:"id"`
	BelongsToAccount string     `json:"belongsToAccount"`
	AccountRole      string     `json:"accountRoles"`
	DefaultAccount   bool       `json:"defaultAccount"`
	// contains filtered or unexported fields
}

AccountUserMembershipWithUser defines a relationship between a user and a account.

type AdminService

type AdminService interface {
	UserAccountStatusChangeHandler(http.ResponseWriter, *http.Request)
}

AdminService describes a structure capable of serving traffic related to users.

type AdminUserDataManager

type AdminUserDataManager interface {
	UpdateUserAccountStatus(ctx context.Context, userID string, input *UserAccountStatusUpdateInput) error
}

AdminUserDataManager contains administrative User functions that we don't necessarily want to expose to, say, the collection of handlers.

type AuditLogEntry

type AuditLogEntry struct {
	CreatedAt        time.Time              `json:"createdAt"`
	Changes          map[string]ChangeLog   `json:"changes"`
	BelongsToAccount *string                `json:"belongsToAccount"`
	ID               string                 `json:"id"`
	ResourceType     string                 `json:"resourceType"`
	RelevantID       string                 `json:"relevantID"`
	EventType        AuditLogEntryEventType `json:"eventType"`
	BelongsToUser    string                 `json:"belongsToUser"`
	// contains filtered or unexported fields
}

type AuditLogEntryDataManager

type AuditLogEntryDataManager interface {
	GetAuditLogEntry(ctx context.Context, auditLogID string) (*AuditLogEntry, error)
	GetAuditLogEntriesForUser(ctx context.Context, userID string, filter *QueryFilter) (*QueryFilteredResult[AuditLogEntry], error)
	GetAuditLogEntriesForUserAndResourceType(ctx context.Context, userID string, resourceTypes []string, filter *QueryFilter) (*QueryFilteredResult[AuditLogEntry], error)
	GetAuditLogEntriesForAccount(ctx context.Context, accountID string, filter *QueryFilter) (*QueryFilteredResult[AuditLogEntry], error)
	GetAuditLogEntriesForAccountAndResourceType(ctx context.Context, accountID string, resourceTypes []string, filter *QueryFilter) (*QueryFilteredResult[AuditLogEntry], error)
}

AuditLogEntryDataManager describes a structure capable of storing audit log entries.

type AuditLogEntryDataService

type AuditLogEntryDataService interface {
	ReadAuditLogEntryHandler(http.ResponseWriter, *http.Request)
	ListUserAuditLogEntriesHandler(http.ResponseWriter, *http.Request)
	ListAccountAuditLogEntriesHandler(http.ResponseWriter, *http.Request)
}

AuditLogEntryDataService describes a structure capable of serving traffic related to audit log entries.

type AuditLogEntryDatabaseCreationInput

type AuditLogEntryDatabaseCreationInput struct {
	Changes          map[string]ChangeLog   `json:"changes"`
	BelongsToAccount *string                `json:"belongsToAccount"`
	ID               string                 `json:"id"`
	ResourceType     string                 `json:"resourceType"`
	RelevantID       string                 `json:"relevantID"`
	EventType        AuditLogEntryEventType `json:"eventType"`
	BelongsToUser    string                 `json:"belongsToUser"`
	// contains filtered or unexported fields
}

type AuditLogEntryEventType

type AuditLogEntryEventType string

type AuthService

type AuthService interface {
	StatusHandler(http.ResponseWriter, *http.Request)
	BuildLoginHandler(bool) func(http.ResponseWriter, *http.Request)
	EndSessionHandler(http.ResponseWriter, *http.Request)
	CycleCookieSecretHandler(http.ResponseWriter, *http.Request)
	ChangeActiveAccountHandler(http.ResponseWriter, *http.Request)

	SSOLoginHandler(http.ResponseWriter, *http.Request)
	SSOLoginCallbackHandler(http.ResponseWriter, *http.Request)

	PermissionFilterMiddleware(permissions ...authorization.Permission) func(next http.Handler) http.Handler
	CookieRequirementMiddleware(next http.Handler) http.Handler
	UserAttributionMiddleware(next http.Handler) http.Handler
	AuthorizationMiddleware(next http.Handler) http.Handler
	ServiceAdminMiddleware(next http.Handler) http.Handler

	OAuth2Service
}

AuthService describes a structure capable of handling passwords and authorization requests.

type AvatarUpdateInput

type AvatarUpdateInput struct {
	Base64EncodedData string `json:"base64EncodedData"`
	// contains filtered or unexported fields
}

AvatarUpdateInput represents input a User would provide when updating their passwords.

type CapitalismService

type CapitalismService interface {
	IncomingWebhookHandler(res http.ResponseWriter, req *http.Request)
}

CapitalismService describes a structure capable of serving worker-oriented requests.

type ChangeActiveAccountInput

type ChangeActiveAccountInput struct {
	AccountID string `json:"accountID"`
	// contains filtered or unexported fields
}

ChangeActiveAccountInput represents what a User could set as input for switching accounts.

func (*ChangeActiveAccountInput) ValidateWithContext

func (x *ChangeActiveAccountInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a ChangeActiveAccountInput.

type ChangeLog

type ChangeLog struct {
	OldValue string `json:"oldValue"`
	NewValue string `json:"newValue"`
}

type ChoreMessage

type ChoreMessage struct {
	ChoreType string `json:"choreType"`
	// contains filtered or unexported fields
}

ChoreMessage represents an event that asks a worker to perform a chore.

type ContextKey

type ContextKey string

ContextKey represents strings to be used in Context objects. From the docs:

"The provided key must be comparable and should not be of type string or
 any other built-in type to avoid collisions between packages using context."

type DataChangeMessage

type DataChangeMessage struct {
	AccountInvitation           *AccountInvitation           `json:"accountInvitation,omitempty"`
	Context                     map[string]any               `json:"context,omitempty"`
	Account                     *Account                     `json:"account,omitempty"`
	Webhook                     *Webhook                     `json:"webhook,omitempty"`
	UserMembership              *AccountUserMembership       `json:"userMembership,omitempty"`
	PasswordResetToken          *PasswordResetToken          `json:"passwordResetToken,omitempty"`
	ServiceSetting              *ServiceSetting              `json:"serviceSetting,omitempty"`
	ServiceSettingConfiguration *ServiceSettingConfiguration `json:"serviceSettingConfiguration,omitempty"`
	UserNotification            *UserNotification            `json:"userNotification,omitempty"`
	UserNotificationID          string                       `json:"userNotificationID"`
	AccountInvitationID         string                       `json:"accountInvitationID,omitempty"`
	UserID                      string                       `json:"userID"`
	AccountID                   string                       `json:"accountID,omitempty"`
	EventType                   ServiceEventType             `json:"messageType"`
	EmailVerificationToken      string                       `json:"emailVerificationToken,omitempty"`
	OAuth2ClientID              string                       `json:"oauth2ClientID,omitempty"`
	// contains filtered or unexported fields
}

DataChangeMessage represents an event that asks a worker to write data to the datastore.

type EmailAddressVerificationRequestInput

type EmailAddressVerificationRequestInput struct {
	Token string `json:"emailVerificationToken"`
	// contains filtered or unexported fields
}

EmailAddressVerificationRequestInput represents the request a User provides when verifying their email address.

func (*EmailAddressVerificationRequestInput) ValidateWithContext

func (i *EmailAddressVerificationRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext ensures our provided EmailAddressVerificationRequestInput meets expectations.

type ErrorCode

type ErrorCode errorCode
const (
	// ErrNothingSpecific is a catch-all error code for when we just need one.
	ErrNothingSpecific ErrorCode = "E100"
	// ErrFetchingSessionContextData is returned when we fail to fetch session context data.
	ErrFetchingSessionContextData ErrorCode = "E101"
	// ErrDecodingRequestInput is returned when we fail to decode request input.
	ErrDecodingRequestInput ErrorCode = "E102"
	// ErrValidatingRequestInput is returned when the user provides invalid input.
	ErrValidatingRequestInput ErrorCode = "E103"
	// ErrDataNotFound is returned when we fail to find data in the database.
	ErrDataNotFound ErrorCode = "E104"
	// ErrTalkingToDatabase is returned when we fail to interact with a database.
	ErrTalkingToDatabase ErrorCode = "E105"
	// ErrMisbehavingDependency is returned when we fail to interact with a database.
	ErrMisbehavingDependency ErrorCode = "E106"
	// ErrTalkingToSearchProvider is returned when we fail to interact with a database.
	ErrTalkingToSearchProvider ErrorCode = "E107"
	// ErrSecretGeneration is returned when a user is not authorized.
	ErrSecretGeneration ErrorCode = "E108"
	// ErrUserIsBanned is returned when a user is banned.
	ErrUserIsBanned ErrorCode = "E109"
	// ErrUserIsNotAuthorized is returned when a user is not authorized.
	ErrUserIsNotAuthorized ErrorCode = "E110"
)

type FrontendService

type FrontendService interface {
	StaticDir(ctx context.Context, staticFilesDirectory string) (http.HandlerFunc, error)
}

FrontendService serves static frontend files.

type ModifyUserPermissionsInput

type ModifyUserPermissionsInput struct {
	Reason  string `json:"reason"`
	NewRole string `json:"newRoles"`
	// contains filtered or unexported fields
}

ModifyUserPermissionsInput represents what a User could set as input for updating account user memberships.

func (*ModifyUserPermissionsInput) ValidateWithContext

func (x *ModifyUserPermissionsInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a ModifyUserPermissionsInput.

type NamedID

type NamedID struct {
	ID   string `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
	// contains filtered or unexported fields
}

type OAuth2Client

type OAuth2Client struct {
	CreatedAt    time.Time  `json:"createdAt"`
	ArchivedAt   *time.Time `json:"archivedAt"`
	Name         string     `json:"name"`
	Description  string     `json:"description"`
	ClientID     string     `json:"clientID"`
	ID           string     `json:"id"`
	ClientSecret string     `json:"clientSecret"`
	// contains filtered or unexported fields
}

OAuth2Client represents a user-authorized OAuth2 client.

type OAuth2ClientCreationRequestInput

type OAuth2ClientCreationRequestInput struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	// contains filtered or unexported fields
}

OAuth2ClientCreationRequestInput is a struct for use when creating OAuth2 clients.

func (*OAuth2ClientCreationRequestInput) ValidateWithContext

func (x *OAuth2ClientCreationRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates an APICreationInput.

type OAuth2ClientCreationResponse

type OAuth2ClientCreationResponse struct {
	ClientID     string `json:"clientID"`
	ClientSecret string `json:"clientSecret"`
	Name         string `json:"name"`
	Description  string `json:"description"`
	ID           string `json:"id"`
	// contains filtered or unexported fields
}

OAuth2ClientCreationResponse is a struct for informing users of what their OAuth2 client's secret key is.

type OAuth2ClientDataManager

type OAuth2ClientDataManager interface {
	GetOAuth2ClientByClientID(ctx context.Context, clientID string) (*OAuth2Client, error)
	GetOAuth2ClientByDatabaseID(ctx context.Context, id string) (*OAuth2Client, error)
	GetOAuth2Clients(ctx context.Context, filter *QueryFilter) (*QueryFilteredResult[OAuth2Client], error)
	CreateOAuth2Client(ctx context.Context, input *OAuth2ClientDatabaseCreationInput) (*OAuth2Client, error)
	ArchiveOAuth2Client(ctx context.Context, clientID string) error
}

OAuth2ClientDataManager handles OAuth2 clients.

type OAuth2ClientDataService

type OAuth2ClientDataService interface {
	ListHandler(http.ResponseWriter, *http.Request)
	CreateHandler(http.ResponseWriter, *http.Request)
	ReadHandler(http.ResponseWriter, *http.Request)
	ArchiveHandler(http.ResponseWriter, *http.Request)
}

OAuth2ClientDataService describes a structure capable of serving traffic related to OAuth2 clients.

type OAuth2ClientDatabaseCreationInput

type OAuth2ClientDatabaseCreationInput struct {
	ID           string
	Name         string
	Description  string
	ClientID     string
	ClientSecret string
	// contains filtered or unexported fields
}

OAuth2ClientDatabaseCreationInput is a struct for use when creating OAuth2 clients.

type OAuth2ClientToken

type OAuth2ClientToken struct {
	RefreshCreatedAt    time.Time     `json:"refreshCreatedAt"`
	AccessCreatedAt     time.Time     `json:"accessCreatedAt"`
	CodeCreatedAt       time.Time     `json:"codeCreatedAt"`
	RedirectURI         string        `json:"redirectURI"`
	Scope               string        `json:"scope"`
	Code                string        `json:"code"`
	CodeChallenge       string        `json:"codeChallenge"`
	CodeChallengeMethod string        `json:"codeChallengeMethod"`
	BelongsToUser       string        `json:"belongsToUser"`
	Access              string        `json:"access"`
	ClientID            string        `json:"clientID"`
	Refresh             string        `json:"refresh"`
	ID                  string        `json:"id"`
	CodeExpiresAt       time.Duration `json:"codeExpiresIn"`
	AccessExpiresAt     time.Duration `json:"accessExpiresIn"`
	RefreshExpiresAt    time.Duration `json:"refreshExpiresIn"`
	// contains filtered or unexported fields
}

OAuth2ClientToken represents a user-authorized OAuth2 client's token.

type OAuth2ClientTokenDataManager

type OAuth2ClientTokenDataManager interface {
	GetOAuth2ClientTokenByCode(ctx context.Context, code string) (*OAuth2ClientToken, error)
	GetOAuth2ClientTokenByAccess(ctx context.Context, access string) (*OAuth2ClientToken, error)
	GetOAuth2ClientTokenByRefresh(ctx context.Context, refresh string) (*OAuth2ClientToken, error)
	CreateOAuth2ClientToken(ctx context.Context, input *OAuth2ClientTokenDatabaseCreationInput) (*OAuth2ClientToken, error)
	ArchiveOAuth2ClientTokenByAccess(ctx context.Context, access string) error
	ArchiveOAuth2ClientTokenByCode(ctx context.Context, code string) error
	ArchiveOAuth2ClientTokenByRefresh(ctx context.Context, refresh string) error
}

type OAuth2ClientTokenDatabaseCreationInput

type OAuth2ClientTokenDatabaseCreationInput struct {
	RefreshCreatedAt    time.Time
	AccessCreatedAt     time.Time
	CodeCreatedAt       time.Time
	RedirectURI         string
	Scope               string
	Code                string
	CodeChallenge       string
	CodeChallengeMethod string
	BelongsToUser       string
	Access              string
	ClientID            string
	Refresh             string
	ID                  string
	CodeExpiresIn       time.Duration
	AccessExpiresIn     time.Duration
	RefreshExpiresIn    time.Duration
	// contains filtered or unexported fields
}

OAuth2ClientTokenDatabaseCreationInput represents a user-authorized OAuth2 client's token's database creation input.

type OAuth2Service

type OAuth2Service interface {
	AuthorizeHandler(res http.ResponseWriter, req *http.Request)
	TokenHandler(res http.ResponseWriter, req *http.Request)
}

type Pagination

type Pagination struct {
	Page          uint16 `json:"page"`
	Limit         uint8  `json:"limit"`
	FilteredCount uint64 `json:"filteredCount"`
	TotalCount    uint64 `json:"totalCount"`
	// contains filtered or unexported fields
}

Pagination represents a pagination request.

type PasswordResetToken

type PasswordResetToken struct {
	CreatedAt     time.Time  `json:"createdAt"`
	ExpiresAt     time.Time  `json:"expiresAt"`
	RedeemedAt    *time.Time `json:"archivedAt"`
	LastUpdatedAt *time.Time `json:"lastUpdatedAt"`
	ID            string     `json:"id"`
	Token         string     `json:"token"`
	BelongsToUser string     `json:"belongsToUser"`
	// contains filtered or unexported fields
}

PasswordResetToken represents a password reset token.

type PasswordResetTokenCreationRequestInput

type PasswordResetTokenCreationRequestInput struct {
	EmailAddress string `json:"emailAddress"`
	// contains filtered or unexported fields
}

PasswordResetTokenCreationRequestInput represents what a user could set as input for creating password reset tokens.

func (*PasswordResetTokenCreationRequestInput) ValidateWithContext

func (x *PasswordResetTokenCreationRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a PasswordResetTokenCreationRequestInput.

type PasswordResetTokenDataManager

type PasswordResetTokenDataManager interface {
	GetPasswordResetTokenByToken(ctx context.Context, passwordResetTokenID string) (*PasswordResetToken, error)
	CreatePasswordResetToken(ctx context.Context, input *PasswordResetTokenDatabaseCreationInput) (*PasswordResetToken, error)
	RedeemPasswordResetToken(ctx context.Context, passwordResetTokenID string) error
}

PasswordResetTokenDataManager describes a structure capable of storing password reset tokens permanently.

type PasswordResetTokenDataService

type PasswordResetTokenDataService interface {
	CreateHandler(http.ResponseWriter, *http.Request)
	ReadHandler(http.ResponseWriter, *http.Request)
	ArchiveHandler(http.ResponseWriter, *http.Request)
}

PasswordResetTokenDataService describes a structure capable of serving traffic related to password reset tokens.

type PasswordResetTokenDatabaseCreationInput

type PasswordResetTokenDatabaseCreationInput struct {
	ExpiresAt     time.Time
	ID            string
	Token         string
	BelongsToUser string
	// contains filtered or unexported fields
}

PasswordResetTokenDatabaseCreationInput represents what a user could set as input for creating password reset tokens.

func (*PasswordResetTokenDatabaseCreationInput) ValidateWithContext

func (x *PasswordResetTokenDatabaseCreationInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a PasswordResetTokenDatabaseCreationInput.

type PasswordResetTokenRedemptionRequestInput

type PasswordResetTokenRedemptionRequestInput struct {
	Token       string `json:"token"`
	NewPassword string `json:"newPassword"`
	// contains filtered or unexported fields
}

PasswordResetTokenRedemptionRequestInput represents what a user could set as input for creating password reset tokens.

func (*PasswordResetTokenRedemptionRequestInput) ValidateWithContext

func (x *PasswordResetTokenRedemptionRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a PasswordResetTokenRedemptionRequestInput.

type PasswordUpdateInput

type PasswordUpdateInput struct {
	NewPassword     string `json:"newPassword"`
	CurrentPassword string `json:"currentPassword"`
	TOTPToken       string `json:"totpToken"`
	// contains filtered or unexported fields
}

PasswordUpdateInput represents input a User would provide when updating their passwords.

func (*PasswordUpdateInput) ValidateWithContext

func (i *PasswordUpdateInput) ValidateWithContext(ctx context.Context, minPasswordLength uint8) error

ValidateWithContext ensures our provided PasswordUpdateInput meets expectations.

type QueryFilter

type QueryFilter struct {
	SortBy          *string    `json:"sortBy"`
	Page            *uint16    `json:"page"`
	CreatedAfter    *time.Time `json:"createdBefore,omitempty"`
	CreatedBefore   *time.Time `json:"createdAfter,omitempty"`
	UpdatedAfter    *time.Time `json:"updatedBefore,omitempty"`
	UpdatedBefore   *time.Time `json:"updatedAfter,omitempty"`
	Limit           *uint8     `json:"limit"`
	IncludeArchived *bool      `json:"includeArchived,omitempty"`
	// contains filtered or unexported fields
}

QueryFilter represents all the filters a User could apply to a list query.

func DefaultQueryFilter

func DefaultQueryFilter() *QueryFilter

DefaultQueryFilter builds the default query filter.

func ExtractQueryFilterFromRequest

func ExtractQueryFilterFromRequest(req *http.Request) *QueryFilter

ExtractQueryFilterFromRequest can extract a QueryFilter from a request.

func (*QueryFilter) AttachToLogger

func (qf *QueryFilter) AttachToLogger(logger logging.Logger) logging.Logger

AttachToLogger attaches a QueryFilter's values to a logging.Logger.

func (*QueryFilter) FromParams

func (qf *QueryFilter) FromParams(params url.Values)

FromParams overrides the core QueryFilter values with values retrieved from url.Params.

func (*QueryFilter) QueryOffset

func (qf *QueryFilter) QueryOffset() uint16

QueryOffset calculates a query page from the current filter values.

func (*QueryFilter) SetPage

func (qf *QueryFilter) SetPage(page *uint16)

SetPage sets the current page with certain constraints.

func (*QueryFilter) ToPagination

func (qf *QueryFilter) ToPagination() Pagination

ToPagination returns a Pagination from a QueryFilter.

func (*QueryFilter) ToValues

func (qf *QueryFilter) ToValues() url.Values

ToValues returns a url.Values from a QueryFilter.

type QueryFilteredResult

type QueryFilteredResult[T any] struct {
	Data []*T `json:"data"`
	Pagination
	// contains filtered or unexported fields
}

type RequesterInfo

type RequesterInfo struct {
	ServicePermissions       authorization.ServiceRolePermissionChecker `json:"-"`
	AccountStatus            string                                     `json:"-"`
	AccountStatusExplanation string                                     `json:"-"`
	UserID                   string                                     `json:"-"`
	EmailAddress             string                                     `json:"-"`
	Username                 string                                     `json:"-"`
	// contains filtered or unexported fields
}

RequesterInfo contains data relevant to the user making a request.

type ResponseDetails

type ResponseDetails struct {
	CurrentAccountID string `json:"currentAccountID"`
	TraceID          string `json:"traceID"`
	// contains filtered or unexported fields
}

ResponseDetails represents details about the response.

type ServiceEventType

type ServiceEventType string

ServiceEventType enumerates valid service event types.

const (
	// AccountCreatedCustomerEventType indicates a account was created.
	AccountCreatedCustomerEventType ServiceEventType = "account_created"
	// AccountUpdatedCustomerEventType indicates a account was updated.
	AccountUpdatedCustomerEventType ServiceEventType = "account_updated"
	// AccountArchivedCustomerEventType indicates a account was archived.
	AccountArchivedCustomerEventType ServiceEventType = "account_archived"
	// AccountMemberRemovedCustomerEventType indicates a account member was removed.
	AccountMemberRemovedCustomerEventType ServiceEventType = "account_member_removed"
	// AccountMembershipPermissionsUpdatedCustomerEventType indicates a account member's permissions were modified.
	AccountMembershipPermissionsUpdatedCustomerEventType ServiceEventType = "account_membership_permissions_updated"
	// AccountOwnershipTransferredCustomerEventType indicates a account was transferred to another owner.
	AccountOwnershipTransferredCustomerEventType ServiceEventType = "account_ownership_transferred"

	// UnpaidAccountBillingStatus indicates a account is not paid.
	UnpaidAccountBillingStatus = "unpaid"
)
const (
	// OAuth2ClientCreatedCustomerEventType indicates an OAuth2 client was created.
	OAuth2ClientCreatedCustomerEventType ServiceEventType = "oauth2_client_created"
	// OAuth2ClientArchivedCustomerEventType indicates an OAuth2 client was archived.
	OAuth2ClientArchivedCustomerEventType ServiceEventType = "oauth2_client_archived"
)
const (
	// ServiceSettingCreatedCustomerEventType indicates a service setting was created.
	ServiceSettingCreatedCustomerEventType ServiceEventType = "service_setting_created"
	// ServiceSettingArchivedCustomerEventType indicates a service setting was archived.
	ServiceSettingArchivedCustomerEventType ServiceEventType = "service_setting_archived"
)
const (
	// ServiceSettingConfigurationCreatedCustomerEventType indicates a service setting was created.
	ServiceSettingConfigurationCreatedCustomerEventType ServiceEventType = "service_setting_configuration_created"
	// ServiceSettingConfigurationUpdatedCustomerEventType indicates a service setting was updated.
	ServiceSettingConfigurationUpdatedCustomerEventType ServiceEventType = "service_setting_configuration_updated"
	// ServiceSettingConfigurationArchivedCustomerEventType indicates a service setting was archived.
	ServiceSettingConfigurationArchivedCustomerEventType ServiceEventType = "service_setting_configuration_archived"
)
const (
	// WebhookCreatedCustomerEventType indicates a webhook was created.
	WebhookCreatedCustomerEventType ServiceEventType = "webhook_created"
	// WebhookArchivedCustomerEventType indicates a webhook was archived.
	WebhookArchivedCustomerEventType ServiceEventType = "webhook_archived"
)

type ServiceSetting

type ServiceSetting struct {
	CreatedAt     time.Time  `json:"createdAt"`
	DefaultValue  *string    `json:"defaultValue"`
	LastUpdatedAt *time.Time `json:"lastUpdatedAt"`
	ArchivedAt    *time.Time `json:"archivedAt"`
	ID            string     `json:"id"`
	Name          string     `json:"name"`
	Type          string     `json:"type"`
	Description   string     `json:"description"`
	Enumeration   []string   `json:"enumeration"`
	AdminsOnly    bool       `json:"adminsOnly"`
	// contains filtered or unexported fields
}

ServiceSetting represents a service setting.

func (*ServiceSetting) Update

Update merges an ServiceSettingUpdateRequestInput with a service setting.

type ServiceSettingConfiguration

type ServiceSettingConfiguration struct {
	CreatedAt        time.Time      `json:"createdAt"`
	LastUpdatedAt    *time.Time     `json:"lastUpdatedAt"`
	ArchivedAt       *time.Time     `json:"archivedAt"`
	ID               string         `json:"id"`
	Value            string         `json:"value"`
	Notes            string         `json:"notes"`
	BelongsToUser    string         `json:"belongsToUser"`
	BelongsToAccount string         `json:"belongsToAccount"`
	ServiceSetting   ServiceSetting `json:"serviceSetting"`
	// contains filtered or unexported fields
}

ServiceSettingConfiguration represents a configured service setting configurations.

func (*ServiceSettingConfiguration) Update

Update merges an ServiceSettingConfigurationUpdateRequestInput with a service setting.

type ServiceSettingConfigurationCreationRequestInput

type ServiceSettingConfigurationCreationRequestInput struct {
	Value            string `json:"value"`
	Notes            string `json:"notes"`
	ServiceSettingID string `json:"serviceSettingID"`
	BelongsToUser    string `json:"belongsToUser"`
	BelongsToAccount string `json:"belongsToAccount"`
	// contains filtered or unexported fields
}

ServiceSettingConfigurationCreationRequestInput represents what a user could set as input for creating settings configurations.

func (*ServiceSettingConfigurationCreationRequestInput) ValidateWithContext

ValidateWithContext validates a ServiceSettingCreationRequestInput.

type ServiceSettingConfigurationDataManager

type ServiceSettingConfigurationDataManager interface {
	ServiceSettingConfigurationExists(ctx context.Context, serviceSettingConfigurationID string) (bool, error)
	GetServiceSettingConfiguration(ctx context.Context, serviceSettingConfigurationID string) (*ServiceSettingConfiguration, error)
	GetServiceSettingConfigurationForUserByName(ctx context.Context, userID, serviceSettingConfigurationName string) (*ServiceSettingConfiguration, error)
	GetServiceSettingConfigurationForAccountByName(ctx context.Context, accountID, serviceSettingConfigurationName string) (*ServiceSettingConfiguration, error)
	GetServiceSettingConfigurationsForUser(ctx context.Context, userID string, filter *QueryFilter) (*QueryFilteredResult[ServiceSettingConfiguration], error)
	GetServiceSettingConfigurationsForAccount(ctx context.Context, accountID string, filter *QueryFilter) (*QueryFilteredResult[ServiceSettingConfiguration], error)
	CreateServiceSettingConfiguration(ctx context.Context, input *ServiceSettingConfigurationDatabaseCreationInput) (*ServiceSettingConfiguration, error)
	UpdateServiceSettingConfiguration(ctx context.Context, updated *ServiceSettingConfiguration) error
	ArchiveServiceSettingConfiguration(ctx context.Context, serviceSettingConfigurationID string) error
}

ServiceSettingConfigurationDataManager describes a structure capable of storing settings permanently.

type ServiceSettingConfigurationDataService

type ServiceSettingConfigurationDataService interface {
	CreateHandler(http.ResponseWriter, *http.Request)
	ForUserHandler(http.ResponseWriter, *http.Request)
	ForAccountHandler(http.ResponseWriter, *http.Request)
	ForUserByNameHandler(http.ResponseWriter, *http.Request)
	UpdateHandler(http.ResponseWriter, *http.Request)
	ArchiveHandler(http.ResponseWriter, *http.Request)
}

ServiceSettingConfigurationDataService describes a structure capable of serving traffic related to service settings.

type ServiceSettingConfigurationDatabaseCreationInput

type ServiceSettingConfigurationDatabaseCreationInput struct {
	ID               string
	Value            string
	Notes            string
	ServiceSettingID string
	BelongsToUser    string
	BelongsToAccount string
	// contains filtered or unexported fields
}

ServiceSettingConfigurationDatabaseCreationInput represents what a user could set as input for creating service settings configurations.

func (*ServiceSettingConfigurationDatabaseCreationInput) ValidateWithContext

ValidateWithContext validates a ServiceSettingConfigurationDatabaseCreationInput.

type ServiceSettingConfigurationUpdateRequestInput

type ServiceSettingConfigurationUpdateRequestInput struct {
	Value            *string `json:"value"`
	Notes            *string `json:"notes"`
	ServiceSettingID *string `json:"serviceSettingID"`
	BelongsToUser    *string `json:"belongsToUser"`
	BelongsToAccount *string `json:"belongsToAccount"`
	// contains filtered or unexported fields
}

ServiceSettingConfigurationUpdateRequestInput represents what a user could set as input for updating service settings configurations.

func (*ServiceSettingConfigurationUpdateRequestInput) ValidateWithContext

ValidateWithContext validates a ServiceSettingConfigurationUpdateRequestInput.

type ServiceSettingCreationRequestInput

type ServiceSettingCreationRequestInput struct {
	DefaultValue *string  `json:"defaultValue"`
	Name         string   `json:"name"`
	Type         string   `json:"type"`
	Description  string   `json:"description"`
	Enumeration  []string `json:"enumeration"`
	AdminsOnly   bool     `json:"adminsOnly"`
	// contains filtered or unexported fields
}

ServiceSettingCreationRequestInput represents what a user could set as input for creating settings.

func (*ServiceSettingCreationRequestInput) ValidateWithContext

func (x *ServiceSettingCreationRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a ServiceSettingCreationRequestInput.

type ServiceSettingDataManager

type ServiceSettingDataManager interface {
	CreateServiceSetting(ctx context.Context, input *ServiceSettingDatabaseCreationInput) (*ServiceSetting, error)
	ServiceSettingExists(ctx context.Context, serviceSettingID string) (bool, error)
	GetServiceSetting(ctx context.Context, serviceSettingID string) (*ServiceSetting, error)
	GetServiceSettings(ctx context.Context, filter *QueryFilter) (*QueryFilteredResult[ServiceSetting], error)
	SearchForServiceSettings(ctx context.Context, query string) ([]*ServiceSetting, error)
	ArchiveServiceSetting(ctx context.Context, serviceSettingID string) error
}

ServiceSettingDataManager describes a structure capable of storing settings permanently.

type ServiceSettingDataService

type ServiceSettingDataService interface {
	CreateHandler(http.ResponseWriter, *http.Request)
	SearchHandler(http.ResponseWriter, *http.Request)
	ListHandler(http.ResponseWriter, *http.Request)
	ReadHandler(http.ResponseWriter, *http.Request)
	ArchiveHandler(http.ResponseWriter, *http.Request)
}

ServiceSettingDataService describes a structure capable of serving traffic related to service settings.

type ServiceSettingDatabaseCreationInput

type ServiceSettingDatabaseCreationInput struct {
	DefaultValue *string
	ID           string
	Name         string
	Type         string
	Description  string
	Enumeration  []string
	AdminsOnly   bool
	// contains filtered or unexported fields
}

ServiceSettingDatabaseCreationInput represents what a user could set as input for creating service settings.

func (*ServiceSettingDatabaseCreationInput) ValidateWithContext

func (x *ServiceSettingDatabaseCreationInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a ServiceSettingDatabaseCreationInput.

type ServiceSettingUpdateRequestInput

type ServiceSettingUpdateRequestInput struct {
	Name         *string  `json:"name"`
	Type         *string  `json:"type"`
	Description  *string  `json:"description"`
	DefaultValue *string  `json:"defaultValue"`
	AdminsOnly   *bool    `json:"adminsOnly"`
	Enumeration  []string `json:"enumeration"`
	// contains filtered or unexported fields
}

ServiceSettingUpdateRequestInput represents what a user could set as input for updating service settings.

func (*ServiceSettingUpdateRequestInput) ValidateWithContext

func (x *ServiceSettingUpdateRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a ServiceSettingUpdateRequestInput.

type SessionContextData

type SessionContextData struct {
	AccountPermissions map[string]authorization.AccountRolePermissionsChecker `json:"-"`
	Requester          RequesterInfo                                          `json:"-"`
	ActiveAccountID    string                                                 `json:"-"`
	// contains filtered or unexported fields
}

SessionContextData represents what we encode in our passwords cookies.

func (*SessionContextData) AccountRolePermissionsChecker

func (x *SessionContextData) AccountRolePermissionsChecker() authorization.AccountRolePermissionsChecker

AccountRolePermissionsChecker returns the relevant AccountRolePermissionsChecker.

func (*SessionContextData) AttachToLogger

func (x *SessionContextData) AttachToLogger(logger logging.Logger) logging.Logger

AttachToLogger provides a consistent way to attach a SessionContextData object to a logger.

func (*SessionContextData) ServiceRolePermissionChecker

func (x *SessionContextData) ServiceRolePermissionChecker() authorization.ServiceRolePermissionChecker

ServiceRolePermissionChecker returns the relevant ServiceRolePermissionChecker.

type TOTPSecretRefreshInput

type TOTPSecretRefreshInput struct {
	CurrentPassword string `json:"currentPassword"`
	TOTPToken       string `json:"totpToken"`
	// contains filtered or unexported fields
}

TOTPSecretRefreshInput represents input a User would provide when updating their 2FA secret.

func (*TOTPSecretRefreshInput) ValidateWithContext

func (i *TOTPSecretRefreshInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext ensures our provided TOTPSecretRefreshInput meets expectations.

type TOTPSecretRefreshResponse

type TOTPSecretRefreshResponse struct {
	TwoFactorQRCode string `json:"qrCode"`
	TwoFactorSecret string `json:"twoFactorSecret"`
	// contains filtered or unexported fields
}

TOTPSecretRefreshResponse represents the response we provide to a User when updating their 2FA secret.

type TOTPSecretVerificationInput

type TOTPSecretVerificationInput struct {
	TOTPToken string `json:"totpToken"`
	UserID    string `json:"userID"`
	// contains filtered or unexported fields
}

TOTPSecretVerificationInput represents input a User would provide when validating their 2FA secret.

func (*TOTPSecretVerificationInput) ValidateWithContext

func (i *TOTPSecretVerificationInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext ensures our provided TOTPSecretVerificationInput meets expectations.

type User

type User struct {
	CreatedAt                  time.Time  `json:"createdAt"`
	PasswordLastChangedAt      *time.Time `json:"passwordLastChangedAt"`
	LastUpdatedAt              *time.Time `json:"lastUpdatedAt"`
	LastAcceptedTermsOfService *time.Time `json:"lastAcceptedTOS"`
	LastAcceptedPrivacyPolicy  *time.Time `json:"lastAcceptedPrivacyPolicy"`
	TwoFactorSecretVerifiedAt  *time.Time `json:"twoFactorSecretVerifiedAt"`
	AvatarSrc                  *string    `json:"avatar"`
	Birthday                   *time.Time `json:"birthday"`
	ArchivedAt                 *time.Time `json:"archivedAt"`
	AccountStatusExplanation   string     `json:"accountStatusExplanation"`
	TwoFactorSecret            string     `json:"-"`
	HashedPassword             string     `json:"-"`
	ID                         string     `json:"id"`
	AccountStatus              string     `json:"accountStatus"`
	Username                   string     `json:"username"`
	FirstName                  string     `json:"firstName"`
	LastName                   string     `json:"lastName"`
	EmailAddress               string     `json:"emailAddress"`
	EmailAddressVerifiedAt     *time.Time `json:"emailAddressVerifiedAt"`
	ServiceRole                string     `json:"serviceRoles"`
	RequiresPasswordChange     bool       `json:"requiresPasswordChange"`
	// contains filtered or unexported fields
}

User represents a User.

func (*User) IsBanned

func (u *User) IsBanned() bool

IsBanned is a handy helper function.

func (*User) Update

func (u *User) Update(input *User)

Update accepts a User as input and merges those values if they're set.

type UserAccountMembershipInfo

type UserAccountMembershipInfo struct {
	AccountName string
	AccountID   string
	AccountRole string
	// contains filtered or unexported fields
}

UserAccountMembershipInfo represents key information about a account membership.

type UserAccountStatusUpdateInput

type UserAccountStatusUpdateInput struct {
	NewStatus    string `json:"newStatus"`
	Reason       string `json:"reason"`
	TargetUserID string `json:"targetUserID"`
	// contains filtered or unexported fields
}

UserAccountStatusUpdateInput represents what an admin User could provide as input for changing statuses.

func (*UserAccountStatusUpdateInput) ValidateWithContext

func (i *UserAccountStatusUpdateInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext ensures our struct is validatable.

type UserCreationResponse

type UserCreationResponse struct {
	CreatedAt       time.Time  `json:"createdAt"`
	Birthday        *time.Time `json:"birthday"`
	AvatarSrc       *string    `json:"avatar"`
	Username        string     `json:"username"`
	EmailAddress    string     `json:"emailAddress"`
	TwoFactorQRCode string     `json:"qrCode"`
	CreatedUserID   string     `json:"createdUserID"`
	AccountStatus   string     `json:"accountStatus"`
	TwoFactorSecret string     `json:"twoFactorSecret"`
	FirstName       string     `json:"firstName"`
	LastName        string     `json:"lastName"`
	IsAdmin         bool       `json:"isAdmin"`
	// contains filtered or unexported fields
}

UserCreationResponse is a response structure for Users that doesn't contain passwords fields, but does contain the two factor secret.

type UserDataManager

type UserDataManager interface {
	GetUser(ctx context.Context, userID string) (*User, error)
	GetUserByUsername(ctx context.Context, username string) (*User, error)
	GetAdminUserByUsername(ctx context.Context, username string) (*User, error)
	GetUsers(ctx context.Context, filter *QueryFilter) (*QueryFilteredResult[User], error)
	GetUserByEmail(ctx context.Context, email string) (*User, error)
	SearchForUsersByUsername(ctx context.Context, usernameQuery string) ([]*User, error)
	CreateUser(ctx context.Context, input *UserDatabaseCreationInput) (*User, error)
	UpdateUserAvatar(ctx context.Context, userID, newAvatarContent string) error
	UpdateUserUsername(ctx context.Context, userID, newUsername string) error
	UpdateUserEmailAddress(ctx context.Context, userID, newEmailAddress string) error
	UpdateUserDetails(ctx context.Context, userID string, input *UserDetailsDatabaseUpdateInput) error
	UpdateUserPassword(ctx context.Context, userID, newHash string) error
	ArchiveUser(ctx context.Context, userID string) error
	GetUserWithUnverifiedTwoFactorSecret(ctx context.Context, userID string) (*User, error)
	MarkUserTwoFactorSecretAsVerified(ctx context.Context, userID string) error
	MarkUserTwoFactorSecretAsUnverified(ctx context.Context, userID, newSecret string) error
	GetEmailAddressVerificationTokenForUser(ctx context.Context, userID string) (string, error)
	GetUserByEmailAddressVerificationToken(ctx context.Context, token string) (*User, error)
	MarkUserEmailAddressAsVerified(ctx context.Context, userID, token string) error
	MarkUserEmailAddressAsUnverified(ctx context.Context, userID string) error
	GetUserIDsThatNeedSearchIndexing(ctx context.Context) ([]string, error)
	MarkUserAsIndexed(ctx context.Context, userID string) error
}

UserDataManager describes a structure which can manage users in persistent storage.

type UserDataService

type UserDataService interface {
	ListHandler(http.ResponseWriter, *http.Request)
	CreateHandler(http.ResponseWriter, *http.Request)
	ReadHandler(http.ResponseWriter, *http.Request)
	SelfHandler(http.ResponseWriter, *http.Request)
	PermissionsHandler(http.ResponseWriter, *http.Request)
	UsernameSearchHandler(http.ResponseWriter, *http.Request)
	NewTOTPSecretHandler(http.ResponseWriter, *http.Request)
	TOTPSecretVerificationHandler(http.ResponseWriter, *http.Request)
	UpdatePasswordHandler(http.ResponseWriter, *http.Request)
	UpdateUserEmailAddressHandler(http.ResponseWriter, *http.Request)
	UpdateUserUsernameHandler(http.ResponseWriter, *http.Request)
	UpdateUserDetailsHandler(http.ResponseWriter, *http.Request)
	AvatarUploadHandler(http.ResponseWriter, *http.Request)
	ArchiveHandler(http.ResponseWriter, *http.Request)
	CreatePasswordResetTokenHandler(http.ResponseWriter, *http.Request)
	PasswordResetTokenRedemptionHandler(http.ResponseWriter, *http.Request)
	RequestUsernameReminderHandler(http.ResponseWriter, *http.Request)
	VerifyUserEmailAddressHandler(http.ResponseWriter, *http.Request)
	RequestEmailVerificationEmailHandler(http.ResponseWriter, *http.Request)
}

UserDataService describes a structure capable of serving traffic related to users.

type UserDatabaseCreationInput

type UserDatabaseCreationInput struct {
	Birthday              *time.Time
	ID                    string
	AvatarSrc             *string
	HashedPassword        string
	TwoFactorSecret       string
	InvitationToken       string
	DestinationAccountID  string
	Username              string
	EmailAddress          string
	AccountName           string
	FirstName             string
	LastName              string
	AcceptedTOS           bool
	AcceptedPrivacyPolicy bool
	// contains filtered or unexported fields
}

UserDatabaseCreationInput is used by the User creation route to communicate with the data store.

type UserDetailsDatabaseUpdateInput

type UserDetailsDatabaseUpdateInput struct {
	Birthday  time.Time `json:"-"`
	FirstName string    `json:"-"`
	LastName  string    `json:"-"`
	// contains filtered or unexported fields
}

UserDetailsDatabaseUpdateInput represents input a User would provide when updating their information.

type UserDetailsUpdateRequestInput

type UserDetailsUpdateRequestInput struct {
	FirstName       string    `json:"firstName"`
	LastName        string    `json:"lastName"`
	Birthday        time.Time `json:"birthday"`
	CurrentPassword string    `json:"currentPassword"`
	TOTPToken       string    `json:"totpToken"`
	// contains filtered or unexported fields
}

UserDetailsUpdateRequestInput represents input a User would provide when updating their information.

func (*UserDetailsUpdateRequestInput) ValidateWithContext

func (i *UserDetailsUpdateRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext ensures our provided UserDetailsUpdateRequestInput meets expectations.

type UserEmailAddressUpdateInput

type UserEmailAddressUpdateInput struct {
	NewEmailAddress string `json:"newEmailAddress"`
	CurrentPassword string `json:"currentPassword"`
	TOTPToken       string `json:"totpToken"`
	// contains filtered or unexported fields
}

UserEmailAddressUpdateInput represents input a User would provide when updating their email address.

func (*UserEmailAddressUpdateInput) ValidateWithContext

func (i *UserEmailAddressUpdateInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext ensures our provided UserEmailAddressUpdateInput meets expectations.

type UserLoginInput

type UserLoginInput struct {
	Username  string `json:"username"`
	Password  string `json:"password"`
	TOTPToken string `json:"totpToken"`
	// contains filtered or unexported fields
}

UserLoginInput represents the payload used to log in a User.

func (*UserLoginInput) ValidateWithContext

func (i *UserLoginInput) ValidateWithContext(ctx context.Context, minUsernameLength, minPasswordLength uint8) error

ValidateWithContext ensures our provided UserLoginInput meets expectations.

type UserNotification

type UserNotification struct {
	CreatedAt     time.Time  `json:"createdAt"`
	LastUpdatedAt *time.Time `json:"lastUpdatedAt"`
	ID            string     `json:"id"`
	Content       string     `json:"content"`
	Status        string     `json:"status"`
	BelongsToUser string     `json:"belongsToUser"`
	// contains filtered or unexported fields
}

UserNotification represents a user notification.

func (*UserNotification) Update

Update merges an UserNotificationUpdateRequestInput with a user notification.

type UserNotificationCreationRequestInput

type UserNotificationCreationRequestInput struct {
	Content       string `json:"content"`
	Status        string `json:"status"`
	BelongsToUser string `json:"belongsToUser"`
	// contains filtered or unexported fields
}

UserNotificationCreationRequestInput represents what a user could set as input for creating user notifications.

func (*UserNotificationCreationRequestInput) ValidateWithContext

func (x *UserNotificationCreationRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a UserNotificationCreationRequestInput.

type UserNotificationDataManager

type UserNotificationDataManager interface {
	UserNotificationExists(ctx context.Context, userID, userNotificationID string) (bool, error)
	GetUserNotification(ctx context.Context, userID, userNotificationID string) (*UserNotification, error)
	GetUserNotifications(ctx context.Context, userID string, filter *QueryFilter) (*QueryFilteredResult[UserNotification], error)
	CreateUserNotification(ctx context.Context, input *UserNotificationDatabaseCreationInput) (*UserNotification, error)
	UpdateUserNotification(ctx context.Context, updated *UserNotification) error
}

UserNotificationDataManager describes a structure capable of storing user notifications permanently.

type UserNotificationDataService

type UserNotificationDataService interface {
	ListHandler(http.ResponseWriter, *http.Request)
	CreateHandler(http.ResponseWriter, *http.Request)
	ReadHandler(http.ResponseWriter, *http.Request)
	UpdateHandler(http.ResponseWriter, *http.Request)
}

UserNotificationDataService describes a structure capable of serving traffic related to user notifications.

type UserNotificationDatabaseCreationInput

type UserNotificationDatabaseCreationInput struct {
	ID            string
	Content       string
	BelongsToUser string
	// contains filtered or unexported fields
}

UserNotificationDatabaseCreationInput represents what a user could set as input for creating user notifications.

func (*UserNotificationDatabaseCreationInput) ValidateWithContext

func (x *UserNotificationDatabaseCreationInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a UserNotificationDatabaseCreationInput.

type UserNotificationUpdateRequestInput

type UserNotificationUpdateRequestInput struct {
	Status *string `json:"status,omitempty"`
	// contains filtered or unexported fields
}

UserNotificationUpdateRequestInput represents what a user could set as input for updating user notifications.

func (*UserNotificationUpdateRequestInput) ValidateWithContext

func (x *UserNotificationUpdateRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a UserNotificationUpdateRequestInput.

type UserPermissionsRequestInput

type UserPermissionsRequestInput struct {
	Permissions []string `json:"permissions"`
	// contains filtered or unexported fields
}

UserPermissionsRequestInput is what we decode when the frontend wants to check permission status.

type UserPermissionsResponse

type UserPermissionsResponse struct {
	Permissions map[string]bool `json:"permissions"`
	// contains filtered or unexported fields
}

UserPermissionsResponse is what we encode when the frontend wants to check permission status.

type UserRegistrationInput

type UserRegistrationInput struct {
	Birthday              *time.Time `json:"birthday,omitempty"`
	Password              string     `json:"password"`
	EmailAddress          string     `json:"emailAddress"`
	InvitationToken       string     `json:"invitationToken,omitempty"`
	InvitationID          string     `json:"invitationID,omitempty"`
	Username              string     `json:"username"`
	FirstName             string     `json:"firstName"`
	LastName              string     `json:"lastName"`
	AccountName           string     `json:"accountName"`
	AcceptedTOS           bool       `json:"acceptedTOS"`
	AcceptedPrivacyPolicy bool       `json:"acceptedPrivacyPolicy"`
	// contains filtered or unexported fields
}

UserRegistrationInput represents the input required from users to register an account.

func (*UserRegistrationInput) ValidateWithContext

func (i *UserRegistrationInput) ValidateWithContext(ctx context.Context, minUsernameLength, minPasswordLength uint8) error

ValidateWithContext ensures our provided UserRegistrationInput meets expectations.

type UserSearchSubset

type UserSearchSubset struct {
	ID           string `json:"id,omitempty"`
	Username     string `json:"username,omitempty"`
	FirstName    string `json:"firstName,omitempty"`
	LastName     string `json:"lastName,omitempty"`
	EmailAddress string `json:"emailAddress,omitempty"`
	// contains filtered or unexported fields
}

UserSearchSubset represents the subset of values suitable to index for search.

type UserStatusResponse

type UserStatusResponse struct {
	UserID                   string `json:"userID"`
	AccountStatus            string `json:"accountStatus,omitempty"`
	AccountStatusExplanation string `json:"accountStatusExplanation"`
	ActiveAccount            string `json:"activeAccount,omitempty"`
	UserIsAuthenticated      bool   `json:"isAuthenticated"`
	// contains filtered or unexported fields
}

UserStatusResponse is what we encode when the frontend wants to check auth status.

type UsernameReminderRequestInput

type UsernameReminderRequestInput struct {
	EmailAddress string `json:"emailAddress"`
	// contains filtered or unexported fields
}

UsernameReminderRequestInput represents what a user could set as input for creating password reset tokens.

func (*UsernameReminderRequestInput) ValidateWithContext

func (x *UsernameReminderRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a UsernameReminderRequestInput.

type UsernameUpdateInput

type UsernameUpdateInput struct {
	NewUsername     string `json:"newUsername"`
	CurrentPassword string `json:"currentPassword"`
	TOTPToken       string `json:"totpToken"`
	// contains filtered or unexported fields
}

UsernameUpdateInput represents input a User would provide when updating their username.

func (*UsernameUpdateInput) ValidateWithContext

func (i *UsernameUpdateInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext ensures our provided UsernameUpdateInput meets expectations.

type Webhook

type Webhook struct {
	CreatedAt        time.Time              `json:"createdAt"`
	ArchivedAt       *time.Time             `json:"archivedAt"`
	LastUpdatedAt    *time.Time             `json:"lastUpdatedAt"`
	Name             string                 `json:"name"`
	URL              string                 `json:"url"`
	Method           string                 `json:"method"`
	ID               string                 `json:"id"`
	BelongsToAccount string                 `json:"belongsToAccount"`
	ContentType      string                 `json:"contentType"`
	Events           []*WebhookTriggerEvent `json:"events"`
	// contains filtered or unexported fields
}

Webhook represents a webhook listener, an endpoint to send an HTTP request to upon an event.

type WebhookCreationRequestInput

type WebhookCreationRequestInput struct {
	Name        string   `json:"name"`
	ContentType string   `json:"contentType"`
	URL         string   `json:"url"`
	Method      string   `json:"method"`
	Events      []string `json:"events"`
	// contains filtered or unexported fields
}

WebhookCreationRequestInput represents what a User could set as input for creating a webhook.

func (*WebhookCreationRequestInput) ValidateWithContext

func (w *WebhookCreationRequestInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a WebhookCreationRequestInput.

type WebhookDataManager

type WebhookDataManager interface {
	WebhookExists(ctx context.Context, webhookID, accountID string) (bool, error)
	GetWebhook(ctx context.Context, webhookID, accountID string) (*Webhook, error)
	GetWebhooks(ctx context.Context, accountID string, filter *QueryFilter) (*QueryFilteredResult[Webhook], error)
	GetWebhooksForAccountAndEvent(ctx context.Context, accountID string, eventType ServiceEventType) ([]*Webhook, error)
	CreateWebhook(ctx context.Context, input *WebhookDatabaseCreationInput) (*Webhook, error)
	ArchiveWebhook(ctx context.Context, webhookID, accountID string) error
	ArchiveWebhookTriggerEvent(ctx context.Context, webhookID, webhookTriggerEventID string) error
}

WebhookDataManager describes a structure capable of storing webhooks.

type WebhookDataService

type WebhookDataService interface {
	ListWebhooksHandler(http.ResponseWriter, *http.Request)
	CreateWebhookHandler(http.ResponseWriter, *http.Request)
	ReadWebhookHandler(http.ResponseWriter, *http.Request)
	ArchiveWebhookHandler(http.ResponseWriter, *http.Request)
	ArchiveWebhookTriggerEventHandler(http.ResponseWriter, *http.Request)
}

WebhookDataService describes a structure capable of serving traffic related to webhooks.

type WebhookDatabaseCreationInput

type WebhookDatabaseCreationInput struct {
	ID               string
	Name             string
	ContentType      string
	URL              string
	Method           string
	BelongsToAccount string
	Events           []*WebhookTriggerEventDatabaseCreationInput
	// contains filtered or unexported fields
}

WebhookDatabaseCreationInput is used for creating a webhook.

func (*WebhookDatabaseCreationInput) ValidateWithContext

func (w *WebhookDatabaseCreationInput) ValidateWithContext(ctx context.Context) error

ValidateWithContext validates a WebhookDatabaseCreationInput.

type WebhookExecutionRequest

type WebhookExecutionRequest struct {
	Payload      any    `json:"payload"`
	WebhookID    string `json:"webhookID"`
	AccountID    string `json:"accountID"`
	TriggerEvent string `json:"triggerEvent"`
	// contains filtered or unexported fields
}

WebhookExecutionRequest represents a webhook listener, an endpoint to send an HTTP request to upon an event.

type WebhookTriggerEvent

type WebhookTriggerEvent struct {
	CreatedAt        time.Time  `json:"createdAt"`
	ArchivedAt       *time.Time `json:"archivedAt"`
	ID               string     `json:"id"`
	BelongsToWebhook string     `json:"belongsToWebhook"`
	TriggerEvent     string     `json:"triggerEvent"`
	// contains filtered or unexported fields
}

WebhookTriggerEvent represents a webhook trigger event.

type WebhookTriggerEventDatabaseCreationInput

type WebhookTriggerEventDatabaseCreationInput struct {
	ID               string
	BelongsToWebhook string
	TriggerEvent     string
	// contains filtered or unexported fields
}

WebhookTriggerEventDatabaseCreationInput is used for creating a webhook trigger event.

type WorkerService

type WorkerService interface{}

WorkerService describes a structure capable of serving worker-oriented requests.

Directories

Path Synopsis
Package fakes provides fakes model builders
Package fakes provides fakes model builders
Package mocktypes provides mockable implementations of every interface defined in the outer types package
Package mocktypes provides mockable implementations of every interface defined in the outer types package

Jump to

Keyboard shortcuts

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