Documentation
¶
Index ¶
- Constants
- type AbuseReport
- type Account
- type AccountContact
- type AccountContactType
- type AccountGroup
- type AccountGroupMember
- type AccountPage
- type AccountProfile
- type AccountRelationship
- type ActionEvent
- type ApiKey
- type AuditRecord
- type AuthConfig
- type AuthContext
- type AuthFactor
- type AuthFactorType
- type AuthTicket
- type Badge
- type BaseModel
- type CheckInRecord
- type JSONMap
- type MagicToken
- type MagicTokenType
- type Notification
- type NotificationSubscriber
- type PreferenceAuth
- type PreferenceNotification
- type Program
- type ProgramBadge
- type ProgramGroup
- type ProgramMember
- type ProgramPrice
- type Punishment
- type Realm
- type RealmMember
- type RelationshipStatus
- type Status
- type StatusAttitude
- type ThirdClient
Constants ¶
View Source
const ( PasswordAuthFactor = AuthFactorType(iota) EmailPasswordFactor TimeOtpFactor InAppNotifyFactor )
View Source
const ( NotifySubscriberFirebase = "firebase" NotifySubscriberAPNs = "apple" )
View Source
const ( PunishmentTypeStrike = iota PunishmentTypeLimited PunishmentTypeDisabled )
View Source
const ( RealmPopularityMemberFactor = 5 RealmPopularityPostFactor = 10 RealmPopularityChatFactor = 2 )
View Source
const ( RelationshipPending = RelationshipStatus(iota) RelationshipFriend RelationshipBlocked RelationshipWaiting )
View Source
const ( ReportStatusPending = "pending" ReportStatusReviewing = "reviewing" ReportStatusConfirmed = "confirmed" ReportStatusRejected = "rejected" ReportStatusProcessed = "processed" )
View Source
const ( AttitudeNeutral = StatusAttitude(iota) AttitudePositive AttitudeNegative )
View Source
const ( ConfirmMagicToken = MagicTokenType(iota) RegistrationMagicToken ResetPasswordMagicToken DeleteAccountMagicToken )
View Source
const (
EmailAccountContact = AccountContactType(iota)
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbuseReport ¶
type Account ¶
type Account struct {
BaseModel
Name string `json:"name" gorm:"uniqueIndex"`
Nick string `json:"nick"`
Avatar *string `json:"avatar"`
Banner *string `json:"banner"`
ConfirmedAt *time.Time `json:"confirmed_at"`
SuspendedAt *time.Time `json:"suspended_at"`
PermNodes datatypes.JSONMap `json:"perm_nodes"`
Language string `json:"language"`
AutomatedBy *Account `json:"automated_by" gorm:"foreignKey:AutomatedID"`
AutomatedID *uint `json:"automated_id"`
AffiliatedTo *Realm `json:"affiliated_to" gorm:"foreignKey:AffiliatedID"`
AffiliatedID *uint `json:"affiliated_id"`
Profile AccountProfile `json:"profile,omitempty"`
Contacts []AccountContact `json:"contacts,omitempty"`
Badges []Badge `json:"badges,omitempty"`
Tickets []AuthTicket `json:"tickets,omitempty"`
Factors []AuthFactor `json:"factors,omitempty"`
Relations []AccountRelationship `json:"relations,omitempty" gorm:"foreignKey:AccountID"`
Punishments []Punishment `json:"punishments,omitempty"`
// Keep this for backward compability
Description string `json:"description" gorm:"-"`
}
func (Account) EncodeToUserInfo ¶
func (Account) GetPrimaryEmail ¶
func (v Account) GetPrimaryEmail() AccountContact
type AccountContact ¶
type AccountContactType ¶
type AccountContactType = int8
type AccountGroup ¶
type AccountGroupMember ¶
type AccountGroupMember struct {
BaseModel
Account Account `json:"account"`
Group AccountGroup `json:"group"`
AccountID uint `json:"account_id"`
GroupID uint `json:"group_id"`
}
type AccountPage ¶
type AccountProfile ¶
type AccountProfile struct {
BaseModel
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Description string `json:"description"`
TimeZone string `json:"time_zone"`
Location string `json:"location"`
Pronouns string `json:"pronouns"`
Gender string `json:"gender"`
Links datatypes.JSONMap `json:"links"`
Experience uint64 `json:"experience"`
LastSeenAt *time.Time `json:"last_seen_at"`
Birthday *time.Time `json:"birthday"`
AccountID uint `json:"account_id"`
}
type AccountRelationship ¶
type ActionEvent ¶
type ActionEvent struct {
BaseModel
Type string `json:"type"`
Metadata datatypes.JSONMap `json:"metadata"`
Location *string `json:"location"`
CoordinateX *float64 `json:"coordinate_x"`
CoordinateY *float64 `json:"coordinate_y"`
IpAddress string `json:"ip_address"`
UserAgent string `json:"user_agent"`
Account Account `json:"account"`
AccountID uint `json:"account_id"`
}
type AuditRecord ¶
type AuditRecord struct {
BaseModel
Action string `json:"action"`
Metadata datatypes.JSONMap `json:"metadata"`
Location *string `json:"location"`
CoordinateX *float64 `json:"coordinate_x"`
CoordinateY *float64 `json:"coordinate_y"`
UserAgent string `json:"user_agent"`
IpAddress string `json:"ip_address"`
AccountID uint `json:"account_id"`
}
type AuthConfig ¶
type AuthContext ¶
type AuthContext struct {
Ticket AuthTicket `json:"ticket"`
Account Account `json:"account"`
}
type AuthFactor ¶
type AuthFactorType ¶
type AuthFactorType = int8
type AuthTicket ¶
type AuthTicket struct {
BaseModel
Location *string `json:"location"`
CoordinateX *float64 `json:"coordinate_x"`
CoordinateY *float64 `json:"coordinate_y"`
IpAddress string `json:"ip_address"`
UserAgent string `json:"user_agent"`
StepRemain int `json:"step_remain"`
Claims datatypes.JSONSlice[string] `json:"claims"`
Audiences datatypes.JSONSlice[string] `json:"audiences"`
FactorTrail datatypes.JSONSlice[int] `json:"factor_trail"`
GrantToken *string `json:"grant_token"`
AccessToken *string `json:"access_token"`
RefreshToken *string `json:"refresh_token"`
ExpiredAt *time.Time `json:"expired_at"`
AvailableAt *time.Time `json:"available_at"`
LastGrantAt *time.Time `json:"last_grant_at"`
Nonce *string `json:"nonce"`
ClientID *uint `json:"client_id"`
Account Account `json:"account"`
AccountID uint `json:"account_id"`
}
func (AuthTicket) IsAvailable ¶
func (v AuthTicket) IsAvailable() error
func (AuthTicket) IsCanBeAvailble ¶
func (v AuthTicket) IsCanBeAvailble() error
type CheckInRecord ¶
type CheckInRecord struct {
BaseModel
ResultTier int `json:"result_tier"`
ResultExperience int `json:"result_experience"`
ResultCoin float64 `json:"result_coin"`
CurrentStreak int `json:"current_streak"`
// The result modifiers are some random tips that will show up in the client;
// This field is to use to make sure the tips will be the same when the client is reloaded.
// For now, this modifier slice will contain four random numbers from 0 to 1024.
// Client should mod this modifier by the length of total available tips.
ResultModifiers datatypes.JSONSlice[int] `json:"result_modifiers"`
Account Account `json:"account"`
AccountID uint `json:"account_id"`
}
type MagicToken ¶
type MagicTokenType ¶
type MagicTokenType = int8
type Notification ¶
type Notification struct {
BaseModel
Topic string `json:"topic"`
Title string `json:"title"`
Subtitle string `json:"subtitle"`
Body string `json:"body"`
Metadata datatypes.JSONMap `json:"metadata"`
Priority int `json:"priority"`
SenderID *uint `json:"sender_id"`
Account Account `json:"account"`
AccountID uint `json:"account_id"`
ReadAt *time.Time `json:"read_at"`
}
func NewNotificationFromPushkit ¶
func NewNotificationFromPushkit(pk pushkit.Notification) Notification
func (Notification) EncodeToPushkit ¶
func (v Notification) EncodeToPushkit() pushkit.Notification
type NotificationSubscriber ¶
type PreferenceAuth ¶
type PreferenceNotification ¶
type Program ¶
type Program struct {
BaseModel
Name string `json:"name"`
Description string `json:"description"`
Alias string `json:"alias" gorm:"uniqueIndex"`
ExpRequirement int64 `json:"exp_requirement"`
Price datatypes.JSONType[ProgramPrice] `json:"price"`
Badge datatypes.JSONType[ProgramBadge] `json:"badge"`
Group datatypes.JSONType[ProgramGroup] `json:"group"`
Appearance datatypes.JSONMap `json:"appearance"`
}
type ProgramBadge ¶
type ProgramGroup ¶
type ProgramGroup struct {
ID uint `json:"id"`
}
type ProgramMember ¶
type ProgramPrice ¶
type Punishment ¶
type Punishment struct {
BaseModel
Reason string `json:"reason"`
Type int `json:"type"`
PermNodes datatypes.JSONMap `json:"perm_nodes"`
ExpiredAt *time.Time `json:"expired_at"`
Account Account `json:"account"`
AccountID uint `json:"account_id"`
Moderator *Account `json:"moderator"`
ModeratorID *uint `json:"moderator_id"`
}
type Realm ¶
type Realm struct {
BaseModel
Alias string `json:"alias" gorm:"uniqueIndex"`
Name string `json:"name"`
Description string `json:"description"`
Members []RealmMember `json:"members"`
Avatar *string `json:"avatar"`
Banner *string `json:"banner"`
Popularity int `json:"popularity"`
AccessPolicy datatypes.JSONMap `json:"access_policy"`
IsPublic bool `json:"is_public"`
IsCommunity bool `json:"is_community"`
AccountID uint `json:"account_id"`
}
func NewRealmFromProto ¶
type RealmMember ¶
type RealmMember struct {
BaseModel
RealmID uint `json:"realm_id"`
AccountID uint `json:"account_id"`
Realm Realm `json:"realm"`
Account Account `json:"account"`
PowerLevel int `json:"power_level"`
}
func NewRealmMemberFromProto ¶
func NewRealmMemberFromProto(proto *proto.RealmMemberInfo) RealmMember
type RelationshipStatus ¶
type RelationshipStatus = int8
type StatusAttitude ¶
type StatusAttitude = uint8
type ThirdClient ¶
type ThirdClient struct {
BaseModel
Alias string `json:"alias" gorm:"uniqueIndex"`
Name string `json:"name"`
Description string `json:"description"`
Secret string `json:"secret"`
Urls datatypes.JSONSlice[string] `json:"urls"`
Callbacks datatypes.JSONSlice[string] `json:"callbacks"`
IsDraft bool `json:"is_draft"`
AccountID *uint `json:"account_id"`
}
Click to show internal directories.
Click to hide internal directories.