mutate

package
v0.0.0-...-6d36bb5 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EMOTE_SET_PERSONAL_MIN_EMOTE_LIFETIME       = time.Hour
	EMOTE_SET_PERSONAL_MIN_CHANNEL_COUNT  int32 = 50
)
View Source
const EDITORS_MOST_COUNT = 15
View Source
const EMOTE_CLAIMANTS_MOST = 10
View Source
const MAXIMUM_ALLOWED_EMOTE_SETS = 10

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateBanOptions

type CreateBanOptions struct {
	Actor          *structures.User
	AnonymousActor bool
	Victim         *structures.User
	SkipValidation bool
}

type DeleteEmoteOptions

type DeleteEmoteOptions struct {
	Actor structures.User
	// If true, this is a un-delete operation
	Undo bool
	// If specified, only this version will be deleted
	//
	// by default, all versions will be deleted
	VersionID primitive.ObjectID
	// The reason given for the deletion: will appear in audit logs
	Reason string
	// If set, the emote will be given an instruction to be replaced with the specified emote
	ReplaceID      primitive.ObjectID
	SkipValidation bool
}

type DeleteUserOptions

type DeleteUserOptions struct {
	Actor  structures.User
	Victim structures.User
}

type EditBanOptions

type EditBanOptions struct {
	Actor          *structures.User
	SkipValidation bool
}

type EmoteEditOptions

type EmoteEditOptions struct {
	Actor          structures.User
	SkipValidation bool
}

type EmoteSetMutationOptions

type EmoteSetMutationOptions struct {
	Actor          structures.User
	SkipValidation bool
}

type EmoteSetMutationSetEmoteItem

type EmoteSetMutationSetEmoteItem struct {
	Action structures.ListItemAction
	ID     primitive.ObjectID
	Name   string

	ChannelCount int32
	Flags        structures.BitField[structures.ActiveEmoteFlag]
	// contains filtered or unexported fields
}

type EmoteSetMutationSetEmoteOptions

type EmoteSetMutationSetEmoteOptions struct {
	Actor    structures.User
	Emotes   []EmoteSetMutationSetEmoteItem
	Channels []primitive.ObjectID
}

type InstanceOptions

type InstanceOptions struct {
	ID        svc.AppIdentity
	Mongo     mongo.Instance
	Loaders   loaders.Instance
	Redis     redis.Instance
	S3        s3.Instance
	Modelizer model.Modelizer
	Events    events.Instance
	CD        compactdisc.Instance
}

type MergeEmoteOptions

type MergeEmoteOptions struct {
	Actor    structures.User
	NewEmote structures.Emote
	// If specified, only this version will be merged
	//
	// by default, the latest version will be merged
	VersionID primitive.ObjectID
	// The reason given for the merger: will appear in audit logs
	Reason         string
	SkipValidation bool
}

type MessageReadStateOptions

type MessageReadStateOptions struct {
	Actor               *structures.User
	Filter              bson.M
	SkipPermissionCheck bool
}

type MessageReadStateResponse

type MessageReadStateResponse struct {
	Updated int64   `json:"changed"`
	Errors  []error `json:"errors"`
}

type Mutate

type Mutate struct {
	// contains filtered or unexported fields
}

func New

func New(opt InstanceOptions) *Mutate

func (*Mutate) CreateBan

func (m *Mutate) CreateBan(ctx context.Context, bb *structures.BanBuilder, opt CreateBanOptions) error

func (*Mutate) CreateEmoteSet

func (m *Mutate) CreateEmoteSet(ctx context.Context, esb *structures.EmoteSetBuilder, opt EmoteSetMutationOptions) error

Create: create the new emote set

func (*Mutate) CreateRole

func (m *Mutate) CreateRole(ctx context.Context, rb *structures.RoleBuilder, opt RoleMutationOptions) error

Create: create the new role

func (*Mutate) DeleteEmote

func (m *Mutate) DeleteEmote(ctx context.Context, eb *structures.EmoteBuilder, opt DeleteEmoteOptions) error

func (*Mutate) DeleteEmoteSet

func (m *Mutate) DeleteEmoteSet(ctx context.Context, esb *structures.EmoteSetBuilder, opt EmoteSetMutationOptions) error

func (*Mutate) DeleteRole

func (m *Mutate) DeleteRole(ctx context.Context, rb *structures.RoleBuilder, opt RoleMutationOptions) error

Delete: delete the role

func (*Mutate) DeleteUser

func (m *Mutate) DeleteUser(ctx context.Context, opt DeleteUserOptions) (int, error)

func (*Mutate) EditBan

func (m *Mutate) EditBan(ctx context.Context, bb *structures.BanBuilder, opt EditBanOptions) error

func (*Mutate) EditEmote

func (m *Mutate) EditEmote(ctx context.Context, eb *structures.EmoteBuilder, opt EmoteEditOptions) error

Edit: edit the emote. Modify the EmoteBuilder beforehand!

To account for editor permissions, the "editor_of" relation should be included in the actor's data

func (*Mutate) EditEmotesInSet

func (m *Mutate) EditEmotesInSet(ctx context.Context, esb *structures.EmoteSetBuilder, opt EmoteSetMutationSetEmoteOptions) error

SetEmote: enable, edit or disable active emotes in the set

func (*Mutate) EditRole

func (m *Mutate) EditRole(ctx context.Context, rb *structures.RoleBuilder, opt RoleEditOptions) error

Edit: edit the role. Modify the RoleBuilder beforehand!

func (*Mutate) MergeEmote

func (m *Mutate) MergeEmote(ctx context.Context, eb *structures.EmoteBuilder, opt MergeEmoteOptions) error

func (*Mutate) ModifyUserEditors

func (m *Mutate) ModifyUserEditors(ctx context.Context, ub *structures.UserBuilder, opt UserEditorsOptions) error

func (*Mutate) SendInboxMessage

func (m *Mutate) SendInboxMessage(ctx context.Context, mb *structures.MessageBuilder[structures.MessageDataInbox], opt SendInboxMessageOptions) error

func (*Mutate) SendModRequestMessage

func (m *Mutate) SendModRequestMessage(ctx context.Context, mb *structures.MessageBuilder[structures.MessageDataModRequest], weight int32) error

func (*Mutate) SetMessageReadStates

func (m *Mutate) SetMessageReadStates(ctx context.Context, mb *structures.MessageBuilder[bson.Raw], read bool, opt MessageReadStateOptions) (*MessageReadStateResponse, error)

func (*Mutate) SetRole

func (m *Mutate) SetRole(ctx context.Context, ub *structures.UserBuilder, opt SetUserRoleOptions) error

SetRole: add or remove a role for the user

func (*Mutate) SetUserConnectionActiveEmoteSet

func (m *Mutate) SetUserConnectionActiveEmoteSet(ctx context.Context, ub *structures.UserBuilder, opt SetUserActiveEmoteSet) error

func (*Mutate) TransferUserConnection

func (m *Mutate) TransferUserConnection(ctx context.Context, actor structures.User, transferer, transferee structures.User, connectionID string) error

func (*Mutate) UpdateEmoteSet

func (m *Mutate) UpdateEmoteSet(ctx context.Context, esb *structures.EmoteSetBuilder, opt EmoteSetMutationOptions) error

type RoleEditOptions

type RoleEditOptions struct {
	Actor            *structures.User
	OriginalPosition int32
}

type RoleMutationOptions

type RoleMutationOptions struct {
	Actor *structures.User
}

type SendInboxMessageOptions

type SendInboxMessageOptions struct {
	Actor                *structures.User
	Recipients           []primitive.ObjectID
	ConsiderBlockedUsers bool
}

type SetUserActiveEmoteSet

type SetUserActiveEmoteSet struct {
	NewSet         structures.EmoteSet
	OldSet         structures.EmoteSet
	Platform       structures.UserConnectionPlatform
	Actor          structures.User
	ConnectionID   string
	SkipValidation bool
}

type SetUserRoleOptions

type SetUserRoleOptions struct {
	Role   structures.Role
	Actor  structures.User
	Action structures.ListItemAction
}

type UserEditorsOptions

type UserEditorsOptions struct {
	Actor             *structures.User
	Editor            *structures.User
	EditorPermissions structures.UserEditorPermission
	EditorVisible     bool
	Action            structures.ListItemAction
}

Jump to

Keyboard shortcuts

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