services

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2023 License: MPL-2.0 Imports: 30 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidEventDeliveryStatus  = errors.New("only successful events can be force resent")
	ErrNoValidEndpointFound        = errors.New("no valid endpoint found")
	ErrNoValidOwnerIDEndpointFound = errors.New("owner ID has no configured endpoints")
	ErrInvalidEndpointID           = errors.New("please provide an endpoint ID")
)
View Source
var (
	ErrSubscriptionNotFound            = errors.New("subscription not found")
	ErrUpateSubscriptionError          = errors.New("failed to update subscription")
	ErrCreateSubscriptionError         = errors.New("failed to create subscription")
	ErrDeletedSubscriptionError        = errors.New("failed to delete subscription")
	ErrValidateSubscriptionError       = errors.New("failed to validate subscription")
	ErrInvalidSubscriptionFilterFormat = errors.New("invalid subscription filter format")
	ErrValidateSubscriptionFilterError = errors.New("failed to validate subscription filter")
	ErrCannotFetchSubcriptionsError    = errors.New("an error occurred while fetching subscriptions")
)
View Source
var ErrInvalidEndpoints = errors.New("endpoints cannot be empty")

Functions

func ValidateEndpointAuthentication added in v0.8.0

func ValidateEndpointAuthentication(auth *datastore.EndpointAuthentication) (*datastore.EndpointAuthentication, error)

Types

type ConfigService added in v0.6.0

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

func NewConfigService added in v0.6.0

func NewConfigService(configRepo datastore.ConfigurationRepository) *ConfigService

func (*ConfigService) CreateConfiguration added in v0.6.0

func (c *ConfigService) CreateConfiguration(ctx context.Context, newConfig *models.Configuration) (*datastore.Configuration, error)

func (*ConfigService) LoadConfiguration added in v0.6.0

func (c *ConfigService) LoadConfiguration(ctx context.Context) (*datastore.Configuration, error)

func (*ConfigService) UpdateConfiguration added in v0.6.0

func (c *ConfigService) UpdateConfiguration(ctx context.Context, config *models.Configuration) (*datastore.Configuration, error)

type DeviceService added in v0.7.0

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

func NewDeviceService added in v0.7.0

func NewDeviceService(deviceRepo datastore.DeviceRepository) *DeviceService

func (*DeviceService) LoadDevicesPaged added in v0.7.0

type EndpointService added in v0.8.0

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

func NewEndpointService added in v0.8.0

func NewEndpointService(projectRepo datastore.ProjectRepository, endpointRepo datastore.EndpointRepository, eventRepo datastore.EventRepository, eventDeliveryRepo datastore.EventDeliveryRepository, cache cache.Cache, queue queue.Queuer) *EndpointService

func (*EndpointService) CountProjectEndpoints added in v0.8.0

func (a *EndpointService) CountProjectEndpoints(ctx context.Context, projectID string) (int64, error)

func (*EndpointService) CreateEndpoint added in v0.8.0

func (a *EndpointService) CreateEndpoint(ctx context.Context, e models.Endpoint, projectID string) (*datastore.Endpoint, error)

func (*EndpointService) DeleteEndpoint added in v0.8.0

func (a *EndpointService) DeleteEndpoint(ctx context.Context, e *datastore.Endpoint, project *datastore.Project) error

func (*EndpointService) ExpireSecret added in v0.8.0

func (a *EndpointService) ExpireSecret(ctx context.Context, s *models.ExpireSecret, endpoint *datastore.Endpoint, project *datastore.Project) (*datastore.Endpoint, error)

func (*EndpointService) LoadEndpointsPaged added in v0.8.0

func (a *EndpointService) LoadEndpointsPaged(ctx context.Context, uid string, filter *datastore.Filter, pageable datastore.Pageable) ([]datastore.Endpoint, datastore.PaginationData, error)

func (*EndpointService) ToggleEndpointStatus added in v0.8.0

func (s *EndpointService) ToggleEndpointStatus(ctx context.Context, projectID string, endpointId string) (*datastore.Endpoint, error)

func (*EndpointService) UpdateEndpoint added in v0.8.0

func (a *EndpointService) UpdateEndpoint(ctx context.Context, e models.UpdateEndpoint, endpoint *datastore.Endpoint, project *datastore.Project) (*datastore.Endpoint, error)

type EventService

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

func (*EventService) BatchReplayEvents added in v0.8.0

func (e *EventService) BatchReplayEvents(ctx context.Context, filter *datastore.Filter) (int, int, error)

func (*EventService) BatchRetryEventDelivery

func (e *EventService) BatchRetryEventDelivery(ctx context.Context, filter *datastore.Filter) (int, int, error)

func (*EventService) CountAffectedEventDeliveries

func (e *EventService) CountAffectedEventDeliveries(ctx context.Context, filter *datastore.Filter) (int64, error)

func (*EventService) CountAffectedEvents added in v0.8.0

func (e *EventService) CountAffectedEvents(ctx context.Context, filter *datastore.Filter) (int64, error)

func (*EventService) CreateEvent added in v0.8.0

func (e *EventService) CreateEvent(ctx context.Context, newMessage *models.Event, g *datastore.Project) (*datastore.Event, error)

func (*EventService) CreateFanoutEvent added in v0.8.0

func (e *EventService) CreateFanoutEvent(ctx context.Context, newMessage *models.FanoutEvent, g *datastore.Project) (*datastore.Event, error)

func (*EventService) FindEndpoints added in v0.8.0

func (e *EventService) FindEndpoints(ctx context.Context, newMessage *models.Event, project *datastore.Project) ([]datastore.Endpoint, error)

func (*EventService) ForceResendEventDeliveries

func (e *EventService) ForceResendEventDeliveries(ctx context.Context, ids []string, g *datastore.Project) (int, int, error)

func (*EventService) GetEvent added in v0.8.0

func (e *EventService) GetEvent(ctx context.Context, projectID string, id string) (*datastore.Event, error)

func (*EventService) GetEventDeliveriesPaged

func (e *EventService) GetEventDeliveriesPaged(ctx context.Context, filter *datastore.Filter) ([]datastore.EventDelivery, datastore.PaginationData, error)

func (*EventService) GetEventDelivery

func (e *EventService) GetEventDelivery(ctx context.Context, projectID, id string) (*datastore.EventDelivery, error)

func (*EventService) GetEventsPaged

func (e *EventService) GetEventsPaged(ctx context.Context, filter *datastore.Filter) ([]datastore.Event, datastore.PaginationData, error)

func (*EventService) ReplayEvent added in v0.8.0

func (e *EventService) ReplayEvent(ctx context.Context, event *datastore.Event, g *datastore.Project) error

func (*EventService) ResendEventDelivery

func (e *EventService) ResendEventDelivery(ctx context.Context, eventDelivery *datastore.EventDelivery, g *datastore.Project) error

func (*EventService) RetryEventDelivery

func (e *EventService) RetryEventDelivery(ctx context.Context, eventDelivery *datastore.EventDelivery, g *datastore.Project) error

func (*EventService) Search added in v0.6.0

type OrganisationInviteService added in v0.6.0

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

func (*OrganisationInviteService) CancelOrganisationMemberInvite added in v0.6.0

func (ois *OrganisationInviteService) CancelOrganisationMemberInvite(ctx context.Context, inviteID string) (*datastore.OrganisationInvite, error)

func (*OrganisationInviteService) CreateOrganisationMemberInvite added in v0.6.0

func (ois *OrganisationInviteService) CreateOrganisationMemberInvite(ctx context.Context, newIV *models.OrganisationInvite, org *datastore.Organisation, user *datastore.User, baseURL string) (*datastore.OrganisationInvite, error)

func (*OrganisationInviteService) FindUserByInviteToken added in v0.6.0

func (ois *OrganisationInviteService) FindUserByInviteToken(ctx context.Context, token string) (*datastore.User, *datastore.OrganisationInvite, error)

func (*OrganisationInviteService) LoadOrganisationInvitesPaged added in v0.6.0

func (*OrganisationInviteService) ProcessOrganisationMemberInvite added in v0.6.0

func (ois *OrganisationInviteService) ProcessOrganisationMemberInvite(ctx context.Context, token string, accepted bool, newUser *models.User) error

func (*OrganisationInviteService) ResendOrganisationMemberInvite added in v0.6.0

func (ois *OrganisationInviteService) ResendOrganisationMemberInvite(ctx context.Context, inviteID string, org *datastore.Organisation, user *datastore.User, baseURL string) (*datastore.OrganisationInvite, error)

type OrganisationMemberService added in v0.6.0

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

func NewOrganisationMemberService added in v0.6.0

func NewOrganisationMemberService(orgMemberRepo datastore.OrganisationMemberRepository) *OrganisationMemberService

func (*OrganisationMemberService) CreateOrganisationMember added in v0.6.0

func (om *OrganisationMemberService) CreateOrganisationMember(ctx context.Context, org *datastore.Organisation, user *datastore.User, role *auth.Role) (*datastore.OrganisationMember, error)

func (*OrganisationMemberService) DeleteOrganisationMember added in v0.6.0

func (om *OrganisationMemberService) DeleteOrganisationMember(ctx context.Context, memberID string, org *datastore.Organisation) error

func (*OrganisationMemberService) FindOrganisationMemberByID added in v0.6.0

func (om *OrganisationMemberService) FindOrganisationMemberByID(ctx context.Context, org *datastore.Organisation, id string) (*datastore.OrganisationMember, error)

func (*OrganisationMemberService) LoadOrganisationMembersPaged added in v0.6.0

func (*OrganisationMemberService) UpdateOrganisationMember added in v0.6.0

func (om *OrganisationMemberService) UpdateOrganisationMember(ctx context.Context, organisationMember *datastore.OrganisationMember, role *auth.Role) (*datastore.OrganisationMember, error)

type OrganisationService added in v0.6.0

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

func NewOrganisationService added in v0.6.0

func NewOrganisationService(orgRepo datastore.OrganisationRepository, orgMemberRepo datastore.OrganisationMemberRepository) *OrganisationService

func (*OrganisationService) CreateOrganisation added in v0.6.0

func (os *OrganisationService) CreateOrganisation(ctx context.Context, newOrg *models.Organisation, user *datastore.User) (*datastore.Organisation, error)

func (*OrganisationService) DeleteOrganisation added in v0.6.0

func (os *OrganisationService) DeleteOrganisation(ctx context.Context, id string) error

func (*OrganisationService) FindOrganisationByID added in v0.6.0

func (os *OrganisationService) FindOrganisationByID(ctx context.Context, id string) (*datastore.Organisation, error)

func (*OrganisationService) LoadOrganisationsPaged added in v0.6.0

func (os *OrganisationService) LoadOrganisationsPaged(ctx context.Context, pageable datastore.Pageable) ([]datastore.Organisation, datastore.PaginationData, error)

func (*OrganisationService) LoadUserOrganisationsPaged added in v0.6.0

func (os *OrganisationService) LoadUserOrganisationsPaged(ctx context.Context, user *datastore.User, pageable datastore.Pageable) ([]datastore.Organisation, datastore.PaginationData, error)

func (*OrganisationService) UpdateOrganisation added in v0.6.0

type PortalLinkService added in v0.8.0

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

func NewPortalLinkService added in v0.8.0

func NewPortalLinkService(portalLinkRepo datastore.PortalLinkRepository, endpointService *EndpointService) *PortalLinkService

func (*PortalLinkService) CreateEndpoint added in v0.8.0

func (p *PortalLinkService) CreateEndpoint(ctx context.Context, project *datastore.Project, data models.Endpoint, portalLink *datastore.PortalLink) (*datastore.Endpoint, error)
func (p *PortalLinkService) CreatePortalLink(ctx context.Context, portal *models.PortalLink, project *datastore.Project) (*datastore.PortalLink, error)

func (*PortalLinkService) FindPortalLinkByID added in v0.8.0

func (p *PortalLinkService) FindPortalLinkByID(ctx context.Context, project *datastore.Project, uid string) (*datastore.PortalLink, error)

func (*PortalLinkService) GetPortalLinkEndpoints added in v0.8.0

func (p *PortalLinkService) GetPortalLinkEndpoints(ctx context.Context, portal *datastore.PortalLink, project *datastore.Project) ([]datastore.Endpoint, error)

func (*PortalLinkService) LoadPortalLinksPaged added in v0.8.0

func (p *PortalLinkService) RevokePortalLink(ctx context.Context, project *datastore.Project, portalLink *datastore.PortalLink) error
func (p *PortalLinkService) UpdatePortalLink(ctx context.Context, project *datastore.Project, update *models.PortalLink, portalLink *datastore.PortalLink) (*datastore.PortalLink, error)

type ProjectService added in v0.8.0

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

func NewProjectService added in v0.8.0

func NewProjectService(apiKeyRepo datastore.APIKeyRepository, projectRepo datastore.ProjectRepository, eventRepo datastore.EventRepository, eventDeliveryRepo datastore.EventDeliveryRepository, limiter limiter.RateLimiter, cache cache.Cache) *ProjectService

func (*ProjectService) CreateProject added in v0.8.0

func (*ProjectService) DeleteProject added in v0.8.0

func (ps *ProjectService) DeleteProject(ctx context.Context, id string) error

func (*ProjectService) FillProjectStatistics added in v0.8.0

func (ps *ProjectService) FillProjectStatistics(ctx context.Context, project *datastore.Project) error

func (*ProjectService) GetProjects added in v0.8.0

func (ps *ProjectService) GetProjects(ctx context.Context, filter *datastore.ProjectFilter) ([]*datastore.Project, error)

func (*ProjectService) UpdateProject added in v0.8.0

func (ps *ProjectService) UpdateProject(ctx context.Context, project *datastore.Project, update *models.UpdateProject) (*datastore.Project, error)

type SecurityService

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

func NewSecurityService

func NewSecurityService(projectRepo datastore.ProjectRepository, apiKeyRepo datastore.APIKeyRepository) *SecurityService

func (*SecurityService) CreateAPIKey

func (ss *SecurityService) CreateAPIKey(ctx context.Context, member *datastore.OrganisationMember, newApiKey *models.APIKey) (*datastore.APIKey, string, error)

func (*SecurityService) CreateEndpointAPIKey added in v0.8.0

func (ss *SecurityService) CreateEndpointAPIKey(ctx context.Context, d *models.CreateEndpointApiKey) (*datastore.APIKey, string, error)

func (*SecurityService) CreatePersonalAPIKey added in v0.7.0

func (ss *SecurityService) CreatePersonalAPIKey(ctx context.Context, user *datastore.User, newApiKey *models.PersonalAPIKey) (*datastore.APIKey, string, error)

func (*SecurityService) GetAPIKeyByID

func (ss *SecurityService) GetAPIKeyByID(ctx context.Context, uid string) (*datastore.APIKey, error)

func (*SecurityService) GetAPIKeys

func (*SecurityService) RegenerateProjectAPIKey added in v0.8.1

func (ss *SecurityService) RegenerateProjectAPIKey(ctx context.Context, project *datastore.Project, member *datastore.OrganisationMember) (*datastore.APIKey, string, error)

func (*SecurityService) RevokeAPIKey

func (ss *SecurityService) RevokeAPIKey(ctx context.Context, uid string) error

func (*SecurityService) RevokePersonalAPIKey added in v0.7.0

func (ss *SecurityService) RevokePersonalAPIKey(ctx context.Context, uid string, user *datastore.User) error

func (*SecurityService) UpdateAPIKey

func (ss *SecurityService) UpdateAPIKey(ctx context.Context, uid string, role *auth.Role) (*datastore.APIKey, error)

type SourceService added in v0.6.0

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

func NewSourceService added in v0.6.0

func NewSourceService(sourceRepo datastore.SourceRepository, cache cache.Cache) *SourceService

func (*SourceService) CreateSource added in v0.6.0

func (s *SourceService) CreateSource(ctx context.Context, newSource *models.Source, g *datastore.Project) (*datastore.Source, error)

func (*SourceService) DeleteSource added in v0.6.0

func (s *SourceService) DeleteSource(ctx context.Context, g *datastore.Project, source *datastore.Source) error

func (*SourceService) FindSourceByID added in v0.6.0

func (s *SourceService) FindSourceByID(ctx context.Context, g *datastore.Project, id string) (*datastore.Source, error)

func (*SourceService) FindSourceByMaskID added in v0.6.2

func (s *SourceService) FindSourceByMaskID(ctx context.Context, maskID string) (*datastore.Source, error)

func (*SourceService) LoadSourcesPaged added in v0.6.0

func (*SourceService) UpdateSource added in v0.6.0

func (s *SourceService) UpdateSource(ctx context.Context, g *datastore.Project, sourceUpdate *models.UpdateSource, source *datastore.Source) (*datastore.Source, error)

type SubcriptionService added in v0.6.0

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

func NewSubscriptionService added in v0.6.0

func NewSubscriptionService(subRepo datastore.SubscriptionRepository, endpointRepo datastore.EndpointRepository, sourceRepo datastore.SourceRepository) *SubcriptionService

func (*SubcriptionService) CreateSubscription added in v0.6.0

func (s *SubcriptionService) CreateSubscription(ctx context.Context, project *datastore.Project, newSubscription *models.Subscription) (*datastore.Subscription, error)

func (*SubcriptionService) DeleteSubscription added in v0.6.0

func (s *SubcriptionService) DeleteSubscription(ctx context.Context, groupId string, subscription *datastore.Subscription) error

func (*SubcriptionService) FindSubscriptionByID added in v0.6.0

func (s *SubcriptionService) FindSubscriptionByID(ctx context.Context, project *datastore.Project, subscriptionId string, skipCache bool) (*datastore.Subscription, error)

func (*SubcriptionService) LoadSubscriptionsPaged added in v0.6.0

func (*SubcriptionService) TestSubscriptionFilter added in v0.8.0

func (s *SubcriptionService) TestSubscriptionFilter(ctx context.Context, testRequest map[string]interface{}, filter map[string]interface{}) (bool, error)

func (*SubcriptionService) UpdateSubscription added in v0.6.0

func (s *SubcriptionService) UpdateSubscription(ctx context.Context, projectId string, subscriptionId string, update *models.UpdateSubscription) (*datastore.Subscription, error)

type UserService added in v0.6.0

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

func NewUserService added in v0.6.0

func NewUserService(userRepo datastore.UserRepository, cache cache.Cache, queue queue.Queuer, configService *ConfigService, orgService *OrganisationService) *UserService

func (*UserService) GeneratePasswordResetToken added in v0.6.0

func (u *UserService) GeneratePasswordResetToken(ctx context.Context, baseURL string, data *models.ForgotPassword) error

func (*UserService) LoginUser added in v0.6.0

func (u *UserService) LoginUser(ctx context.Context, data *models.LoginUser) (*datastore.User, *jwt.Token, error)

func (*UserService) LogoutUser added in v0.6.0

func (u *UserService) LogoutUser(token string) error

func (*UserService) RefreshToken added in v0.6.0

func (u *UserService) RefreshToken(ctx context.Context, data *models.Token) (*jwt.Token, error)

func (*UserService) RegisterUser added in v0.6.5

func (u *UserService) RegisterUser(ctx context.Context, baseURL string, data *models.RegisterUser) (*datastore.User, *jwt.Token, error)

func (*UserService) ResendEmailVerificationToken added in v0.8.0

func (u *UserService) ResendEmailVerificationToken(ctx context.Context, baseURL string, user *datastore.User) error

func (*UserService) ResetPassword added in v0.6.0

func (u *UserService) ResetPassword(ctx context.Context, token string, data *models.ResetPassword) (*datastore.User, error)

func (*UserService) UpdatePassword added in v0.6.0

func (u *UserService) UpdatePassword(ctx context.Context, data *models.UpdatePassword, user *datastore.User) (*datastore.User, error)

func (*UserService) UpdateUser added in v0.6.0

func (u *UserService) UpdateUser(ctx context.Context, data *models.UpdateUser, user *datastore.User) (*datastore.User, error)

func (*UserService) VerifyEmail added in v0.8.0

func (u *UserService) VerifyEmail(ctx context.Context, token string) error

Jump to

Keyboard shortcuts

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