Back to godoc.org

Package service

v0.0.0-...-9915ac2
Latest Go to latest

The latest major version is .

Published: Sep 13, 2020 | License: Apache-2.0 | Module: github.com/cortezaproject/corteza-server

Index

Constants

const (
	ErrInvalidID          serviceError = "InvalidID"
	ErrNoPermissions      serviceError = "NoPermissions"
	ErrNoGrantPermissions serviceError = "NoGrantPermissions"
)

Variables

var (
	DefaultStore       store.Store
	DefaultPermissions permissionServicer

	DefaultLogger *zap.Logger

	DefaultActionlog actionlog.Recorder

	DefaultSettings      settings.Service
	DefaultAccessControl *accessControl

	// CurrentSettings represents current messaging settings
	CurrentSettings = &types.Settings{}

	DefaultAttachment AttachmentService
	DefaultChannel    ChannelService
	DefaultMessage    MessageService
	DefaultEvent      EventService
	DefaultCommand    CommandService
)

func AccessControl

func AccessControl(perm accessControlPermissionServicer) *accessControl

func AccessControlActionGrant

func AccessControlActionGrant(props ...*accessControlActionProps) *accessControlAction

AccessControlActionGrant returns "messaging:access_control.grant" error

This function is auto-generated.

func AccessControlErrGeneric

func AccessControlErrGeneric(props ...*accessControlActionProps) *accessControlError

AccessControlErrGeneric returns "messaging:access_control.generic" audit event as actionlog.Error

This function is auto-generated.

func AccessControlErrNotAllowedToSetPermissions

func AccessControlErrNotAllowedToSetPermissions(props ...*accessControlActionProps) *accessControlError

AccessControlErrNotAllowedToSetPermissions returns "messaging:access_control.notAllowedToSetPermissions" audit event as actionlog.Alert

This function is auto-generated.

func Activate

func Activate(ctx context.Context) (err error)

func AttachmentActionCreate

func AttachmentActionCreate(props ...*attachmentActionProps) *attachmentAction

AttachmentActionCreate returns "messaging:attachment.create" error

This function is auto-generated.

func AttachmentActionDelete

func AttachmentActionDelete(props ...*attachmentActionProps) *attachmentAction

AttachmentActionDelete returns "messaging:attachment.delete" error

This function is auto-generated.

func AttachmentActionLookup

func AttachmentActionLookup(props ...*attachmentActionProps) *attachmentAction

AttachmentActionLookup returns "messaging:attachment.lookup" error

This function is auto-generated.

func AttachmentActionSearch

func AttachmentActionSearch(props ...*attachmentActionProps) *attachmentAction

AttachmentActionSearch returns "messaging:attachment.search" error

This function is auto-generated.

func AttachmentErrChannelNotFound

func AttachmentErrChannelNotFound(props ...*attachmentActionProps) *attachmentError

AttachmentErrChannelNotFound returns "messaging:attachment.channelNotFound" audit event as actionlog.Warning

This function is auto-generated.

func AttachmentErrFailedToExtractMimeType

func AttachmentErrFailedToExtractMimeType(props ...*attachmentActionProps) *attachmentError

AttachmentErrFailedToExtractMimeType returns "messaging:attachment.failedToExtractMimeType" audit event as actionlog.Alert

This function is auto-generated.

func AttachmentErrFailedToProcessImage

func AttachmentErrFailedToProcessImage(props ...*attachmentActionProps) *attachmentError

AttachmentErrFailedToProcessImage returns "messaging:attachment.failedToProcessImage" audit event as actionlog.Alert

This function is auto-generated.

func AttachmentErrFailedToStoreFile

func AttachmentErrFailedToStoreFile(props ...*attachmentActionProps) *attachmentError

AttachmentErrFailedToStoreFile returns "messaging:attachment.failedToStoreFile" audit event as actionlog.Alert

This function is auto-generated.

func AttachmentErrGeneric

func AttachmentErrGeneric(props ...*attachmentActionProps) *attachmentError

AttachmentErrGeneric returns "messaging:attachment.generic" audit event as actionlog.Error

This function is auto-generated.

func AttachmentErrInvalidID

func AttachmentErrInvalidID(props ...*attachmentActionProps) *attachmentError

AttachmentErrInvalidID returns "messaging:attachment.invalidID" audit event as actionlog.Warning

This function is auto-generated.

func AttachmentErrNotAllowedToAttachToChannel

func AttachmentErrNotAllowedToAttachToChannel(props ...*attachmentActionProps) *attachmentError

AttachmentErrNotAllowedToAttachToChannel returns "messaging:attachment.notAllowedToAttachToChannel" audit event as actionlog.Alert

This function is auto-generated.

func AttachmentErrNotAllowedToCreate

func AttachmentErrNotAllowedToCreate(props ...*attachmentActionProps) *attachmentError

AttachmentErrNotAllowedToCreate returns "messaging:attachment.notAllowedToCreate" audit event as actionlog.Alert

This function is auto-generated.

func AttachmentErrNotAllowedToListAttachments

func AttachmentErrNotAllowedToListAttachments(props ...*attachmentActionProps) *attachmentError

AttachmentErrNotAllowedToListAttachments returns "messaging:attachment.notAllowedToListAttachments" audit event as actionlog.Alert

This function is auto-generated.

func AttachmentErrNotFound

func AttachmentErrNotFound(props ...*attachmentActionProps) *attachmentError

AttachmentErrNotFound returns "messaging:attachment.notFound" audit event as actionlog.Warning

This function is auto-generated.

func ChannelActionAddMember

func ChannelActionAddMember(props ...*channelActionProps) *channelAction

ChannelActionAddMember returns "messaging:channel.addMember" error

This function is auto-generated.

func ChannelActionArchive

func ChannelActionArchive(props ...*channelActionProps) *channelAction

ChannelActionArchive returns "messaging:channel.archive" error

This function is auto-generated.

func ChannelActionCreate

func ChannelActionCreate(props ...*channelActionProps) *channelAction

ChannelActionCreate returns "messaging:channel.create" error

This function is auto-generated.

func ChannelActionDelete

func ChannelActionDelete(props ...*channelActionProps) *channelAction

ChannelActionDelete returns "messaging:channel.delete" error

This function is auto-generated.

func ChannelActionInviteMember

func ChannelActionInviteMember(props ...*channelActionProps) *channelAction

ChannelActionInviteMember returns "messaging:channel.inviteMember" error

This function is auto-generated.

func ChannelActionRemoveMember

func ChannelActionRemoveMember(props ...*channelActionProps) *channelAction

ChannelActionRemoveMember returns "messaging:channel.removeMember" error

This function is auto-generated.

func ChannelActionSetFlag

func ChannelActionSetFlag(props ...*channelActionProps) *channelAction

ChannelActionSetFlag returns "messaging:channel.setFlag" error

This function is auto-generated.

func ChannelActionUnarchive

func ChannelActionUnarchive(props ...*channelActionProps) *channelAction

ChannelActionUnarchive returns "messaging:channel.unarchive" error

This function is auto-generated.

func ChannelActionUndelete

func ChannelActionUndelete(props ...*channelActionProps) *channelAction

ChannelActionUndelete returns "messaging:channel.undelete" error

This function is auto-generated.

func ChannelActionUpdate

func ChannelActionUpdate(props ...*channelActionProps) *channelAction

ChannelActionUpdate returns "messaging:channel.update" error

This function is auto-generated.

func ChannelErrAlreadyArchived

func ChannelErrAlreadyArchived(props ...*channelActionProps) *channelError

ChannelErrAlreadyArchived returns "messaging:channel.alreadyArchived" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrAlreadyDeleted

func ChannelErrAlreadyDeleted(props ...*channelActionProps) *channelError

ChannelErrAlreadyDeleted returns "messaging:channel.alreadyDeleted" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrGeneric

func ChannelErrGeneric(props ...*channelActionProps) *channelError

ChannelErrGeneric returns "messaging:channel.generic" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrInvalidID

func ChannelErrInvalidID(props ...*channelActionProps) *channelError

ChannelErrInvalidID returns "messaging:channel.invalidID" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrInvalidType

func ChannelErrInvalidType(props ...*channelActionProps) *channelError

ChannelErrInvalidType returns "messaging:channel.invalidType" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNameEmpty

func ChannelErrNameEmpty(props ...*channelActionProps) *channelError

ChannelErrNameEmpty returns "messaging:channel.nameEmpty" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNameLength

func ChannelErrNameLength(props ...*channelActionProps) *channelError

ChannelErrNameLength returns "messaging:channel.nameLength" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNotAllowedToCreate

func ChannelErrNotAllowedToCreate(props ...*channelActionProps) *channelError

ChannelErrNotAllowedToCreate returns "messaging:channel.notAllowedToCreate" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNotAllowedToDelete

func ChannelErrNotAllowedToDelete(props ...*channelActionProps) *channelError

ChannelErrNotAllowedToDelete returns "messaging:channel.notAllowedToDelete" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNotAllowedToJoin

func ChannelErrNotAllowedToJoin(props ...*channelActionProps) *channelError

ChannelErrNotAllowedToJoin returns "messaging:channel.notAllowedToJoin" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNotAllowedToListChannels

func ChannelErrNotAllowedToListChannels(props ...*channelActionProps) *channelError

ChannelErrNotAllowedToListChannels returns "messaging:channel.notAllowedToListChannels" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNotAllowedToManageMembers

func ChannelErrNotAllowedToManageMembers(props ...*channelActionProps) *channelError

ChannelErrNotAllowedToManageMembers returns "messaging:channel.notAllowedToManageMembers" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNotAllowedToPart

func ChannelErrNotAllowedToPart(props ...*channelActionProps) *channelError

ChannelErrNotAllowedToPart returns "messaging:channel.notAllowedToPart" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNotAllowedToRead

func ChannelErrNotAllowedToRead(props ...*channelActionProps) *channelError

ChannelErrNotAllowedToRead returns "messaging:channel.notAllowedToRead" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNotAllowedToUndelete

func ChannelErrNotAllowedToUndelete(props ...*channelActionProps) *channelError

ChannelErrNotAllowedToUndelete returns "messaging:channel.notAllowedToUndelete" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNotAllowedToUpdate

func ChannelErrNotAllowedToUpdate(props ...*channelActionProps) *channelError

ChannelErrNotAllowedToUpdate returns "messaging:channel.notAllowedToUpdate" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNotArchived

func ChannelErrNotArchived(props ...*channelActionProps) *channelError

ChannelErrNotArchived returns "messaging:channel.notArchived" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNotDeleted

func ChannelErrNotDeleted(props ...*channelActionProps) *channelError

ChannelErrNotDeleted returns "messaging:channel.notDeleted" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrNotFound

func ChannelErrNotFound(props ...*channelActionProps) *channelError

ChannelErrNotFound returns "messaging:channel.notFound" audit event as actionlog.Warning

This function is auto-generated.

func ChannelErrNotMember

func ChannelErrNotMember(props ...*channelActionProps) *channelError

ChannelErrNotMember returns "messaging:channel.notMember" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrTopicLength

func ChannelErrTopicLength(props ...*channelActionProps) *channelError

ChannelErrTopicLength returns "messaging:channel.topicLength" audit event as actionlog.Error

This function is auto-generated.

func ChannelErrUnableToManageGroupMembers

func ChannelErrUnableToManageGroupMembers(props ...*channelActionProps) *channelError

ChannelErrUnableToManageGroupMembers returns "messaging:channel.unableToManageGroupMembers" audit event as actionlog.Error

This function is auto-generated.

func Initialize

func Initialize(ctx context.Context, log *zap.Logger, c Config) (err error)

func Watchers

func Watchers(ctx context.Context)

type AttachmentService

type AttachmentService interface {
	With(ctx context.Context) AttachmentService

	FindByID(id uint64) (*types.Attachment, error)
	CreateMessageAttachment(name string, size int64, fh io.ReadSeeker, channelId, replyTo uint64) (*types.Attachment, error)
	OpenOriginal(att *types.Attachment) (io.ReadSeeker, error)
	OpenPreview(att *types.Attachment) (io.ReadSeeker, error)
}

func Attachment

func Attachment(ctx context.Context, store store.Store) AttachmentService

type ChannelService

type ChannelService interface {
	With(ctx context.Context) ChannelService

	FindByID(channelID uint64) (*types.Channel, error)
	Find(types.ChannelFilter) (types.ChannelSet, types.ChannelFilter, error)

	Create(channel *types.Channel) (*types.Channel, error)
	Update(channel *types.Channel) (*types.Channel, error)

	FindMembers(channelID uint64) (types.ChannelMemberSet, error)

	InviteUser(channelID uint64, memberIDs ...uint64) (out types.ChannelMemberSet, err error)
	AddMember(channelID uint64, memberIDs ...uint64) (out types.ChannelMemberSet, err error)
	DeleteMember(channelID uint64, memberIDs ...uint64) (err error)

	SetFlag(ID uint64, flag types.ChannelMembershipFlag) (*types.Channel, error)

	Archive(ID uint64) (*types.Channel, error)
	Unarchive(ID uint64) (*types.Channel, error)
	Delete(ID uint64) (*types.Channel, error)
	Undelete(ID uint64) (*types.Channel, error)
}

func Channel

func Channel(ctx context.Context) ChannelService

type CommandService

type CommandService interface {
	With(context.Context) CommandService
	Do(channelID uint64, command, input string) (*types.Message, error)
}

func Command

func Command(ctx context.Context) CommandService

type Config

type Config struct {
	ActionLog options.ActionLogOpt
	Storage   options.StorageOpt
}

type EventService

type EventService interface {
	With(ctx context.Context) EventService
	Activity(a *types.Activity) error
	Message(m *types.Message) error
	MessageFlag(m *types.MessageFlag) error
	UnreadCounters(uu types.UnreadSet) error
	Channel(m *types.Channel) error
	Join(userID, channelID uint64) error
	Part(userID, channelID uint64) error
}

func Event

func Event(ctx context.Context) EventService

Event sends sends events back to all (or specific) subscribers

type MessageService

type MessageService interface {
	With(ctx context.Context) MessageService

	Find(types.MessageFilter) (types.MessageSet, types.MessageFilter, error)
	FindThreads(types.MessageFilter) (types.MessageSet, types.MessageFilter, error)

	Create(messages *types.Message) (*types.Message, error)
	Update(messages *types.Message) (*types.Message, error)

	CreateWithAvatar(message *types.Message, avatar io.Reader) (*types.Message, error)

	React(messageID uint64, reaction string) error
	RemoveReaction(messageID uint64, reaction string) error

	MarkAsRead(channelID, threadID, lastReadMessageID uint64) (uint64, uint32, uint32, error)

	Pin(messageID uint64) error
	RemovePin(messageID uint64) error

	Bookmark(messageID uint64) error
	RemoveBookmark(messageID uint64) error

	Delete(messageID uint64) error
}

func Message

func Message(ctx context.Context) MessageService

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier