Documentation
¶
Index ¶
- type Actionable
- type AddNewComment
- type AssignUnassignTag
- type ChangeUserEmail
- func (action *ChangeUserEmail) GetEmail() string
- func (action *ChangeUserEmail) GetKind() enum.EmailVerificationKind
- func (action *ChangeUserEmail) GetName() string
- func (action *ChangeUserEmail) GetUser() *entity.User
- func (action *ChangeUserEmail) IsAuthorized(ctx context.Context, user *entity.User) bool
- func (action *ChangeUserEmail) Validate(ctx context.Context, user *entity.User) *validate.Result
- type ChangeUserRole
- type CompleteProfile
- type CreateEditOAuthConfig
- type CreateEditTag
- type CreateEditWebhook
- type CreateNewPost
- type CreateTenant
- func (action *CreateTenant) GetEmail() string
- func (action *CreateTenant) GetKind() enum.EmailVerificationKind
- func (action *CreateTenant) GetName() string
- func (action *CreateTenant) GetUser() *entity.User
- func (action *CreateTenant) GetVerificationKey() string
- func (action *CreateTenant) IsAuthorized(ctx context.Context, user *entity.User) bool
- func (action *CreateTenant) Validate(ctx context.Context, user *entity.User) *validate.Result
- type CreateUser
- type DeleteComment
- type DeletePost
- type DeleteTag
- type EditComment
- type GenerateCheckoutLink
- type InviteUsers
- type PreExecuteAction
- type PreviewWebhook
- type ResendSignUpEmail
- func (action *ResendSignUpEmail) GetEmail() string
- func (action *ResendSignUpEmail) GetKind() enum.EmailVerificationKind
- func (action *ResendSignUpEmail) GetName() string
- func (action *ResendSignUpEmail) GetUser() *entity.User
- func (action *ResendSignUpEmail) GetVerificationKey() string
- func (action *ResendSignUpEmail) IsAuthorized(ctx context.Context, user *entity.User) bool
- func (action *ResendSignUpEmail) Validate(ctx context.Context, user *entity.User) *validate.Result
- type SetResponse
- type SetSystemProviderStatus
- type SignInByEmail
- func (action *SignInByEmail) GetEmail() string
- func (action *SignInByEmail) GetKind() enum.EmailVerificationKind
- func (action *SignInByEmail) GetName() string
- func (action *SignInByEmail) GetUser() *entity.User
- func (action *SignInByEmail) IsAuthorized(ctx context.Context, user *entity.User) bool
- func (action *SignInByEmail) Validate(ctx context.Context, user *entity.User) *validate.Result
- type SignInByEmailWithName
- func (action *SignInByEmailWithName) GetEmail() string
- func (action *SignInByEmailWithName) GetKind() enum.EmailVerificationKind
- func (action *SignInByEmailWithName) GetName() string
- func (action *SignInByEmailWithName) GetUser() *entity.User
- func (action *SignInByEmailWithName) IsAuthorized(ctx context.Context, user *entity.User) bool
- func (action *SignInByEmailWithName) Validate(ctx context.Context, user *entity.User) *validate.Result
- type ToggleCommentReaction
- type UpdatePost
- type UpdateTenantAdvancedSettings
- type UpdateTenantEmailAuthAllowed
- type UpdateTenantPrivacySettings
- type UpdateTenantSettings
- type UpdateUserSettings
- type UploadImage
- type UserInvitation
- type VerifySignInCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actionable ¶
type Actionable interface {
IsAuthorized(ctx context.Context, user *entity.User) bool
Validate(ctx context.Context, user *entity.User) *validate.Result
}
Actionable is any action that the user can perform using the web app
type AddNewComment ¶
type AddNewComment struct {
Number int `route:"number"`
Content string `json:"content"`
Attachments []*dto.ImageUpload `json:"attachments"`
}
AddNewComment represents a new comment to be added
func (*AddNewComment) IsAuthorized ¶
IsAuthorized returns true if current user is authorized to perform this action
type AssignUnassignTag ¶ added in v0.8.0
type AssignUnassignTag struct {
Slug string `route:"slug"`
Number int `route:"number"`
Tag *entity.Tag
Post *entity.Post
}
AssignUnassignTag is used to assign or remove a tag to/from an post
func (*AssignUnassignTag) IsAuthorized ¶ added in v0.8.0
IsAuthorized returns true if current user is authorized to perform this action
type ChangeUserEmail ¶ added in v0.9.0
type ChangeUserEmail struct {
Email string `json:"email" format:"lower"`
VerificationKey string
Requestor *entity.User
}
ChangeUserEmail is the action used to change current user's email
func NewChangeUserEmail ¶ added in v0.19.0
func NewChangeUserEmail() *ChangeUserEmail
func (*ChangeUserEmail) GetEmail ¶ added in v0.19.0
func (action *ChangeUserEmail) GetEmail() string
GetEmail returns the email being verified
func (*ChangeUserEmail) GetKind ¶ added in v0.19.0
func (action *ChangeUserEmail) GetKind() enum.EmailVerificationKind
GetKind returns EmailVerificationKindSignIn
func (*ChangeUserEmail) GetName ¶ added in v0.19.0
func (action *ChangeUserEmail) GetName() string
GetName returns empty for this kind of process
func (*ChangeUserEmail) GetUser ¶ added in v0.19.0
func (action *ChangeUserEmail) GetUser() *entity.User
GetUser returns the current user performing this action
func (*ChangeUserEmail) IsAuthorized ¶ added in v0.9.0
IsAuthorized returns true if current user is authorized to perform this action
type ChangeUserRole ¶ added in v0.7.0
ChangeUserRole is the input model change role of an user
func (*ChangeUserRole) IsAuthorized ¶ added in v0.7.0
IsAuthorized returns true if current user is authorized to perform this action
type CompleteProfile ¶ added in v0.6.0
type CompleteProfile struct {
Kind enum.EmailVerificationKind `json:"kind"`
Key string `json:"key"`
Name string `json:"name"`
}
CompleteProfile happens when users completes their profile during first time sign in
func (*CompleteProfile) IsAuthorized ¶ added in v0.6.0
IsAuthorized returns true if current user is authorized to perform this action
type CreateEditOAuthConfig ¶ added in v0.15.0
type CreateEditOAuthConfig struct {
ID int
Logo *dto.ImageUpload `json:"logo"`
Provider string `json:"provider"`
Status int `json:"status"`
DisplayName string `json:"displayName"`
ClientID string `json:"clientID"`
ClientSecret string `json:"clientSecret"`
AuthorizeURL string `json:"authorizeURL"`
TokenURL string `json:"tokenURL"`
Scope string `json:"scope"`
ProfileURL string `json:"profileURL"`
IsTrusted bool `json:"isTrusted"`
JSONUserIDPath string `json:"jsonUserIDPath"`
JSONUserNamePath string `json:"jsonUserNamePath"`
JSONUserEmailPath string `json:"jsonUserEmailPath"`
}
CreateEditOAuthConfig is used to create/edit OAuth config
func NewCreateEditOAuthConfig ¶ added in v0.19.0
func NewCreateEditOAuthConfig() *CreateEditOAuthConfig
func (*CreateEditOAuthConfig) IsAuthorized ¶ added in v0.15.0
IsAuthorized returns true if current user is authorized to perform this action
type CreateEditTag ¶ added in v0.8.0
type CreateEditTag struct {
Slug string `route:"slug"`
Name string `json:"name"`
Color string `json:"color" format:"upper"`
IsPublic bool `json:"isPublic"`
Tag *entity.Tag
}
CreateEditTag is used to create a new tag or edit existing
func (*CreateEditTag) IsAuthorized ¶ added in v0.8.0
IsAuthorized returns true if current user is authorized to perform this action
type CreateEditWebhook ¶ added in v0.20.0
type CreateEditWebhook struct {
Name string `json:"name"`
Type enum.WebhookType `json:"type"`
Status enum.WebhookStatus `json:"status"`
Url string `json:"url"`
Content string `json:"content"`
HttpMethod string `json:"http_method"`
HttpHeaders entity.HttpHeaders `json:"http_headers"`
}
func (*CreateEditWebhook) IsAuthorized ¶ added in v0.20.0
IsAuthorized returns true if current user is authorized to perform this action
type CreateNewPost ¶ added in v0.15.0
type CreateNewPost struct {
Title string `json:"title"`
Description string `json:"description"`
TagSlugs []string `json:"tags"`
Attachments []*dto.ImageUpload `json:"attachments"`
Tags []*entity.Tag
}
CreateNewPost is used to create a new post
func (*CreateNewPost) IsAuthorized ¶ added in v0.15.0
IsAuthorized returns true if current user is authorized to perform this action
func (*CreateNewPost) OnPreExecute ¶ added in v0.25.0
func (input *CreateNewPost) OnPreExecute(ctx context.Context) error
OnPreExecute prefetches Tags for later use
type CreateTenant ¶
type CreateTenant struct {
Token string `json:"token"`
Name string `json:"name"`
Email string `json:"email" format:"lower"`
VerificationKey string
TenantName string `json:"tenantName"`
LegalAgreement bool `json:"legalAgreement"`
Subdomain string `json:"subdomain" format:"lower"`
UserClaims *jwt.OAuthClaims
}
CreateTenant is the input model used to create a tenant
func NewCreateTenant ¶ added in v0.19.0
func NewCreateTenant() *CreateTenant
func (*CreateTenant) GetEmail ¶ added in v0.19.0
func (action *CreateTenant) GetEmail() string
GetEmail returns the email being verified
func (*CreateTenant) GetKind ¶ added in v0.19.0
func (action *CreateTenant) GetKind() enum.EmailVerificationKind
GetKind returns EmailVerificationKindSignUp
func (*CreateTenant) GetName ¶ added in v0.19.0
func (action *CreateTenant) GetName() string
GetName returns the name of the email owner
func (*CreateTenant) GetUser ¶ added in v0.19.0
func (action *CreateTenant) GetUser() *entity.User
GetUser returns the current user performing this action
func (*CreateTenant) GetVerificationKey ¶ added in v0.31.0
func (action *CreateTenant) GetVerificationKey() string
GetVerificationKey returns the verification key
func (*CreateTenant) IsAuthorized ¶
IsAuthorized returns true if current user is authorized to perform this action
type CreateUser ¶ added in v0.16.0
type CreateUser struct {
Name string `json:"name"`
Email string `json:"email"`
Reference string `json:"reference"`
}
CreateUser is the action to create a new user
func (*CreateUser) IsAuthorized ¶ added in v0.16.0
IsAuthorized returns true if current user is authorized to perform this action
type DeleteComment ¶ added in v0.16.0
DeleteComment represents the action of deleting an existing comment
func (*DeleteComment) IsAuthorized ¶ added in v0.16.0
IsAuthorized returns true if current user is authorized to perform this action
type DeletePost ¶ added in v0.15.0
DeletePost represents the action of an administrator deleting an existing Post
func (*DeletePost) IsAuthorized ¶ added in v0.15.0
IsAuthorized returns true if current user is authorized to perform this action
type DeleteTag ¶ added in v0.8.0
DeleteTag is used to delete an existing tag
func (*DeleteTag) IsAuthorized ¶ added in v0.8.0
IsAuthorized returns true if current user is authorized to perform this action
type EditComment ¶ added in v0.11.0
type EditComment struct {
PostNumber int `route:"number"`
ID int `route:"id"`
Content string `json:"content"`
Attachments []*dto.ImageUpload `json:"attachments"`
Post *entity.Post
Comment *entity.Comment
}
EditComment represents the action to update an existing comment
func (*EditComment) IsAuthorized ¶ added in v0.11.0
IsAuthorized returns true if current user is authorized to perform this action
type GenerateCheckoutLink ¶ added in v0.22.0
type GenerateCheckoutLink struct {
PlanID string `json:"planId"`
}
GenerateCheckoutLink is used to generate a Paddle-hosted checkout link for the service subscription
func (*GenerateCheckoutLink) IsAuthorized ¶ added in v0.22.0
IsAuthorized returns true if current user is authorized to perform this action
type InviteUsers ¶ added in v0.12.0
type InviteUsers struct {
Subject string `json:"subject"`
Message string `json:"message"`
Recipients []string `json:"recipients" format:"lower"`
IsSampleInvite bool
Invitations []*UserInvitation
}
InviteUsers is used to invite new users into Fider
func (*InviteUsers) IsAuthorized ¶ added in v0.12.0
IsAuthorized returns true if current user is authorized to perform this action
type PreExecuteAction ¶ added in v0.19.0
PreExecuteAction can add custom pre processing logic for any action OnPreExecute is executed before IsAuthorized and Validate
type PreviewWebhook ¶ added in v0.20.0
type PreviewWebhook struct {
Type enum.WebhookType `json:"type"`
Url string `json:"url"`
Content string `json:"content"`
}
func (*PreviewWebhook) IsAuthorized ¶ added in v0.20.0
IsAuthorized returns true if current user is authorized to perform this action
type ResendSignUpEmail ¶ added in v0.31.0
type ResendSignUpEmail struct {
VerificationKey string
}
ResendSignUpEmail is the input model used to resend signup verification email
func NewResendSignUpEmail ¶ added in v0.31.0
func NewResendSignUpEmail() *ResendSignUpEmail
func (*ResendSignUpEmail) GetEmail ¶ added in v0.31.0
func (action *ResendSignUpEmail) GetEmail() string
GetEmail returns empty string (not used in this action)
func (*ResendSignUpEmail) GetKind ¶ added in v0.31.0
func (action *ResendSignUpEmail) GetKind() enum.EmailVerificationKind
GetKind returns EmailVerificationKindSignUp
func (*ResendSignUpEmail) GetName ¶ added in v0.31.0
func (action *ResendSignUpEmail) GetName() string
GetName returns empty string (not used in this action)
func (*ResendSignUpEmail) GetUser ¶ added in v0.31.0
func (action *ResendSignUpEmail) GetUser() *entity.User
GetUser returns the current user performing this action
func (*ResendSignUpEmail) GetVerificationKey ¶ added in v0.31.0
func (action *ResendSignUpEmail) GetVerificationKey() string
GetVerificationKey returns the verification key
func (*ResendSignUpEmail) IsAuthorized ¶ added in v0.31.0
IsAuthorized returns true if current user is authorized to perform this action
type SetResponse ¶
type SetResponse struct {
Number int `route:"number"`
Status enum.PostStatus `json:"status"`
Text string `json:"text"`
OriginalNumber int `json:"originalNumber"`
Original *entity.Post
}
SetResponse represents the action to update an post response
func (*SetResponse) IsAuthorized ¶
IsAuthorized returns true if current user is authorized to perform this action
type SetSystemProviderStatus ¶ added in v0.30.0
type SetSystemProviderStatus struct {
Provider string `json:"provider"`
IsEnabled bool `json:"isEnabled"`
}
SetSystemProviderStatus is used to enable/disable built-in OAuth providers
func (*SetSystemProviderStatus) IsAuthorized ¶ added in v0.30.0
IsAuthorized returns true if current user is authorized to perform this action
type SignInByEmail ¶ added in v0.6.0
SignInByEmail happens when user request to sign in by email
func NewSignInByEmail ¶ added in v0.19.0
func NewSignInByEmail() *SignInByEmail
func (*SignInByEmail) GetEmail ¶ added in v0.19.0
func (action *SignInByEmail) GetEmail() string
GetEmail returns the email being verified
func (*SignInByEmail) GetKind ¶ added in v0.19.0
func (action *SignInByEmail) GetKind() enum.EmailVerificationKind
GetKind returns EmailVerificationKindSignIn
func (*SignInByEmail) GetName ¶ added in v0.19.0
func (action *SignInByEmail) GetName() string
GetName returns empty for this kind of process
func (*SignInByEmail) GetUser ¶ added in v0.19.0
func (action *SignInByEmail) GetUser() *entity.User
GetUser returns the current user performing this action
func (*SignInByEmail) IsAuthorized ¶ added in v0.6.0
IsAuthorized returns true if current user is authorized to perform this action
type SignInByEmailWithName ¶ added in v0.31.0
type SignInByEmailWithName struct {
Email string `json:"email" format:"lower"`
Name string `json:"name"`
VerificationCode string
}
SignInByEmailWithName happens when a new user (without account) requests to sign in by email
func NewSignInByEmailWithName ¶ added in v0.31.0
func NewSignInByEmailWithName() *SignInByEmailWithName
func (*SignInByEmailWithName) GetEmail ¶ added in v0.31.0
func (action *SignInByEmailWithName) GetEmail() string
GetEmail returns the email being verified
func (*SignInByEmailWithName) GetKind ¶ added in v0.31.0
func (action *SignInByEmailWithName) GetKind() enum.EmailVerificationKind
GetKind returns EmailVerificationKindSignIn
func (*SignInByEmailWithName) GetName ¶ added in v0.31.0
func (action *SignInByEmailWithName) GetName() string
GetName returns the name provided by the user
func (*SignInByEmailWithName) GetUser ¶ added in v0.31.0
func (action *SignInByEmailWithName) GetUser() *entity.User
GetUser returns the current user performing this action
func (*SignInByEmailWithName) IsAuthorized ¶ added in v0.31.0
IsAuthorized returns true if current user is authorized to perform this action
type ToggleCommentReaction ¶ added in v0.23.0
type ToggleCommentReaction struct {
Number int `route:"number"`
Comment int `route:"id"`
Reaction string `route:"reaction"`
}
func (*ToggleCommentReaction) IsAuthorized ¶ added in v0.23.0
IsAuthorized returns true if current user is authorized to perform this action
type UpdatePost ¶ added in v0.15.0
type UpdatePost struct {
Number int `route:"number"`
Title string `json:"title"`
Description string `json:"description"`
Attachments []*dto.ImageUpload `json:"attachments"`
Post *entity.Post
}
UpdatePost is used to edit an existing new post
func (*UpdatePost) IsAuthorized ¶ added in v0.15.0
IsAuthorized returns true if current user is authorized to perform this action
func (*UpdatePost) OnPreExecute ¶ added in v0.19.0
func (input *UpdatePost) OnPreExecute(ctx context.Context) error
OnPreExecute prefetches Post for later use
type UpdateTenantAdvancedSettings ¶ added in v0.13.0
type UpdateTenantAdvancedSettings struct {
CustomCSS string `json:"customCSS"`
AllowedSchemes string `json:"allowedSchemes"`
}
UpdateTenantAdvancedSettings is the input model used to update tenant advanced settings
func (*UpdateTenantAdvancedSettings) IsAuthorized ¶ added in v0.13.0
func (action *UpdateTenantAdvancedSettings) IsAuthorized(ctx context.Context, user *entity.User) bool
IsAuthorized returns true if current user is authorized to perform this action
type UpdateTenantEmailAuthAllowed ¶ added in v0.19.0
type UpdateTenantEmailAuthAllowed struct {
IsEmailAuthAllowed bool `json:"isEmailAuthAllowed"`
}
UpdateTenantEmailAuthAllowed is the input model used to update tenant privacy settings
func (*UpdateTenantEmailAuthAllowed) IsAuthorized ¶ added in v0.19.0
func (action *UpdateTenantEmailAuthAllowed) IsAuthorized(ctx context.Context, user *entity.User) bool
IsAuthorized returns true if current user is authorized to perform this action
type UpdateTenantPrivacySettings ¶ added in v0.28.0
type UpdateTenantPrivacySettings struct {
IsPrivate bool `json:"isPrivate"`
IsFeedEnabled bool `json:"isFeedEnabled"`
}
UpdateTenantPrivacySettings is the input model used to update tenant privacy settings
func (*UpdateTenantPrivacySettings) IsAuthorized ¶ added in v0.28.0
func (action *UpdateTenantPrivacySettings) IsAuthorized(ctx context.Context, user *entity.User) bool
IsAuthorized returns true if current user is authorized to perform this action
type UpdateTenantSettings ¶
type UpdateTenantSettings struct {
Logo *dto.ImageUpload `json:"logo"`
Title string `json:"title"`
Invitation string `json:"invitation"`
WelcomeMessage string `json:"welcomeMessage"`
Locale string `json:"locale"`
CNAME string `json:"cname" format:"lower"`
}
UpdateTenantSettings is the input model used to update tenant settings
func NewUpdateTenantSettings ¶ added in v0.19.0
func NewUpdateTenantSettings() *UpdateTenantSettings
func (*UpdateTenantSettings) IsAuthorized ¶
IsAuthorized returns true if current user is authorized to perform this action
type UpdateUserSettings ¶ added in v0.6.0
type UpdateUserSettings struct {
Name string `json:"name"`
AvatarType enum.AvatarType `json:"avatarType"`
Avatar *dto.ImageUpload `json:"avatar"`
Settings map[string]string `json:"settings"`
}
UpdateUserSettings happens when users updates their settings
func NewUpdateUserSettings ¶ added in v0.19.0
func NewUpdateUserSettings() *UpdateUserSettings
func (*UpdateUserSettings) IsAuthorized ¶ added in v0.6.0
IsAuthorized returns true if current user is authorized to perform this action
type UploadImage ¶ added in v0.28.0
type UploadImage struct {
Image *dto.ImageUpload `json:"image"`
}
UploadImage is used to upload an image without associating it with a post or comment
func (*UploadImage) Initialize ¶ added in v0.28.0
func (input *UploadImage) Initialize()
Initialize the model
func (*UploadImage) IsAuthorized ¶ added in v0.28.0
IsAuthorized returns true if current user is authorized to perform this action
type UserInvitation ¶ added in v0.19.0
UserInvitation is the model used to register an invite sent to an user
func (*UserInvitation) GetEmail ¶ added in v0.19.0
func (e *UserInvitation) GetEmail() string
GetEmail returns the invited user's email
func (*UserInvitation) GetKind ¶ added in v0.19.0
func (e *UserInvitation) GetKind() enum.EmailVerificationKind
GetKind returns EmailVerificationKindUserInvitation
func (*UserInvitation) GetName ¶ added in v0.19.0
func (e *UserInvitation) GetName() string
GetName returns empty for this kind of process
func (*UserInvitation) GetUser ¶ added in v0.19.0
func (e *UserInvitation) GetUser() *entity.User
GetUser returns the current user performing this action
type VerifySignInCode ¶ added in v0.31.0
type VerifySignInCode struct {
Email string `json:"email" format:"lower"`
Code string `json:"code"`
}
VerifySignInCode happens when user enters the verification code received via email
func (*VerifySignInCode) IsAuthorized ¶ added in v0.31.0
IsAuthorized returns true if current user is authorized to perform this action